synapse_client 0.1.4 → 0.2.0
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 +4 -4
 - data/lib/synapse_client.rb +11 -2
 - data/lib/synapse_client/version.rb +1 -1
 - data/spec/spec_helper.rb +10 -0
 - data/spec/synapse_client_bank_account_spec.rb +10 -0
 - data/spec/synapse_client_mass_pay_spec.rb +3 -0
 - data/spec/synapse_client_spec.rb +3 -0
 - 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: f21bcf5c27d77bbce0de8ff90c6f38d2008783e9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 45c9c5e8cd71e78a6450f72054b7730b7376d091
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: b0f42c93db567a78057de43beecf4540bb594fcac7eebc0ad74fd70ac405eafb655488f9cbe2541accef5379fa38825fbd0c567b99a059c07dc7d5690081cfe0
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: f6158b02ca4d75d3b9a41ae0cd0221d3ac840e6b865ee190667787a5fb4e365fc1f80f55030862eef13180743518c720f2d067ec8ce6261e6753df028c03fce1
         
     | 
    
        data/lib/synapse_client.rb
    CHANGED
    
    | 
         @@ -95,12 +95,21 @@ module SynapseClient 
     | 
|
| 
       95 
95 
     | 
    
         | 
| 
       96 
96 
     | 
    
         
             
                #
         
     | 
| 
       97 
97 
     | 
    
         
             
                  begin
         
     | 
| 
      
 98 
     | 
    
         
            +
             
     | 
| 
       98 
99 
     | 
    
         
             
                    response = execute_request(request_opts)
         
     | 
| 
       99 
     | 
    
         
            -
             
     | 
| 
      
 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 
     | 
    
         | 
    
        data/spec/spec_helper.rb
    CHANGED
    
    | 
         @@ -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 
     | 
    
         | 
    
        data/spec/synapse_client_spec.rb
    CHANGED
    
    | 
         @@ -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. 
     | 
| 
      
 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- 
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2015-05-26 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: rest-client
         
     |