synapse_pay_rest 3.0.2 → 3.0.3
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/Rakefile +5 -4
- data/lib/synapse_pay_rest/error.rb +3 -1
- data/lib/synapse_pay_rest/http_client.rb +10 -1
- data/lib/synapse_pay_rest/models/node/base_node.rb +1 -1
- data/lib/synapse_pay_rest/version.rb +1 -1
- data/synapse_pay_rest.gemspec +1 -0
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52d88f66ed3fc929b1081efa3f3b35348eb81f36
|
4
|
+
data.tar.gz: bb931667e46fa8300333563726404b15e52354e1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5c1a641071ef97a98cf3b80c89524d6d1816c1df383839e70978e8b898a8432012586e95d732dc7c0a844194d1188f25d834c87b2a2589bcb1bd79fe5c53d392
|
7
|
+
data.tar.gz: 8b96fe4410a7182625f3afef21e51f1b62a15e17a636b1ee566347e5757d170160025f9e5285387679f1fb4134c632ab5a0147f3f383a6c09acd18932ff7dc04
|
data/Rakefile
CHANGED
@@ -1,10 +1,11 @@
|
|
1
|
-
require
|
2
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
|
+
require 'rake/testtask'
|
3
3
|
|
4
4
|
Rake::TestTask.new(:test) do |t|
|
5
|
-
t.libs <<
|
6
|
-
t.libs <<
|
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
|
-
|
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/
|
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,
|
data/synapse_pay_rest.gemspec
CHANGED
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.
|
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-
|
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.
|
205
|
+
rubygems_version: 2.2.5
|
206
206
|
signing_key:
|
207
207
|
specification_version: 4
|
208
208
|
summary: SynapsePay v3 Rest Native API Library
|