synapseruby 1.0.0 → 1.0.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ebc99ee79db2dbcb7e91d2cab9e902593a9ab15e
4
- data.tar.gz: 8a71c65ff8748d4c83e452f7b6bc09d7e90b625f
3
+ metadata.gz: 8fced61e8e7be25063e9d004d2a68c4386fde180
4
+ data.tar.gz: dde3dcaf54d19c58ff3985bcdd64085eaec8307c
5
5
  SHA512:
6
- metadata.gz: 79bce83ab437fb49be69d94d311debed6ae6cd8c930c1e935069a3db8130ef79094c8eb42c16a836b5c49daecaf9a687c62867ea08f9c5f07bdfdc89a517f776
7
- data.tar.gz: 87b7cc6334d114f46dfd4b334f3864c466ae1ca2376de9049335ac271302f8d091ac39bfd23ccd8e2d3866f64c4af519a0bb65a26c77f738f1253fcbab713498
6
+ metadata.gz: 3c57e9a256a2f3f941c8215647920884b753e4b62a890ca9a6a17a0dd739ade22ae96c6fd9b99c106328656533a4e1c8b881d554f8db68a901911c1dcc83910c
7
+ data.tar.gz: d0455e20b7e385fb7af609d10c3468c9fd3cd71daddb009c4c944488ba32a511368c23529d6557504bb573c0479cbdda43f92503e23d0245def5dcf51865f983
data/README.md CHANGED
@@ -26,7 +26,7 @@ $ gem install synapseruby
26
26
  ## Documentation
27
27
 
