synapse_client 0.1.4 → 0.2.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: 1383017e5b19893e1e5a72491da9ca52acfb5160
4
- data.tar.gz: 1a7fd28f77a7f4a030907c890c0c0a90300367b7
3
+ metadata.gz: f21bcf5c27d77bbce0de8ff90c6f38d2008783e9
4
+ data.tar.gz: 45c9c5e8cd71e78a6450f72054b7730b7376d091
5
5
  SHA512:
6
- metadata.gz: 5afe0053efeaf1ba4b0b55859afb5283b7dd4bc18470ea93ce7dae8a5d18b8743fff0d505f637bea7c1b72f987b62239affa3feaf7222453a57a9a484f58732d
7
- data.tar.gz: bf5d82448ff3e4129de3f7fa29494af779cdf89c96ec07aa90211a6ad0d6f474766f8a9471358866537e9b6c2182b72369fe3aaadb47ebd20bc027aa1c356cd6
6
+ metadata.gz: b0f42c93db567a78057de43beecf4540bb594fcac7eebc0ad74fd70ac405eafb655488f9cbe2541accef5379fa38825fbd0c567b99a059c07dc7d5690081cfe0
7
+ data.tar.gz: f6158b02ca4d75d3b9a41ae0cd0221d3ac840e6b865ee190667787a5fb4e365fc1f80f55030862eef13180743518c720f2d067ec8ce6261e6753df028c03fce1
@@ -95,12 +95,21 @@ module SynapseClient
95
95
 
96
96
  #
97
97
  begin
98
+
98
99
  response = execute_request(request_opts)
99
- # TODO: https://github.com/stripe/stripe-ruby/blob/master/lib/stripe.rb#L127
100
+
100
101
  rescue RestClient::Exception, Errno::ECONNREFUSED => e
102
+
103
+ begin
104
+ reason = JSON.parse(e.http_body)["reason"]
105
+ rescue => p
106
+ reason = e.http_body
107
+ end
108
+
101
109
  return SynapseClient::APIOperations::Response.new({
102
110
  :success => false,
103
- :status_code => e.http_code
111
+ :status_code => e.http_code,
112
+ :reason => reason
104
113
  })
105
114
  end
106
115
 
@@ -1,3 +1,3 @@
1
1
  module SynapseClient
2
- VERSION = "0.1.4"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -70,6 +70,16 @@ require 'synapse_client'
70
70
  })
71
71
  end
72
72
 
73
+ def dummy_wrong_add_bank_account_info
74
+ Map.new({
75
+ :account_num => "1",
76
+ :routing_num => "8",
77
+ :nickname => "Example bank account",
78
+ :account_type => "1",
79
+ :account_class => "1"
80
+ })
81
+ end
82
+
73
83
  def get_dummy_bank
74
84
  SynapseClient::Customer.create(dummy_customer_data)
75
85
  end
@@ -29,6 +29,16 @@ describe SynapseClient::BankAccount do
29
29
  expect(bank_account.account_type).to be_a Fixnum
30
30
  expect(bank_account.account_class).to be_a Fixnum
31
31
  end
32
+
33
+ it "should return an error message with failed bank add attemp." do
34
+ bank_account = @customer.add_bank_account(dummy_wrong_add_bank_account_info)
35
+
36
+ expect(bank_account).to be_a SynapseClient::APIOperations::Response
37
+
38
+ expect(bank_account.successful?).to be false
39
+ expect(bank_account.error_msg).not_to be nil
40
+ expect(bank_account.error_msg).to be_a String
41
+ end
32
42
  end
33
43
 
34
44
  describe "linking a bank account" do
@@ -10,6 +10,8 @@ describe SynapseClient::MassPay do
10
10
  @bank_account_b = @customer_b.add_bank_account(dummy_add_bank_account_info)
11
11
  end
12
12
 
13
+ =begin
14
+ # TODO
13
15
  describe "adding a bunch of deposits to users" do
14
16
  it "should successfully return multiple mass pays" do
15
17
 
@@ -50,6 +52,7 @@ describe SynapseClient::MassPay do
50
52
 
51
53
  end
52
54
  end
55
+ =end
53
56
 
54
57
  end
55
58
 
@@ -55,6 +55,8 @@ describe SynapseClient do
55
55
  expect { SynapseClient.request("get", "users") }.to raise_error
56
56
  end
57
57
 
58
+ =begin
59
+ # THIS METHOD ISN'T SUPPORTED IN SANDBOX
58
60
  it "should be able to do a basic get of bank statuses" do
59
61
  response = SynapseClient.request("get", "/api/v2/bankstatus/show/")
60
62
 
@@ -64,6 +66,7 @@ describe SynapseClient do
64
66
  expect(response.data.banks).to be_an(Array)
65
67
  expect(response.data.banks.count).to be > 0
66
68
  end
69
+ =end
67
70
  end
68
71
 
69
72
  end
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.1.4
4
+ version: 0.2.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-05-12 00:00:00.000000000 Z
11
+ date: 2015-05-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client