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
Exchange.all.each {|e| e.destroy if e.group} | |
Account.all.each {|a| a.destroy if a.group} | |
Group.all.each {|g| g.adhoc_currency = false; g.unit = nil; g.save!} |
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
javascript:(function(){ asset_urls = [];var links = document.getElementsByTagName("a");for(var i=0;i<links.length;i++){if (links[i].getAttribute('rel') == 'payment') { asset_urls.push(links[i].getAttribute('href'));}} window.name = 'receiver'; var remoteWin=window.open('','','resizable=yes,width=550,height=550'); remoteWin.document.write('<html><body>'); for(var j=0;j<asset_urls.length;j++){remoteWin.document.write('<a href="' + asset_urls[j] + '/new?to=' + encodeURIComponent(window.location.href) + '">' + asset_urls[j] + '</a><br><br>');} remoteWin.document.write('') })(); |
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
javascript:(function(){ asset_urls = [];var links = document.getElementsByTagName("a");for(var i=0;i<links.length;i++){if (links[i].getAttribute('href').match(/\/transacts/)) { asset_urls.push(links[i].getAttribute('href'));}} var remoteWin=window.open('','','resizable=yes,width=550,height=550'); remoteWin.document.write('<html><body>'); for(var j=0;j<asset_urls.length;j++){remoteWin.document.write('<a href="' + asset_urls[j] + '/new?to=' + encodeURIComponent(window.location.href) + '">' + asset_urls[j] + '</a><br><br>');} remoteWin.document.write('') })(); |
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
javascript:(function(){ asset_urls = [];var twitter_id='';var metatags=document.getElementsByTagName("meta");for(var j=0;j<metatags.length;j++){if(metatags[j].getAttribute('name') == 'session-userid') {twitter_id=metatags[j].getAttribute('content');}} var links = document.getElementsByTagName("a");for(var i=0;i<links.length;i++){if (links[i].getAttribute('href') && links[i].getAttribute('href').match(/\/transacts/)) { asset_urls.push(links[i].getAttribute('href'));}} var remoteWin=window.open('','','resizable=yes,width=550,height=550'); remoteWin.document.write('<html><body>'); for(var j=0;j<asset_urls.length;j++){remoteWin.document.write('<a href="' + asset_urls[j] + '/new?to=' + twitter_id + '">' + asset_urls[j] + '</a><br><br>');} remoteWin.document.write('</body></html>') })(); |
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
1. create a group -> group_id | |
2. delete new group's forum and assign old main forum to new group: | |
Forum.find_by_group_id(group_id).delete | |
g = Group.find(group_id) | |
f = Forum.first(:conditions => ['group_id IS ?',nil]) | |
f.group = g | |
f.save | |
3. change all members' default accounts to belong to the new group: |
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
@e.amount = 1.0 | |
@e.customer = @p2 | |
@membership.roles = ['individual'] | |
@membership.save | |
account = @p2.account(@g) | |
account.balance = 0.0 | |
account.credit_limit = 0.5 | |
account.save! |
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
can :create, Exchange do |exchange| | |
unless exchange.group | |
# the presence of group is validated when creating an exchange | |
# group will be nil for the new method, so allow it | |
true | |
else | |
membership = Membership.mem(person,exchange.group) | |
unless membership | |
false | |
else |
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?(amount) | |
credit_limit.nil? or (amount <= balance + credit_limit) | |
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
{ | |
"action": | |
{ | |
"_id":"single_payment", | |
"name":"single payment", | |
"icon_uri":"/images/icons/switch.gif" | |
} | |
} |
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 |
OlderNewer