synapse_pay_rest 3.0.2 → 3.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: bce9c987198a7fbc657e67883ac7defc68ac7d1a
4
- data.tar.gz: 4c8ea07440540fce29b0284f36c149a1a22a7061
3
+ metadata.gz: 52d88f66ed3fc929b1081efa3f3b35348eb81f36
4
+ data.tar.gz: bb931667e46fa8300333563726404b15e52354e1
5
5
  SHA512:
6
- metadata.gz: f52f7a015569ae9f40feec7e8b759bc238af1ed8af71547aa0a4a422d34db3e211acd30514027eaa0c297a49aa33fc98d3a47d3d2dff56317b1ed2f7ed42da36
7
- data.tar.gz: 96293659d4ee4e63d6b643411a801db3a8829a1de643c67a84cce11b72155ea8e6441d807b113c7725c9b9a430b33157c71dc6f4d4ecda11b9bbbf202bfdb459
6
+ metadata.gz: 5c1a641071ef97a98cf3b80c89524d6d1816c1df383839e70978e8b898a8432012586e95d732dc7c0a844194d1188f25d834c87b2a2589bcb1bd79fe5c53d392
7
+ data.tar.gz: 8b96fe4410a7182625f3afef21e51f1b62a15e17a636b1ee566347e5757d170160025f9e5285387679f1fb4134c632ab5a0147f3f383a6c09acd18932ff7dc04
data/Rakefile CHANGED
@@ -1,10 +1,11 @@
1
- require "bundler/gem_tasks"
2
- require "rake/testtask"
1
+ require 'bundler/gem_tasks'
2
+ require 'rake/testtask'
3
3
 
4
4
  Rake::TestTask.new(:test) do |t|
5
- t.libs << "test"
6
- t.libs << "lib"
5
+ t.libs << 'test'
6
+ t.libs << 'lib'
7
7
  t.test_files = FileList['test/**/*_test.rb']
8
+ t.ruby_opts += ['-W0']
8
9
  end
9
10
 
10
11
  task :default => :test
@@ -87,8 +87,8 @@ module SynapsePayRest
87
87
  # @param code [Integer]
88
88
  # @return [SynapsePayRest::Error]
89
89
  def from_response(body)
90
- # require 'pry'; binding.pry
91
90
  message, error_code, http_code = parse_error(body)
91
+ http_code = http_code.to_s
92
92
  klass = ERRORS[http_code] || SynapsePayRest::Error
93
93
  klass.new(message: message, code: error_code, response: body)
94
94
  end
@@ -100,6 +100,8 @@ module SynapsePayRest
100
100
  ['', nil, nil]
101
101
  elsif body.is_a?(Hash) && body['error'].is_a?(Hash)
102
102
  [body['error']['en'], body['error_code'], body['http_code']]
103
+ elsif body.is_a?(Hash) && body[:error].is_a?(Hash)
104
+ [body[:error][:en], body[:error_code], body[:http_code]]
103
105
  end
104
106
  end
105
107
  end
@@ -138,7 +138,16 @@ module SynapsePayRest
138
138
  def with_error_handling
139
139
  yield
140
140
  rescue RestClient::Exception => e
141
- body = JSON.parse(e.response.body)
141
+ if e.response.headers[:content_type] == 'application/json'
142
+ body = JSON.parse(e.response.body)
143
+ else
144
+ body = {
145
+ error: {
146
+ en: e.response.body
147
+ },
148
+ http_code: e.response.code
149
+ }
150
+ end
142
151
  raise Error.from_response(body)
143
152
  end
144
153
  end
@@ -13,7 +13,7 @@ module SynapsePayRest
13
13
  # @!attribute [rw] user
14
14
  # @return [SynapsePayRest::User] the user to which the node belongs
15
15
  # @!attribute [r] permission
16
- # @return [String] https://docs.synapsepay.com/docs/user-resources#section-user-permissions
16
+ # @return [String] https://docs.synapsepay.com/docs/node-resources#section-node-permissions
17
17
  attr_reader :user, :id, :nickname, :supp_id, :currency, :is_active, :permission,
18
18
  :account_number, :routing_number, :name_on_account, :address,
19
19
  :bank_name, :bank_id, :bank_pw, :account_class, :account_type,
@@ -1,4 +1,4 @@
1
1
  module SynapsePayRest
2
2
  # Gem version
3
- VERSION = '3.0.2'.freeze
3
+ VERSION = '3.0.3'.freeze
4
4
  end
@@ -1,5 +1,6 @@
1
1
  lib = File.expand_path('../lib', __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
+ require 'date'
3
4
  require 'synapse_pay_rest/version'
4
5
 
5
6
  Gem::Specification.new do |s|
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: synapse_pay_rest
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Steven Broderick
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2017-02-08 00:00:00.000000000 Z
12
+ date: 2017-03-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
@@ -202,7 +202,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
202
202
  version: '0'
203
203
  requirements: []
204
204
  rubyforge_project:
205
- rubygems_version: 2.6.10
205
+ rubygems_version: 2.2.5
206
206
  signing_key:
207
207
  specification_version: 4
208
208
  summary: SynapsePay v3 Rest Native API Library