This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from, to, branch = ARGF.read.split " " | |
if (branch =~ /herestomwiththeweather$/) == nil | |
puts "Received branch #{branch}, not deploying." | |
exit | |
end | |
deploy_to_dir = '/home/pants/deploy/herestomwiththeweather-jekyll-indieweb' | |
`unset GIT_DIR && cd "#{deploy_to_dir}" && git pull` | |
puts "DEPLOY: herestomwiththeweather(#{to}) copied to '#{deploy_to_dir}'" | |
`cd /home/pants/repositories/herestomwiththeweather-jekyll-indieweb.git/hooks && ./send_webmentions.rb` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env ruby | |
require 'rss' | |
require 'webmention' | |
require 'time' | |
string = File.open('latest_time.txt', 'r') { |f| f.read } | |
latest = string.strip # RSS timestamp of most recent blog post for which webmentions have been sent | |
latest_found = latest # RSS timestamp of most recent blog post including new ones found | |
last_time = Time.parse(latest) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Verifying that +herestomwiththeweather is my blockchain ID. https://onename.com/herestomwiththeweather |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'uri' | |
require 'cgi' | |
require 'net/https' | |
require 'json' | |
require 'oauth2_mac_client' | |
# oauth2_mac_client gem at https://github.com/herestomwiththeweather/oauth2_mac_client | |
# usage using this test class: | |
# > client = OAuth2Client.new | |
# > client.get_token('refresh_token') # get a new MAC type access token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def authorized_for?(requested_amount) | |
['single_payment','recurring_payment'].include?(action_id) && requested_amount <= amount.to_f && !invalidated? | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
unless (access_token.nil? || access_token.authorized_for?(exchange.amount)) | |
false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create_request_token(params={}) | |
if params[:scope] | |
scope_uri = URI.parse(params[:scope]) | |
# XXX ignoring host:port and assuming it's our host:port | |
filepath = RAILS_ROOT + '/public' + scope_uri.path | |
if File.exist?(filepath) | |
# valid asset is required | |
asset = CGI::parse(scope_uri.query)['asset'][0] | |
unless asset.blank? | |
group = Group.find_by_asset(asset) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
POST /oauth/request_token HTTP/1.1 | |
Accept: */* | |
Connection: close | |
User-Agent: OAuth gem v0.4.4 | |
Content-Type: application/x-www-form-urlencoded | |
Authorization: OAuth oauth_callback="http%3A%2F%2Flocalhost%3A3001%2Foauth_callback", oauth_consumer_key="xBoHeeNNFt3LQ7U1tvAb8BVKr32duE6rdWtpCSFD", oauth_nonce="cde4xVNJBZm6XAy3V6EjMk8gy6uTPf5wEdZgKiMlk", oauth_signature="dyP6m%2FQm%2Bvnes86o6dLvD013Yy4%3D", oauth_signature_method="HMAC-SHA1", oauth_timestamp="1305937625", oauth_version="1.0" | |
Content-Length: 106 | |
Host: demo.opensourcecurrency.org | |
scope=http%3a%2f%2fdemo.opensourcecurrency.org%2fscopes%2fsingle_payment.json%3fasset%3dbernalbucks%26amount%3d3 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"action": | |
{ | |
"_id":"single_payment", | |
"name":"single payment", | |
"icon_uri":"/images/icons/switch.gif" | |
} | |
} |
NewerOlder