shushu 0.1.14 → 0.1.15

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. data/lib/models/acct_own.rb +10 -16
  2. data/readme.md +15 -13
  3. metadata +5 -5
@@ -3,25 +3,19 @@ module Shushu
3
3
  extend self
4
4
 
5
5
  def act(args)
6
- pmid, eid = args.delete(:payment_method_id), args.delete(:entity_id)
7
- Shushu.handle_req {RestClient.post(acct_own_url(pmid, eid), args, Shushu.headers)}
8
- end
9
-
10
- def xfr(args)
11
- prev_pmid, prev_eid = args.delete(:prev_payment_method_id), args.delete(:prev_entity_id)
12
- Shushu.handle_req {RestClient.put(acct_own_url(prev_pmid, prev_eid), args, Shushu.headers)}
6
+ pmid , eid = args.delete(:payment_method_id), args.delete(:entity_id)
7
+ args[:state] = "active"
8
+ Shushu.handle_req do
9
+ RestClient.put(acct_own_url(pmid, eid), args, Shushu.headers)
10
+ end
13
11
  end
14
12
 
15
13
  def deact(args)
16
- pmid = args.delete(:payment_method_id)
17
- eid = args.delete(:entity_id)
18
- account_id = args[:account_id]
19
- time = args[:time]
20
- Shushu.handle_req {RestClient.delete([acct_own_url(pmid, eid), CGI.escape("?account_id=#{account_id}&time=#{time}")].join)}
21
- end
22
-
23
- def query(args)
24
- Shushu.handle_req {RestClient.get([Shushu.url, "/accounts/#{args[:account_id]}/resource_ownerships"].join)}
14
+ pmid, eid = args.delete(:payment_method_id), args.delete(:entity_id)
15
+ args[:state] = "inactive"
16
+ Shushu.handle_req do
17
+ RestClient.put(acct_own_url(pmid, eid), args, Shushu.headers)
18
+ end
25
19
  end
26
20
 
27
21
  def acct_own_url(payment_method_id, entity_id)
data/readme.md CHANGED
@@ -59,8 +59,8 @@ PMethod.update(
59
59
  #=> {:id => "001", :card_token => "abc123", :card_type => "visa", :card_last4 => "1111"}
60
60
  ```
61
61
 
62
- Create a new payment_method with a token. Note, this endpoint is idempotent with
63
- respect to the id and token.
62
+ Create a new payment_method with a token. Note, this endpoint is
63
+ idempotent with respect to the id and token.
64
64
 
65
65
  ```ruby
66
66
  PMethod.update(:id => "my-custom-id", :card_token => "abc123")
@@ -104,18 +104,18 @@ Shushu::AcctOwn.act(
104
104
  #=> {"payment_method_id"=>"123", "account_id"=>"1", "entity_id"=>"entity123"}
105
105
  ```
106
106
 
107
- Now we need to change the payment_method on an account:
107
+ If you need to move one account to another payment_method, you will need to
108
+ deactivate the previous relationship and activate a new one. To deactivate
109
+ call this method:
108
110
 
109
111
  ```ruby
110
- Shushu::AcctOwn.xfr(
111
- :prev_payment_method_id => prev_payment_method_id,
112
- :payment_method_id => new_payment_method_id,
113
- :account_id => account_id,
114
- :prev_entity_id => prev_entity_id,
115
- :entity_id => entity_id,
116
- :time => time
112
+ Shushu::AcctOwn.deact(
113
+ :account_id => vault_account_id,
114
+ :payment_method_id => payment_method_id,
115
+ :entity_id => entity_id,
116
+ :time => time
117
117
  )
118
- #=> {"payment_method_id"=>"456", "account_id"=>"1", "entity_id"=>"event124"}
118
+ #=> {"payment_method_id"=>"123", "account_id"=>"1", "entity_id"=>"entity123"}
119
119
  ```
120
120
 
121
121
  ### RateCode
@@ -168,7 +168,8 @@ Heroku apps and Teams.
168
168
 
169
169
  Reference: [ResourceOwnership API](https://github.com/heroku/shushud/blob/master/doc/resource_ownership_api.md)
170
170
 
171
- When a new app is created, activate a new resource_ownership record.
171
+ When the app is created or it is joining a new account, activate the the
172
+ resource_ownership record.
172
173
 
173
174
  ```ruby
174
175
  Shushu::ResOwn.act(
@@ -180,7 +181,8 @@ Shushu::ResOwn.act(
180
181
  #=> {"resource_id"=>"123", "account_id"=>"1", "entity_id"=>"event123", "state": "active"}
181
182
  ```
182
183
 
183
- When an app is destroyed, deactivate the resource_ownership record.
184
+ When an app is destroyed, or the app is moving to a new account_id,
185
+ deactivate the resource_ownership record.
184
186
 
185
187
  ```ruby
186
188
  Shushu::ResOwn.deact(
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shushu
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.14
4
+ version: 0.1.15
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -13,7 +13,7 @@ date: 2011-12-29 00:00:00.000000000Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
- requirement: &10447360 !ruby/object:Gem::Requirement
16
+ requirement: &6050040 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '0'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *10447360
24
+ version_requirements: *6050040
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: yajl-ruby
27
- requirement: &10446420 !ruby/object:Gem::Requirement
27
+ requirement: &6048380 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ~>
@@ -32,7 +32,7 @@ dependencies:
32
32
  version: 1.1.0
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *10446420
35
+ version_requirements: *6048380
36
36
  description: A ruby wrapper around Shushu's HTTP API.
37
37
  email: ryan@heroku.com
38
38
  executables: []