28
28
  - [API docs](http://docs.synapsefi.com/v3.1)
29
- - [synapse_fi gem docs](https://www.rubydoc.info/gems/synapse_fi)
29
+ - [synapseruby gem docs](https://rubygems.org/gems/synapseruby)
30
30
  - [Samples demonstrating common operations](samples.md)
31
31
 
32
32
  ## Contributing
@@ -2,7 +2,7 @@ module Synapse
2
2
 
3
3
  class Subnet
4
4
 
5
- attr_accessor :subnet_id, :payload
5
+ attr_accessor :subnet_id, :payload, :node_id
6
6
 
7
7
  def initialize(subnet_id:, payload:, node_id:)
8
8
  @subnet_id = subnet_id
@@ -11,3 +11,5 @@ module Synapse
11
11
  end
12
12
  end
13
13
  end
14
+
15
+
@@ -323,12 +323,15 @@ module Synapse
323
323
  statements
324
324
  end
325
325
 
326
- # Request to ship a user card
326
+ # Request to ship CARD-US
327
+ # @note Deprecated
327
328
  # @param node_id [String]
328
329
  # @param payload [Hash]
329
330
  # @return [Synapse::Node] or [Hash]
330
- def ship_card(node_id:, payload:)
331
+ def ship_card_node(node_id:, payload:)
332
+
331
333
  path = node(user_id: self.user_id, node_id: node_id) + "?ship=YES"
334
+
332
335
  begin
333
336
  response = client.patch(path,payload)
334
337
  rescue Synapse::Error::Unauthorized
@@ -342,11 +345,31 @@ module Synapse
342
345
  type: response["type"])
343
346
  end
344
347
 
348
+ # Request to ship user debit card [Subnet]
349
+ # @param node_id [String]
350
+ # @param payload [Hash]
351
+ # @param subnet_id [String]
352
+ # @return [Synapse::Node] or [Hash]
353
+ def ship_card(node_id:, payload:, subnet_id:)
354
+
355
+ path = node(user_id: self.user_id, node_id: node_id) + "/subnets/#{subnet_id}/ship"
356
+
357
+ begin
358
+ response = client.patch(path,payload)
359
+ rescue Synapse::Error::Unauthorized
360
+ self.authenticate()
361
+ response = client.patch(path,payload)
362
+ end
363
+ Subnet.new(subnet_id: response["subnet_id"], payload: response, node_id: response["node_id"])
364
+
365
+ end
366
+
345
367
  # Resets debit card number, cvv, and expiration date
368
+ # @note Deprecated
346
369
  # @see https://docs.synapsefi.com/docs/reset-debit-card
347
370
  # @param node_id [String]
348
371
  # @return [Synapse::Node] or [Hash]
349
- def reset_debit_card(node_id:)
372
+ def reset_card_node(node_id:)
350
373
  path = node(user_id: self.user_id, node_id: node_id) + "?reset=YES"
351
374
  payload = {}
352
375
  begin
@@ -602,7 +625,7 @@ module Synapse
602
625
  dispute
603
626
  end
604
627
 
605
- # Creates subnet for a node
628
+ # Creates subnet for a node debit card or act/rt number
606
629
  # @param node_id [String]
607
630
  # @param payload [Hash]
608
631
  # @param idempotency_key [String] (optional)
@@ -620,6 +643,24 @@ module Synapse
620
643
  Subnet.new(subnet_id: subnet['_id'], payload: subnet, node_id: node_id)
621
644
  end
622
645
 
646
+ # Updates subnet debit card and act/rt number
647
+ # @param node_id [String]
648
+ # @param payload [Hash]
649
+ # @param subnet_id [String]
650
+ # @return [Synapse::Subnet]
651
+ def update_subnet(node_id:, payload:, subnet_id:, **options)
652
+ path = subnet_path(user_id: self.user_id, node_id: node_id, subnet_id: subnet_id)
653
+
654
+ begin
655
+ subnet = client.patch(path,payload)
656
+ rescue Synapse::Error::Unauthorized
657
+ self.authenticate()
658
+ subnet = client.patch(path,payload)
659
+ end
660
+ Subnet.new(subnet_id: subnet['_id'], payload: subnet, node_id: node_id)
661
+ end
662
+
663
+
623
664
  # Gets all node subnets
624
665
  # @param node_id [String]
625
666
  # @param page [Integer]
@@ -757,8 +798,12 @@ module Synapse
757
798
  path
758
799
  end
759
800
 
760
- def subnet_path(user_id:, node_id:)
761
- path = "/users/#{user_id}/nodes/#{node_id}/subnets"
801
+ def subnet_path(user_id:, node_id:, subnet_id: nil)
802
+ if subnet_id
803
+ path = "/users/#{user_id}/nodes/#{node_id}/subnets/#{subnet_id}"
804
+ else
805
+ path = "/users/#{user_id}/nodes/#{node_id}/subnets"
806
+ end
762
807
  path
763
808
  end
764
809
  end
@@ -5,7 +5,7 @@
5
5
  # rake release
6
6
  module Synapse
7
7
  # Gem version
8
- VERSION = '1.0.0'.freeze
8
+ VERSION = '1.0.2'.freeze
9
9
  end
10
10
 
11
11
 
Binary file
Binary file
data/samples.md CHANGED
@@ -32,6 +32,7 @@
32
32
  + [Subnets](#subnets)
33
33
  * [Create Subnet](#create-subnet)
34
34
  * [Get Subnet](#get-subnet)
35
+ * [Update Subnet](#update-subnet)
35
36
  + [Transactions](#transactions)
36
37
  * [Create Transaction](#create-transaction)
37
38
  * [Get Transaction](#get-transaction)
@@ -328,14 +329,14 @@ body = {
328
329
  "fee_node_id":"5ba05e7920b3aa006482c5ad",
329
330
  "expedite":True
330
331
  }
331
- node = user.ship_card(node_id: node_id, payload: body)
332
+ node = user.ship_card_node(node_id: node_id, payload: body)
332
333
  ```
333
334
 
334
335
  #### Reset Debit Cards
335
336
 
336
337
  ```bash
337
338
  node_id = '5ba05ed620b3aa005882c52a'
338
- node = user.reset_debit_card(node_id: node_id)
339
+ node = user.reset_card_node(node_id: node_id)
339
340
  ```
340
341
 
341
342
  #### Verify Micro Deposit
@@ -403,10 +404,24 @@ user.create_subnet(node_id: node_id, payload: body)
403
404
  #### Get Subnet
404
405
  ```bash
405
406
  node_id = '594e606212e17a002f2e3251'
406
- subn_id = '59c9f77cd412960028b99d2b'
407
+ subnet_id = '59c9f77cd412960028b99d2b'
407
408
  subnet = user.get_subnet(node_id:, subnet_id:)
408
409
  ```
409
410
 
411
+ #### Update Subnet
412
+ ```bash
413
+ node_id = '594e606212e17a002f2e3251'
414
+ subnet_id = '59c9f77cd412960028b99d2b'
415
+ body = {
416
+ "preferences": {
417
+ "allow_foreign_transactions":true,
418
+ "daily_atm_withdrawal_limit":100,
419
+ "daily_transaction_limit":900
420
+ }
421
+ }
422
+ subnet = user.update_subnet(node_id: node_id, payload: body, subnet_id: subnet_id)
423
+ ```
424
+
410
425
  ### Transactions
411
426
 
412
427
  #### Create Transaction
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapseruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Mawutor
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-21 00:00:00.000000000 Z
11
+ date: 2019-01-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -122,9 +122,7 @@ files:
122
122
  - lib/synapse_api/users.rb
123
123
  - lib/synapse_api/version.rb
124
124
  - lib/synapse_fi.rb
125
- - pkg/synapse_fi-0.0.3.gem
126
- - pkg/synapse_fi-0.0.4.gem
127
- - pkg/synapse_fi-1.0.0.gem
125
+ - pkg/synapseruby-1.0.0.gem
128
126
  - pkg/synapseruby-1.0.1.gem
129
127
  - samples.md
130
128
  - synapse_fi.gemspec
Binary file
Binary file
Binary file