promisepay 0.0.6 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +9 -17
- data/Rakefile +0 -8
- data/lib/promisepay/client.rb +2 -2
- data/lib/promisepay/error.rb +3 -1
- data/lib/promisepay/models/bank_account.rb +2 -2
- data/lib/promisepay/models/card_account.rb +2 -2
- data/lib/promisepay/models/company.rb +1 -24
- data/lib/promisepay/models/item.rb +36 -48
- data/lib/promisepay/models/paypal_account.rb +2 -2
- data/lib/promisepay/models/transaction.rb +3 -3
- data/lib/promisepay/models/user.rb +6 -30
- data/lib/promisepay/resources/bank_account_resource.rb +2 -16
- data/lib/promisepay/resources/card_account_resource.rb +2 -2
- data/lib/promisepay/resources/company_resource.rb +4 -4
- data/lib/promisepay/resources/fee_resource.rb +3 -3
- data/lib/promisepay/resources/item_resource.rb +3 -3
- data/lib/promisepay/resources/paypal_account_resource.rb +2 -2
- data/lib/promisepay/resources/token_resource.rb +1 -1
- data/lib/promisepay/resources/transaction_resource.rb +2 -2
- data/lib/promisepay/resources/user_resource.rb +4 -4
- data/promisepay.gemspec +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c3efbba09ad1693661066cd70cc8eaf4da701934
|
4
|
+
data.tar.gz: a576fd9343df156c15d989e84b0ef60583860f84
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 872575fef51332bb6ae059113d6cfabdce8310d5fb20cf9af11bdf6234dcd7a2ad02b6ff71c0437b90ba216537016b789093aed2d7dea7561c4fbf22cb6c94e0
|
7
|
+
data.tar.gz: 5074bf9962a4b14f5a8318fae8e45602c900d4af17d8f4b97762e1bbb53c17592963314ee79ff4dee05595493a71a041e7f4e4abe548702c8efa8a5899cf9b53
|
data/README.md
CHANGED
@@ -3,8 +3,8 @@
|
|
3
3
|
[](https://gitter.im/PromisePay/promisepay-ruby?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
4
4
|
|
5
5
|
[](http://badge.fury.io/rb/promisepay)
|
6
|
-
[](https://travis-ci.org/PromisePay/promisepay-ruby)
|
7
|
+
[](https://coveralls.io/r/PromisePay/promisepay-ruby?branch=develop)
|
8
8
|
[](https://codeclimate.com/github/PromisePay/promisepay-ruby)
|
9
9
|
|
10
10
|
To see a completed integration in a Ruby on Rails app, visit this [repository](https://github.com/dannyshafer/PromisePay_api_integration).
|
@@ -33,6 +33,11 @@ See [PromisePay documentation](https://promisepay-docs.readme.io/v1.0/docs/fetch
|
|
33
33
|
|
34
34
|
**Create a PromisePay client**
|
35
35
|
|
36
|
+
```ruby
|
37
|
+
#In the Gemfile
|
38
|
+
gem 'promisepay'
|
39
|
+
```
|
40
|
+
|
36
41
|
The client can be configured through environment variables.
|
37
42
|
|
38
43
|
```ruby
|
@@ -48,7 +53,7 @@ The following parameters are configurable through the client:
|
|
48
53
|
* `:environment` / `ENV['PROMISEPAY_ENVIRONMENT']`: API [environment](http://docs.promisepay.com/v2.2/docs/environments) to use (default: 'test')
|
49
54
|
* `:api_domain` / `ENV['PROMISEPAY_API_DOMAIN']`: API domain name to use (default: 'api.promisepay.com')
|
50
55
|
|
51
|
-
Instantiate the
|
56
|
+
Instantiate client in the appropriate controller
|
52
57
|
|
53
58
|
```ruby
|
54
59
|
client = Promisepay::Client.new(username: ENV['PROMISEPAY_USERNAME'], token: ENV['PROMISEPAY_TOKEN'])
|
@@ -58,7 +63,7 @@ client = Promisepay::Client.new(username: ENV['PROMISEPAY_USERNAME'], token: ENV
|
|
58
63
|
|
59
64
|
##Tokens
|
60
65
|
##### Example 1 - Request session token
|
61
|
-
The below example shows the controller request for a marketplace configured to have the Item and User IDs generated automatically for them.
|
66
|
+
The below example shows the controller request for a marketplace configured to have the Item and User IDs generated automatically for them.
|
62
67
|
|
63
68
|
```ruby
|
64
69
|
token_request = client.tokens.create(:session, {
|
@@ -220,10 +225,6 @@ user.bank_account
|
|
220
225
|
```ruby
|
221
226
|
user.items
|
222
227
|
```
|
223
|
-
#####Get a user's address
|
224
|
-
```ruby
|
225
|
-
user.address
|
226
|
-
```
|
227
228
|
#####Set a user's disbursement account
|
228
229
|
```ruby
|
229
230
|
user.disbursement_account(bank_account.id)
|
@@ -328,10 +329,6 @@ bank_account.deactivate
|
|
328
329
|
```ruby
|
329
330
|
bank_account.user
|
330
331
|
```
|
331
|
-
#####Validate Routing Number
|
332
|
-
```ruby
|
333
|
-
client.bank_accounts.validate('122235821')
|
334
|
-
```
|
335
332
|
|
336
333
|
##PayPal Accounts
|
337
334
|
#####Create a PayPal account
|
@@ -382,11 +379,6 @@ client.companies.find('compamy_id')
|
|
382
379
|
client.companies.find_all
|
383
380
|
```
|
384
381
|
|
385
|
-
#####Get a company's address
|
386
|
-
```ruby
|
387
|
-
company.address
|
388
|
-
```
|
389
|
-
|
390
382
|
#####Update a company
|
391
383
|
```ruby
|
392
384
|
client.companies.update(
|
data/Rakefile
CHANGED
data/lib/promisepay/client.rb
CHANGED
@@ -55,9 +55,9 @@ module Promisepay
|
|
55
55
|
# @param url [String] The path, relative to {#api_endpoint}
|
56
56
|
# @param parameters [Hash] Query params for request
|
57
57
|
# @return [Faraday::Response]
|
58
|
-
def get(url, parameters = {}
|
58
|
+
def get(url, parameters = {})
|
59
59
|
response = connection.get("#{api_endpoint}#{url}", parameters)
|
60
|
-
on_complete(response)
|
60
|
+
on_complete(response)
|
61
61
|
response
|
62
62
|
end
|
63
63
|
|
data/lib/promisepay/error.rb
CHANGED
@@ -39,7 +39,9 @@ module Promisepay
|
|
39
39
|
message = ''
|
40
40
|
message << json_response['message'] if json_response.key?('message')
|
41
41
|
if json_response.key?('errors')
|
42
|
-
|
42
|
+
json_response['errors'].each do |attribute, content|
|
43
|
+
message << "#{attribute}: #{content}"
|
44
|
+
end
|
43
45
|
end
|
44
46
|
|
45
47
|
message
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class BankAccount < Account
|
4
4
|
# Get the user the bank account belongs to.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsidusers
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -14,7 +14,7 @@ module Promisepay
|
|
14
14
|
# Deletes a bank account for a user on a marketplace.
|
15
15
|
# Sets the account to in-active.
|
16
16
|
#
|
17
|
-
# @see
|
17
|
+
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsid
|
18
18
|
#
|
19
19
|
# @param mobile_pin [String] Mobile PIN.
|
20
20
|
#
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class CardAccount < Account
|
4
4
|
# Get the user the card account belongs to.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see http://docs.promisepay.com/v2.2/docs/card_accountsidusers
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -14,7 +14,7 @@ module Promisepay
|
|
14
14
|
# Deletes a card account for a user on a marketplace.
|
15
15
|
# Sets the account to in-active.
|
16
16
|
#
|
17
|
-
# @see
|
17
|
+
# @see http://docs.promisepay.com/v2.2/docs/card_accountsid
|
18
18
|
#
|
19
19
|
# @return [Boolean]
|
20
20
|
def deactivate
|
@@ -1,38 +1,15 @@
|
|
1
1
|
module Promisepay
|
2
2
|
# Manage Companies
|
3
3
|
class Company < BaseModel
|
4
|
-
# Update the attributes of an item.
|
5
|
-
#
|
6
|
-
# @see https://reference.promisepay.com/#update-item
|
7
|
-
#
|
8
|
-
# @param attributes [Hash] Item's attributes to be updated.
|
9
|
-
#
|
10
|
-
# @return [self]
|
11
|
-
def update(attributes)
|
12
|
-
response = JSON.parse(@client.patch("companies/#{send(:id)}", attributes).body)
|
13
|
-
@attributes = response['companies']
|
14
|
-
self
|
15
|
-
end
|
16
4
|
|
17
5
|
# Get the user the company belongs to.
|
18
6
|
#
|
19
|
-
# @see
|
7
|
+
# @see
|
20
8
|
#
|
21
9
|
# @return [Promisepay::User]
|
22
10
|
def user
|
23
11
|
response = JSON.parse(@client.get("companies/#{send(:id)}/users").body)
|
24
12
|
Promisepay::User.new(@client, response['users'])
|
25
13
|
end
|
26
|
-
|
27
|
-
# Gets company address.
|
28
|
-
#
|
29
|
-
# @see https://reference.promisepay.com/#addresses
|
30
|
-
#
|
31
|
-
# @return [Hash]
|
32
|
-
def address
|
33
|
-
return nil unless @attributes.key?('related')
|
34
|
-
response = JSON.parse(@client.get("addresses/#{send(:related)['addresses']}").body)
|
35
|
-
response['addresses']
|
36
|
-
end
|
37
14
|
end
|
38
15
|
end
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class Item < BaseModel
|
4
4
|
# Update the attributes of an item.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsiduseraction
|
7
7
|
#
|
8
8
|
# @param attributes [Hash] Item's attributes to be updated.
|
9
9
|
#
|
@@ -16,7 +16,7 @@ module Promisepay
|
|
16
16
|
|
17
17
|
# Show the item status for a marketplace.
|
18
18
|
#
|
19
|
-
# @see
|
19
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidstatus
|
20
20
|
#
|
21
21
|
# @return [Hash]
|
22
22
|
def status
|
@@ -26,7 +26,7 @@ module Promisepay
|
|
26
26
|
|
27
27
|
# Show the buyer detail for a single item for a marketplace.
|
28
28
|
#
|
29
|
-
# @see
|
29
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidbuyers
|
30
30
|
#
|
31
31
|
# @return [Promisepay::User]
|
32
32
|
def buyer
|
@@ -36,7 +36,7 @@ module Promisepay
|
|
36
36
|
|
37
37
|
# Show the seller detail for a single item for a marketplace.
|
38
38
|
#
|
39
|
-
# @see
|
39
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidbuyers
|
40
40
|
#
|
41
41
|
# @return [Promisepay::User]
|
42
42
|
def seller
|
@@ -46,7 +46,7 @@ module Promisepay
|
|
46
46
|
|
47
47
|
# Get fees associated to the item.
|
48
48
|
#
|
49
|
-
# @see
|
49
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidfees
|
50
50
|
#
|
51
51
|
# @param options [Hash] Optional options.
|
52
52
|
# @option options [Integer] :limit Can ask for up to 200 fees. default: 10
|
@@ -61,7 +61,7 @@ module Promisepay
|
|
61
61
|
|
62
62
|
# Get historical transaction for the item.
|
63
63
|
#
|
64
|
-
# @see
|
64
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidtransactions
|
65
65
|
#
|
66
66
|
# @param options [Hash] Optional options.
|
67
67
|
# @option options [Integer] :limit Can ask for up to 200 transactions. default: 10
|
@@ -76,7 +76,7 @@ module Promisepay
|
|
76
76
|
|
77
77
|
# Show the wire details for payment.
|
78
78
|
#
|
79
|
-
# @see
|
79
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidwire_details
|
80
80
|
#
|
81
81
|
# @return [Hash]
|
82
82
|
def wire_details
|
@@ -86,7 +86,7 @@ module Promisepay
|
|
86
86
|
|
87
87
|
# Show the bpay details details for payment.
|
88
88
|
#
|
89
|
-
# @see
|
89
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidbpay_details
|
90
90
|
#
|
91
91
|
# @return [Hash]
|
92
92
|
def bpay_details
|
@@ -94,60 +94,53 @@ module Promisepay
|
|
94
94
|
response['items']['bpay_details']
|
95
95
|
end
|
96
96
|
|
97
|
-
#
|
97
|
+
# .
|
98
98
|
#
|
99
|
-
# @see
|
99
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidaction
|
100
100
|
#
|
101
101
|
# @return [Boolean]
|
102
102
|
def make_payment(options = {})
|
103
|
-
|
104
|
-
@attributes = response['items']
|
103
|
+
@client.patch("items/#{send(:id)}/make_payment", options).body
|
105
104
|
true
|
106
105
|
end
|
107
106
|
|
108
|
-
#
|
107
|
+
# .
|
109
108
|
#
|
110
|
-
# @see
|
109
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidrequest_payment
|
111
110
|
#
|
112
111
|
# @return [Boolean]
|
113
112
|
def request_payment(options = {})
|
114
|
-
|
115
|
-
@attributes = response['items']
|
113
|
+
@client.patch("items/#{send(:id)}/request_payment", options).body
|
116
114
|
true
|
117
115
|
end
|
118
116
|
|
119
|
-
#
|
120
|
-
# payment type.
|
117
|
+
# .
|
121
118
|
#
|
122
|
-
# @see
|
119
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidrequest_payment
|
123
120
|
#
|
124
121
|
# @return [Boolean]
|
125
122
|
def release_payment(options = {})
|
126
|
-
|
127
|
-
@attributes = response['items']
|
123
|
+
@client.patch("items/#{send(:id)}/release_payment", options).body
|
128
124
|
true
|
129
125
|
end
|
130
126
|
|
131
|
-
#
|
132
|
-
# Release payment type.
|
127
|
+
# .
|
133
128
|
#
|
134
|
-
# @see
|
129
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidrequest_release
|
135
130
|
#
|
136
131
|
# @return [Boolean]
|
137
132
|
def request_release(options = {})
|
138
|
-
|
139
|
-
@attributes = response['items']
|
133
|
+
@client.patch("items/#{send(:id)}/request_release", options).body
|
140
134
|
true
|
141
135
|
end
|
142
136
|
|
143
|
-
#
|
137
|
+
# .
|
144
138
|
#
|
145
|
-
# @see
|
139
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidacknowledge_wire
|
146
140
|
#
|
147
141
|
# @return [Boolean]
|
148
142
|
def acknowledge_wire(options = {})
|
149
|
-
|
150
|
-
@attributes = response['items']
|
143
|
+
@client.patch("items/#{send(:id)}/acknowledge_wire", options).body
|
151
144
|
true
|
152
145
|
end
|
153
146
|
|
@@ -157,52 +150,47 @@ module Promisepay
|
|
157
150
|
#
|
158
151
|
# @return [Boolean]
|
159
152
|
def acknowledge_paypal(options = {})
|
160
|
-
|
161
|
-
@attributes = response['items']
|
153
|
+
@client.patch("items/#{send(:id)}/acknowledge_paypal", options).body
|
162
154
|
true
|
163
155
|
end
|
164
156
|
|
165
|
-
#
|
157
|
+
# .
|
166
158
|
#
|
167
|
-
# @see
|
159
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidrevert_wire
|
168
160
|
#
|
169
161
|
# @return [Boolean]
|
170
162
|
def revert_wire(options = {})
|
171
|
-
|
172
|
-
@attributes = response['items']
|
163
|
+
@client.patch("items/#{send(:id)}/revert_wire", options).body
|
173
164
|
true
|
174
165
|
end
|
175
166
|
|
176
|
-
#
|
167
|
+
# .
|
177
168
|
#
|
178
|
-
# @see
|
169
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidrequest_refund
|
179
170
|
#
|
180
171
|
# @return [Boolean]
|
181
172
|
def request_refund(options = {})
|
182
|
-
|
183
|
-
@attributes = response['items']
|
173
|
+
@client.patch("items/#{send(:id)}/request_refund", options).body
|
184
174
|
true
|
185
175
|
end
|
186
176
|
|
187
|
-
#
|
177
|
+
# .
|
188
178
|
#
|
189
|
-
# @see
|
179
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidrefund
|
190
180
|
#
|
191
181
|
# @return [Boolean]
|
192
182
|
def refund(options = {})
|
193
|
-
|
194
|
-
@attributes = response['items']
|
183
|
+
@client.patch("items/#{send(:id)}/refund", options).body
|
195
184
|
true
|
196
185
|
end
|
197
186
|
|
198
|
-
#
|
187
|
+
# .
|
199
188
|
#
|
200
|
-
# @see
|
189
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsidcancel
|
201
190
|
#
|
202
191
|
# @return [Boolean]
|
203
192
|
def cancel
|
204
|
-
|
205
|
-
@attributes = response['items']
|
193
|
+
@client.patch("items/#{id}/cancel")
|
206
194
|
true
|
207
195
|
end
|
208
196
|
end
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class PaypalAccount < Account
|
4
4
|
# Get the user the paypal account belongs to.
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsidusers
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -14,7 +14,7 @@ module Promisepay
|
|
14
14
|
# Deletes a Paypal account for a user on a marketplace.
|
15
15
|
# Sets the account to in-active.
|
16
16
|
#
|
17
|
-
# @see
|
17
|
+
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid
|
18
18
|
#
|
19
19
|
# @return [Boolean]
|
20
20
|
def deactivate
|
@@ -1,9 +1,9 @@
|
|
1
1
|
module Promisepay
|
2
2
|
# Manage Transactions
|
3
3
|
class Transaction < Account
|
4
|
-
#
|
4
|
+
# .
|
5
5
|
#
|
6
|
-
# @see https://
|
6
|
+
# @see https://test.api.promisepay.com/transactions/:id/users
|
7
7
|
#
|
8
8
|
# @return [Promisepay::User]
|
9
9
|
def user
|
@@ -13,7 +13,7 @@ module Promisepay
|
|
13
13
|
|
14
14
|
# Gets a transactions fee details if applicable.
|
15
15
|
#
|
16
|
-
# @see
|
16
|
+
# @see http://docs.promisepay.com/v2.2/docs/transactionsidfees
|
17
17
|
#
|
18
18
|
# @return [Promisepay::Fee]
|
19
19
|
def fee
|
@@ -2,22 +2,9 @@
|
|
2
2
|
module Promisepay
|
3
3
|
# Manage Users
|
4
4
|
class User < BaseModel
|
5
|
-
# Update the attributes of an item.
|
6
|
-
#
|
7
|
-
# @see https://reference.promisepay.com/#update-item
|
8
|
-
#
|
9
|
-
# @param attributes [Hash] Item's attributes to be updated.
|
10
|
-
#
|
11
|
-
# @return [self]
|
12
|
-
def update(attributes)
|
13
|
-
response = JSON.parse(@client.patch("users/#{send(:id)}", attributes).body)
|
14
|
-
@attributes = response['users']
|
15
|
-
self
|
16
|
-
end
|
17
|
-
|
18
5
|
# Lists items for a user on a marketplace.
|
19
6
|
#
|
20
|
-
# @see
|
7
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersiditems
|
21
8
|
#
|
22
9
|
# @return [Array<Promisepay::Item>]
|
23
10
|
def items
|
@@ -28,7 +15,7 @@ module Promisepay
|
|
28
15
|
|
29
16
|
# Gets Bank account for a user on a marketplace.
|
30
17
|
#
|
31
|
-
# @see
|
18
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersidbank_accounts
|
32
19
|
#
|
33
20
|
# @return [Promisepay::BankAccount]
|
34
21
|
def bank_account
|
@@ -40,7 +27,7 @@ module Promisepay
|
|
40
27
|
|
41
28
|
# Gets Card account for a user on a marketplace.
|
42
29
|
#
|
43
|
-
# @see
|
30
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersidcard_accounts
|
44
31
|
#
|
45
32
|
# @return [Promisepay::CardAccount]
|
46
33
|
def card_account
|
@@ -52,7 +39,7 @@ module Promisepay
|
|
52
39
|
|
53
40
|
# Gets PayPal account for a user on a marketplace.
|
54
41
|
#
|
55
|
-
# @see
|
42
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersidpaypal_accounts
|
56
43
|
#
|
57
44
|
# @return [Promisepay::PaypalAccount]
|
58
45
|
def paypal_account
|
@@ -64,7 +51,7 @@ module Promisepay
|
|
64
51
|
|
65
52
|
# Set the disbursement account for a user.
|
66
53
|
#
|
67
|
-
# @see
|
54
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersiddisbursement_account
|
68
55
|
#
|
69
56
|
# @return [Boolean]
|
70
57
|
def disbursement_account(account_id)
|
@@ -75,7 +62,7 @@ module Promisepay
|
|
75
62
|
|
76
63
|
# Gets company for a user on a marketplace.
|
77
64
|
#
|
78
|
-
# @see
|
65
|
+
# @see
|
79
66
|
#
|
80
67
|
# @return [Promisepay::Company]
|
81
68
|
def company
|
@@ -84,16 +71,5 @@ module Promisepay
|
|
84
71
|
rescue Promisepay::NotFound
|
85
72
|
nil
|
86
73
|
end
|
87
|
-
|
88
|
-
# Gets user address.
|
89
|
-
#
|
90
|
-
# @see https://reference.promisepay.com/#addresses
|
91
|
-
#
|
92
|
-
# @return [Hash]
|
93
|
-
def address
|
94
|
-
return nil unless @attributes.key?('related')
|
95
|
-
response = JSON.parse(@client.get("addresses/#{send(:related)['addresses']}").body)
|
96
|
-
response['addresses']
|
97
|
-
end
|
98
74
|
end
|
99
75
|
end
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# Get bank account for a user on a marketplace.
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsid-1
|
11
11
|
#
|
12
12
|
# @param id [String] Bank Account ID.
|
13
13
|
#
|
@@ -19,7 +19,7 @@ module Promisepay
|
|
19
19
|
|
20
20
|
# Create a bank account for a user on a marketplace.
|
21
21
|
#
|
22
|
-
# @see
|
22
|
+
# @see http://docs.promisepay.com/v2.2/docs/bank_accountsid-2
|
23
23
|
#
|
24
24
|
# @param attributes [Hash] Bank Account's attributes.
|
25
25
|
#
|
@@ -28,19 +28,5 @@ module Promisepay
|
|
28
28
|
response = JSON.parse(@client.post('bank_accounts', attributes).body)
|
29
29
|
Promisepay::BankAccount.new(@client, response['bank_accounts'])
|
30
30
|
end
|
31
|
-
|
32
|
-
# Validate a US bank routing number before creating an account.
|
33
|
-
# This can be used to provide on-demand verification,
|
34
|
-
# and further information of the bank information a User is providing.
|
35
|
-
#
|
36
|
-
# @see https://reference.promisepay.com/#validate-routing-number
|
37
|
-
#
|
38
|
-
# @param routing_number [String] Bank account Routing Number
|
39
|
-
#
|
40
|
-
# @return [Hash]
|
41
|
-
def validate(routing_number)
|
42
|
-
response = @client.get('tools/routing_number', { routing_number: routing_number }, true)
|
43
|
-
(response.status == 200) ? JSON.parse(response.body)['routing_number'] : {}
|
44
|
-
end
|
45
31
|
end
|
46
32
|
end
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# Get card account for a user on a marketplace.
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/card_accountsid-1
|
11
11
|
#
|
12
12
|
# @param id [String] Bank Account ID.
|
13
13
|
#
|
@@ -19,7 +19,7 @@ module Promisepay
|
|
19
19
|
|
20
20
|
# Create a card account for a user on a marketplace.
|
21
21
|
#
|
22
|
-
# @see
|
22
|
+
# @see http://docs.promisepay.com/v2.2/docs/card_accountsid-2
|
23
23
|
#
|
24
24
|
# @param attributes [Hash] Bank Account's attributes.
|
25
25
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all companies for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/companies
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 users. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a company
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see
|
26
26
|
#
|
27
27
|
# @param id [String] Company id
|
28
28
|
#
|
@@ -34,7 +34,7 @@ module Promisepay
|
|
34
34
|
|
35
35
|
# Create a company for a user
|
36
36
|
#
|
37
|
-
# @see
|
37
|
+
# @see
|
38
38
|
#
|
39
39
|
# @param attributes [Hash] Company's attributes.
|
40
40
|
#
|
@@ -46,7 +46,7 @@ module Promisepay
|
|
46
46
|
|
47
47
|
# Update a company for a user
|
48
48
|
#
|
49
|
-
# @see
|
49
|
+
# @see
|
50
50
|
#
|
51
51
|
# @param attributes [Hash] Company's attributes.
|
52
52
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all fees for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/fees-1
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 fees. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single fee for a marketplace
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see http://docs.promisepay.com/v2.2/docs/feesid
|
26
26
|
#
|
27
27
|
# @param id [String] Marketplace Fee ID.
|
28
28
|
#
|
@@ -34,7 +34,7 @@ module Promisepay
|
|
34
34
|
|
35
35
|
# Create a fee for a marketplace
|
36
36
|
#
|
37
|
-
# @see
|
37
|
+
# @see http://docs.promisepay.com/v2.2/docs/fee_lists
|
38
38
|
#
|
39
39
|
# @param attributes [Hash] Item's attributes.
|
40
40
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all items for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/items
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 items. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single item for a marketplace
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see http://docs.promisepay.com/v2.2/docs/itemsid
|
26
26
|
#
|
27
27
|
# @param id [String] Marketplace item ID.
|
28
28
|
#
|
@@ -40,7 +40,7 @@ module Promisepay
|
|
40
40
|
|
41
41
|
# Create an item for a marketplace
|
42
42
|
#
|
43
|
-
# @see
|
43
|
+
# @see http://docs.promisepay.com/v2.2/docs/items-1
|
44
44
|
#
|
45
45
|
# @param attributes [Hash] Item's attributes.
|
46
46
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# Get paypal account for a user on a marketplace.
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid-1
|
11
11
|
#
|
12
12
|
# @param id [String] Paypal Account ID.
|
13
13
|
#
|
@@ -19,7 +19,7 @@ module Promisepay
|
|
19
19
|
|
20
20
|
# Create a Paypal account for a user on a marketplace.
|
21
21
|
#
|
22
|
-
# @see
|
22
|
+
# @see http://docs.promisepay.com/v2.2/docs/paypal_accountsid-2
|
23
23
|
#
|
24
24
|
# @param attributes [Hash] Paypal Account's attributes.
|
25
25
|
#
|
@@ -3,7 +3,7 @@ module Promisepay
|
|
3
3
|
class TokenResource < BaseResource
|
4
4
|
# Create a new token for an item
|
5
5
|
#
|
6
|
-
# @see
|
6
|
+
# @see http://docs.promisepay.com/v2.2/docs/request_session_token
|
7
7
|
#
|
8
8
|
# @param attributes [Hash] Token's attributes.
|
9
9
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all transactions for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/transactions
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 transactions. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single transaction for a marketplace
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see http://docs.promisepay.com/v2.2/docs/transactionsid
|
26
26
|
#
|
27
27
|
# @param id [String] transaction ID.
|
28
28
|
#
|
@@ -7,7 +7,7 @@ module Promisepay
|
|
7
7
|
|
8
8
|
# List all users for a marketplace
|
9
9
|
#
|
10
|
-
# @see
|
10
|
+
# @see http://docs.promisepay.com/v2.2/docs/users
|
11
11
|
#
|
12
12
|
# @param options [Hash] Optional options.
|
13
13
|
# @option options [Integer] :limit Can ask for up to 200 users. default: 10
|
@@ -22,7 +22,7 @@ module Promisepay
|
|
22
22
|
|
23
23
|
# Get a single user
|
24
24
|
#
|
25
|
-
# @see
|
25
|
+
# @see http://docs.promisepay.com/v2.2/docs/usersid
|
26
26
|
#
|
27
27
|
# @param id [String] Marketplace user ID.
|
28
28
|
#
|
@@ -34,7 +34,7 @@ module Promisepay
|
|
34
34
|
|
35
35
|
# Create a new user for a marketplace
|
36
36
|
#
|
37
|
-
# @see
|
37
|
+
# @see http://docs.promisepay.com/v2.2/docs/users-1
|
38
38
|
#
|
39
39
|
# @param attributes [Hash] User's attributes.
|
40
40
|
#
|
@@ -46,7 +46,7 @@ module Promisepay
|
|
46
46
|
|
47
47
|
# Update a user for a marketplace
|
48
48
|
#
|
49
|
-
# @see
|
49
|
+
# @see http://docs.promisepay.com/v2.2/docs/users-1
|
50
50
|
#
|
51
51
|
# @param attributes [Hash] User's attributes.
|
52
52
|
#
|
data/promisepay.gemspec
CHANGED
@@ -5,7 +5,7 @@ require 'promisepay/version'
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |spec|
|
7
7
|
spec.name = 'promisepay'
|
8
|
-
spec.version =
|
8
|
+
spec.version = Promisepay::VERSION
|
9
9
|
spec.authors = ['Romain Vigo Benia']
|
10
10
|
spec.email = ['romain.vigobenia@gmail.com']
|
11
11
|
spec.summary = 'Gem to wrap promisepay.com API.'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: promisepay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 1.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Romain Vigo Benia
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2015-11-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -124,8 +124,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
124
124
|
version: '0'
|
125
125
|
requirements: []
|
126
126
|
rubyforge_project:
|
127
|
-
rubygems_version: 2.
|
127
|
+
rubygems_version: 2.4.8
|
128
128
|
signing_key:
|
129
129
|
specification_version: 4
|
130
130
|
summary: Gem to wrap promisepay.com API.
|
131
131
|
test_files: []
|
132
|
+
has_rdoc:
|