synapse_payments 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f056be5a4f4b09c243e373a500aa15199a6eefa0
4
- data.tar.gz: 1ca4202e275da10c05da2ad068feebf4d984f7e9
3
+ metadata.gz: d3063935e6a3a263d5137742df72182f4a4fe520
4
+ data.tar.gz: 603c211058685736a15dd5914fa37de9f2fdcfb2
5
5
  SHA512:
6
- metadata.gz: ab55f956628c5d28803961a0935db9c001a9e5cdfa771dc05709a9cef149d94b8716f72cd7d56db50800f0a57c6e95afeda12cadeea4ee7d191dfe3017b06847
7
- data.tar.gz: 8fc0cfee5403d987b653ab555383ba8bc0be366f79efc8aa57d1e1ab7e68f13bd57a589121656e44f745b4feeb23ff0c7cf1446739125b65a813762c382f4cfc
6
+ metadata.gz: fbf12a1cbf5f03f7dd00a123aa5db8dce3395ec8be3ec84c9dda19855d061e53a476dadf4cfb00d131abd8114d5783d7f33d8331b8250d543a47b4dc1bba101d
7
+ data.tar.gz: ca4cb8c53f121dc8cfa33c08995a9254709f5f904b6a9418e6d0dcf10a4c0af911e8fe76eb5997dbba6a6087ca2ef76b971ddae9f82be65fd329c7deb003b7d9
data/README.md CHANGED
@@ -44,12 +44,10 @@ Check out [samples.md](samples.md) to review how to use this library.
44
44
 
45
45
  ### TODO
46
46
 
47
- * add pagination/querying to `users.all`, `nodes.all`, and `transactions.all`
48
- * add support for new `subscriptions` resource
49
- * add new methods to UserClient: `link_bank_account`, `verify_mfa`, `add_escrow_account`, etc.
50
- * add `Banks` object with `list` method which returns supported banks from https://synapsepay.com/api/v3/institutions/show
47
+ * add pagination/querying to method `all` for users, nodes, transactions, and subscriptions
51
48
  * consider creating a `Response` object wrapper
52
49
  * clean up object/folder structure
50
+ * reorganize integration tests
53
51
 
54
52
  ### Tests
55
53
 
@@ -6,8 +6,8 @@ module SynapsePayments
6
6
  API_TEST = 'https://sandbox.synapsepay.com/api/3'
7
7
  API_LIVE = 'https://synapsepay.com/api/3'
8
8
 
9
- attr_accessor :client_id, :client_secret, :sandbox_mode
10
- attr_reader :api_base, :users
9
+ attr_accessor :client_id, :client_secret, :sandbox_mode, :timeout_options
10
+ attr_reader :api_base, :users, :subscriptions
11
11
 
12
12
  # Initializes a new Client object
13
13
  #
@@ -22,9 +22,11 @@ module SynapsePayments
22
22
 
23
23
  yield(self) if block_given?
24
24
 
25
+ @timeout_options ||= { write: 2, connect: 5, read: 10 }
25
26
  @api_base = @sandbox_mode ? API_TEST : API_LIVE
26
27
 
27
28
  @users = Users.new(self)
29
+ @subscriptions = Subscriptions.new(self)
28
30
  end
29
31
 
30
32
  # @return [Hash]
@@ -32,7 +32,7 @@ module SynapsePayments
32
32
  'X-SP-USER' => "#{@oauth_key}|#{@fingerprint}",
33
33
  'X-SP-USER-IP' => ''
34
34
  })
35
- HTTP.headers(headers).timeout(write: 2, connect: 5, read: 10)
35
+ HTTP.headers(headers).timeout(@client.timeout_options)
36
36
  end
37
37
 
38
38
  def fail_or_return_response_body(code, body)
@@ -0,0 +1,31 @@
1
+ module SynapsePayments
2
+ class Subscriptions
3
+
4
+ def initialize(client)
5
+ @client = client
6
+ end
7
+
8
+ def all
9
+ @client.get(path: '/subscriptions')
10
+ end
11
+
12
+ def create(url:, scope:)
13
+ data = {
14
+ url: url,
15
+ scope: scope
16
+ }
17
+
18
+ @client.post(path: "/subscriptions", json: data)
19
+ end
20
+
21
+ def find(id)
22
+ @client.get(path: "/subscriptions/#{id}")
23
+ end
24
+
25
+ def update(id, data)
26
+ @client.patch(path: "/subscriptions/#{id}", json: data)
27
+ end
28
+
29
+ end
30
+
31
+ end
@@ -1,3 +1,3 @@
1
1
  module SynapsePayments
2
- VERSION = "0.5.0"
2
+ VERSION = "0.6.0"
3
3
  end
@@ -13,3 +13,4 @@ require "synapse_payments/users"
13
13
  require "synapse_payments/nodes"
14
14
  require "synapse_payments/node"
15
15
  require "synapse_payments/transactions"
16
+ require "synapse_payments/subscriptions"
data/samples.md CHANGED
@@ -197,6 +197,17 @@ user_client.nodes(node_id).transactions.find(id)
197
197
  user_client.nodes(node_id).transactions.update(id, data)
198
198
  ```
199
199
 
200
+ #### Subscriptions
201
+
202
+ Note: This is a feature only available for the Advanced or Premium plans.
203
+
204
+ ```ruby
205
+ client.subscriptions.all
206
+ client.subscriptions.create(url: 'http://site.com/callback', scope: ['USERS|PATCH'])
207
+ client.subscriptions.find(id)
208
+ client.subscriptions.update(id, url: 'http://site.com/new_callback', is_active: false)
209
+ ```
210
+
200
211
  #### Error Handling
201
212
 
202
213
  TODO: add detail
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapse_payments
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Javier Julio
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2016-01-06 00:00:00.000000000 Z
11
+ date: 2016-01-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -160,6 +160,7 @@ files:
160
160
  - lib/synapse_payments/node.rb
161
161
  - lib/synapse_payments/nodes.rb
162
162
  - lib/synapse_payments/request.rb
163
+ - lib/synapse_payments/subscriptions.rb
163
164
  - lib/synapse_payments/transactions.rb
164
165
  - lib/synapse_payments/user_client.rb
165
166
  - lib/synapse_payments/users.rb