shushu 0.1.14 → 0.1.15
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/models/acct_own.rb +10 -16
- data/readme.md +15 -13
- metadata +5 -5
data/lib/models/acct_own.rb
CHANGED
@@ -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
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
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
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
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
|
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
|
-
|
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.
|
111
|
-
:
|
112
|
-
:payment_method_id
|
113
|
-
:
|
114
|
-
:
|
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"=>"
|
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
|
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,
|
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.
|
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: &
|
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: *
|
24
|
+
version_requirements: *6050040
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: yajl-ruby
|
27
|
-
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: *
|
35
|
+
version_requirements: *6048380
|
36
36
|
description: A ruby wrapper around Shushu's HTTP API.
|
37
37
|
email: ryan@heroku.com
|
38
38
|
executables: []
|