synapse_fi 0.0.2 → 0.0.3

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: 821a70c421ba83209725d94831cb0f3d1799ab81
4
- data.tar.gz: 5e6fc8f9da88b6ce7a1cdd3213d75036674a5e23
3
+ metadata.gz: db4628f944245e8f114018422dd581ab76696dc1
4
+ data.tar.gz: 2012839aaa6f312aefe8c189d10decd073d35903
5
5
  SHA512:
6
- metadata.gz: 42bc8263f45bad0780d73c72013b1ba0297a457563babc59e43af1e885bb006a11a075fba1eb6bbc49827ba0ecd44d542e3dd1202b2323159cf81b32c85bc50c
7
- data.tar.gz: d33d9c397044d4811af17b2b8a512275b4791392ece8d3d3aed4f491841498a5eec195d372b34fef78781af6adbc7d7f5a0c52bb1d2f8c90603018bcae4bdfd7
6
+ metadata.gz: b29bb8ee533e012e3be5e7667f338223d192501a6ad54bf891fb55f4c1ee4d50d16f66e08fda977ab6c619a1721bc475f42e6e7797d2c184d5e90d891d7c7b99
7
+ data.tar.gz: 3a9474f1cae6af2b4c33a3968d0c59c210ac13305cb21408c5f12b691699d328ad22412c4a3042251276579927e5839498fb9a9a5175d506c3fa81f273a58210
data/Rakefile ADDED
@@ -0,0 +1,10 @@
1
+ require "bundler/gem_tasks"
2
+ require "rake/testtask"
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.libs << "test"
6
+ t.libs << "lib"
7
+ t.test_files = FileList['test/*_test.rb']
8
+ end
9
+
10
+ task :default => :test
@@ -38,7 +38,7 @@ module Synapse
38
38
  # @param raise_for_202 [Boolean]
39
39
  # @param logging [Boolean] (optional) logs to stdout when true
40
40
  # @param log_to [String] (optional) file path to log to file (logging must be true)
41
- def initialize(client_id:, client_secret:, ip_address:, fingerprint:nil,development_mode: true, raise_for_202:nil, **options)
41
+ def initialize(client_id:, client_secret:, ip_address:, fingerprint:nil,development_mode: true, raise_for_202:nil, **options)
42
42
  base_url = if development_mode
43
43
  'https://uat-api.synapsefi.com/v3.1'
44
44
  else
@@ -53,26 +53,23 @@ module Synapse
53
53
  ip_address: ip_address,
54
54
  raise_for_202: raise_for_202,
55
55
  **options)
56
-
57
56
  end
58
57
 
59
58
  # Queries Synapse API to create a new user
60
59
  # @param payload [Hash]
61
60
  # @param idempotency_key [String] (optional)
62
- # @return[Synapse::User]
61
+ # @return [Synapse::User]
63
62
  # @see https://docs.synapsepay.com/docs/create-a-user payload structure
64
63
  def create_user(payload:, **options)
65
- raise ArgumentError, 'client must be a Synapse::Client' unless self.is_a?(Client)
66
64
  response = client.post(user_path,payload, options)
67
65
 
68
-
69
66
  user = User.new(
70
- user_id: response['_id'],
71
- refresh_token: response['refresh_token'],
72
- client: client,
73
- full_dehydrate: "no",
74
- payload: response
75
- )
67
+ user_id: response['_id'],
68
+ refresh_token: response['refresh_token'],
69
+ client: client,
70
+ full_dehydrate: "no",
71
+ payload: response
72
+ )
76
73
  user
77
74
  end
78
75
 
@@ -189,7 +186,7 @@ module Synapse
189
186
 
190
187
  response = client.post(subscriptions_path , payload, options)
191
188
 
192
- subscriptions = Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
189
+ Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
193
190
  end
194
191
 
195
192
  # Queries Synapse API for all platform subscriptions
@@ -211,7 +208,7 @@ module Synapse
211
208
  def get_subscription(subscription_id:)
212
209
  path = subscriptions_path + "/#{subscription_id}"
213
210
  response = client.get(path)
214
- subscription = Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
211
+ Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
215
212
  end
216
213
 
217
214
  # updates subscription platform subscription
@@ -231,7 +228,7 @@ module Synapse
231
228
  payload["is_active"] = is_active if is_active
232
229
 
233
230
  response = client.patch(path, payload)
234
- subscriptions = Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
231
+ Subscription.new(subscription_id: response["_id"], url: response["url"], payload: response)
235
232
  end
236
233
 
237
234
 
@@ -190,7 +190,7 @@ module Synapse
190
190
  end
191
191
 
192
192
  def oauth_path(user_id)
