synapse_client 0.0.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +16 -5
- data/lib/synapse_client/api_resource.rb +5 -0
- data/lib/synapse_client/customer.rb +5 -2
- data/lib/synapse_client/version.rb +1 -1
- data/lib/synapse_client.rb +7 -4
- data/spec/spec_helper.rb +0 -1
- data/spec/synapse_client_bank_account_spec.rb +1 -0
- data/spec/synapse_client_customer_spec.rb +6 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c7a33c25316f01091839470f1539e0f81bda0010
|
4
|
+
data.tar.gz: 537f9cf4da451dd4a73fb5058aeb586197acde13
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a0065a10870245fbb2ecf035f8727c700f91b27f98f9bef7e77276ba253a82acae374d5bd37d174dffc863d5d203beda35e610c6fa43e859501f3c7fd023b7ed
|
7
|
+
data.tar.gz: 66b600e2af43be9b0f9f29affd252dd26607ee56a4e48aeaa3d27d21ad515d0949234c1aca87e4035d426472af6a821bc50a933566ded2f11fc5c734f87eebf0
|
data/README.md
CHANGED
@@ -14,6 +14,19 @@ I ripped originally wrote this in a rails app of mine and stripped this out. The
|
|
14
14
|
* all orders are bank pay orders
|
15
15
|
* customers do not have passwords
|
16
16
|
|
17
|
+
## Installation
|
18
|
+
|
19
|
+
Include the following in your `Gemfile`
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
gem "syanpse_client"
|
23
|
+
```
|
24
|
+
|
25
|
+
and then run `bundle install`.
|
26
|
+
|
27
|
+
You can also simply run `gem install synapse_client`.
|
28
|
+
|
29
|
+
|
17
30
|
## Usage
|
18
31
|
|
19
32
|
_See the specs for the most up to date usage demo._
|
@@ -96,16 +109,14 @@ _See the specs for the most up to date usage demo._
|
|
96
109
|
|
97
110
|
## TODO (in order of priority)
|
98
111
|
|
99
|
-
*
|
112
|
+
* Better synapse error handling
|
113
|
+
* HTTP Error handling
|
114
|
+
* Logging
|
100
115
|
* MassPay
|
101
|
-
* View bank account
|
102
116
|
* Refresh access tokens
|
103
117
|
* Security Questions
|
104
118
|
* Deposits
|
105
119
|
* Withdrawals
|
106
|
-
* Better synapse error handling
|
107
|
-
* HTTP Error handling
|
108
|
-
* Logging
|
109
120
|
* Callbacks?
|
110
121
|
|
111
122
|
|
@@ -37,11 +37,14 @@ module SynapseClient
|
|
37
37
|
update_attributes(response.data)
|
38
38
|
end
|
39
39
|
|
40
|
-
def self.retrieve(access_token)
|
40
|
+
def self.retrieve(access_token, refresh_token)
|
41
41
|
response = SynapseClient.request(:post, url + "show", {:access_token => access_token})
|
42
42
|
|
43
43
|
return response unless response.successful?
|
44
|
-
Customer.new(response.data.user
|
44
|
+
Customer.new(response.data.user.merge({
|
45
|
+
:access_token => access_token,
|
46
|
+
:refresh_token => refresh_token
|
47
|
+
}))
|
45
48
|
end
|
46
49
|
|
47
50
|
# TODO
|
data/lib/synapse_client.rb
CHANGED
@@ -110,10 +110,13 @@ module SynapseClient
|
|
110
110
|
end
|
111
111
|
|
112
112
|
def self.execute_request(opts)
|
113
|
-
|
114
|
-
puts "
|
115
|
-
puts opts
|
116
|
-
puts
|
113
|
+
if dev?
|
114
|
+
puts "\n"
|
115
|
+
puts "SynapseClient: About to send a request with the following opts:"
|
116
|
+
puts opts
|
117
|
+
puts "\n"
|
118
|
+
end
|
119
|
+
|
117
120
|
RestClient::Request.execute(opts)
|
118
121
|
end
|
119
122
|
|
data/spec/spec_helper.rb
CHANGED
@@ -24,6 +24,7 @@ describe SynapseClient::BankAccount do
|
|
24
24
|
expect(bank_account.id).to be_a Fixnum
|
25
25
|
expect(bank_account.account_number_string).to be_a String
|
26
26
|
expect(bank_account.routing_number_string).to be_a String
|
27
|
+
#expect(bank_account.bank_name).to be_a String
|
27
28
|
expect(bank_account.nickname).to be_a String
|
28
29
|
expect(bank_account.account_type).to be_a Fixnum
|
29
30
|
expect(bank_account.account_class).to be_a Fixnum
|
@@ -12,6 +12,8 @@ describe SynapseClient::Customer do
|
|
12
12
|
it "should successfully return a customer object with tokens and other info." do
|
13
13
|
expect(@customer).to be_a SynapseClient::Customer
|
14
14
|
|
15
|
+
expect(@customer.successful?).to be true
|
16
|
+
|
15
17
|
expect(@customer.email).to be @dummy_customer_data.email
|
16
18
|
expect(@customer.fullname).to be @dummy_customer_data.fullname
|
17
19
|
expect(@customer.phonenumber).to be @dummy_customer_data.phonenumber
|
@@ -26,7 +28,7 @@ describe SynapseClient::Customer do
|
|
26
28
|
|
27
29
|
describe "retrieving a customer" do
|
28
30
|
it "should successfully return a customer object with tokens and other info." do
|
29
|
-
customer = SynapseClient::Customer.retrieve(@customer.access_token)
|
31
|
+
customer = SynapseClient::Customer.retrieve(@customer.access_token, @customer.refresh_token)
|
30
32
|
|
31
33
|
expect(customer).to be_a SynapseClient::Customer
|
32
34
|
|
@@ -35,6 +37,9 @@ describe SynapseClient::Customer do
|
|
35
37
|
expect(customer.fullname).to eq @dummy_customer_data.fullname
|
36
38
|
expect(customer.phonenumber).to eq @dummy_customer_data.phonenumber
|
37
39
|
expect(customer.username).to be_a String
|
40
|
+
|
41
|
+
expect(customer.access_token).to be_a String
|
42
|
+
expect(customer.refresh_token).to be_a String
|
38
43
|
end
|
39
44
|
end
|
40
45
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: synapse_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0
|
4
|
+
version: 0.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Miles Matthias
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-03
|
11
|
+
date: 2015-04-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|