193
- path = "/oauth/#{user_id}"
193
+ "/oauth/#{user_id}"
194
194
  end
195
195
 
196
196
  def full_url(path)
@@ -2,7 +2,7 @@ module Synapse
2
2
 
3
3
  class Nodes
4
4
 
5
- attr_reader :page, :page_count, :limit, :payload, :nodes_count, :nodes_count
5
+ attr_reader :page, :page_count, :limit, :payload, :nodes_count
6
6
 
7
7
  attr_accessor
8
8
 
@@ -110,18 +110,13 @@ module Synapse
110
110
  end
111
111
 
112
112
  # Queries Synapse get user API for users refresh_token
113
- # @param full_dehydrate [Boolean]
114
113
  # @see https://docs.synapsefi.com/docs/get-user
115
114
  # @return refresh_token [String]
116
- def refresh_token(**options)
117
- options[:full_dehydrate] = "yes" if options[:full_dehydrate] == true
118
- options[:full_dehydrate] = "no" if options[:full_dehydrate] == false
119
-
120
- path = get_user_path(user_id: self.user_id, full_dehydrate: options[:full_dehydrate])
121
- response = client.get(path)
122
- refresh_token = response["refresh_token"]
123
- refresh_token
124
- end
115
+ # def refresh_token()
116
+ # path = get_user_path(user_id: self.user_id)
117
+ # response = client.get(path)
118
+ # response["refresh_token"]
119
+ # end
125
120
 
126
121
  # Quaries Synapse oauth API for uto authenitcate user
127
122
  # @params scope [Array<Strings>] (optional)
@@ -129,7 +124,7 @@ module Synapse
129
124
  # @see https://docs.synapsefi.com/docs/get-oauth_key-refresh-token
130
125
  def authenticate(**options)
131
126
  payload = {
132
- "refresh_token" => self.refresh_token()
127
+ "refresh_token" => self.refresh_token
133
128
  }
134
129
  payload["scope"] = options[:scope] if options[:scope]
135
130
 
@@ -323,7 +318,7 @@ module Synapse
323
318
  self.authenticate()
324
319
  response = client.patch(path,payload)
325
320
  end
326
- node = Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
321
+ Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
327
322
  end
328
323
 
329
324
  # Resets debit card number, cvv, and expiration date
@@ -339,7 +334,7 @@ module Synapse
339
334
  self.authenticate()
340
335
  response = client.patch(path,payload)
341
336
  end
342
- node = Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
337
+ Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
343
338
  end
344
339
 
345
340
  # Creates a new transaction in the API belonging to the provided node
@@ -421,7 +416,7 @@ module Synapse
421
416
  self.authenticate()
422
417
  response = client.patch(path, payload)
423
418
  end
424
- node = Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
419
+ Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
425
420
  end
426
421
 
427
422
  # Reinitiate microdeposits on a node
@@ -435,7 +430,7 @@ module Synapse
435
430
  self.authenticate()
436
431
  response = client.patch(path, payload)
437
432
  end
438
- node = Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
433
+ Node.new(user_id: self.user_id, node_id:response["_id"], full_dehydrate: false, payload: response, type: response["type"])
439
434
  end
440
435
 
441
436
  # Generate tokenized info for Apple Wallet
@@ -666,7 +661,7 @@ module Synapse
666
661
  private
667
662
 
668
663
  def oauth_path()
669
- path = "/oauth/#{self.user_id}"
664
+ "/oauth/#{self.user_id}"
670
665
  end
671
666
 
672
667
  def get_user_path(user_id:, **options)
@@ -1,6 +1,6 @@
1
1
  module Synapse
2
2
  # Gem version
3
- VERSION = '0.0.2'.freeze
3
+ VERSION = '0.0.3'.freeze
4
4
  end
5
5
 
6
6
 
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapse_fi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emmanuel Mawutor
@@ -106,6 +106,7 @@ files:
106
106
  - Gemfile
107
107
  - Gemfile.lock
108
108
  - README.md
109
+ - Rakefile
109
110
  - lib/synapse_api/.DS_Store
110
111
  - lib/synapse_api/client.rb
111
112
  - lib/synapse_api/error.rb
@@ -132,7 +133,7 @@ files:
132
133
  - node_modules/dotenv/package.json
133
134
  - package.json
134
135
  - samples.md
135
- - synapse_fi-0.0.1.gem
136
+ - synapse_fi-0.0.2.gem
136
137
  - synapse_fi.gemspec
137
138
  - yarn.lock
138
139
  homepage: https://rubygems.org/gems/synapse_fi
data/synapse_fi-0.0.1.gem DELETED
Binary file