finapps 2.0.22 → 2.0.23

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6e7a13dcc72709dbb7f506225ab60f81c6fff823
4
- data.tar.gz: 24fe49d526c5c7e4d3f26fa3b9f550338499eecd
3
+ metadata.gz: 5be4f8c24c61d16ba7c0faabfd7a8447457fbc9a
4
+ data.tar.gz: 260a063e09e7d8e7a23bfb9cf4e69b1d74dea3e0
5
5
  SHA512:
6
- metadata.gz: 5e8371cef6f4f43074e58edc6e6929187214f1d0e3b8e853915c0fcfae27b12dac9887889917fb4898df9828c8599ab9c4b7c9a197cc656d493aaddc1cd16e1c
7
- data.tar.gz: 1ee1d1761b9e7494ec27789e203e693830ed2b957bcee6e4fafc8a7615236e3379bcabe36d69c341150ee76de4e532cc66f52d30f5dc1766edb64d222572e05e
6
+ metadata.gz: 71a91753140914e0a7e01caceedcc11b3b5eb25997c8a46160c97706d23f511fa5dc5707de9762372ed52450ca10a94181c1788115092a7b8a4ea9a2ba372981
7
+ data.tar.gz: 6a1347b053c179e48f16b70c8785ccc8dfb5911371c40714ef2d963e4ad504d3ab14a0ebd5366742c7eb2648c2e8f4bf3d0a4989847af0d5fbd0ed92bdcea186
data/.hound.yml ADDED
@@ -0,0 +1,2 @@
1
+ ruby:
2
+ config_file: .rubocop.yml
@@ -48,6 +48,24 @@ module FinApps
48
48
  [result, error_messages]
49
49
  end
50
50
 
51
+ # Defines methods to perform HTTP GET, POST, PUT and DELETE requests.
52
+ # Returns a hash obtained from parsing the JSON object in the response body.
53
+ #
54
+ def method_missing(method_id, *arguments, &block)
55
+ if %i(get post put delete).include? method_id
56
+ connection.send(method_id) do |req|
57
+ req.url arguments.first
58
+ req.body = arguments[1] unless method_id == :get
59
+ end
60
+ else
61
+ super
62
+ end
63
+ end
64
+
65
+ def respond_to_missing?(method_sym, include_private=false)
66
+ [:get, :post, :put, :delete].include?(method_sym) ? true : super
67
+ end
68
+
51
69
  private
52
70
 
53
71
  def empty?(response)
@@ -78,7 +96,7 @@ module FinApps
78
96
 
79
97
  def handle_client_error(error)
80
98
  logger.warn "#{self.class}##{__method__} => Faraday::Error::ClientError, #{error}"
81
- error.response[:error_messages] || [error.message]
99
+ error.response.present? && error.response[:error_messages] ? error.response[:error_messages] : [error.message]
82
100
  end
83
101
 
84
102
  def execute_method(path, method, params)
@@ -95,24 +113,6 @@ module FinApps
95
113
  raise FinApps::InvalidArgumentsError.new "Method not supported: #{method}."
96
114
  end
97
115
  end
98
-
99
- # Defines methods to perform HTTP GET, POST, PUT and DELETE requests.
100
- # Returns a hash obtained from parsing the JSON object in the response body.
101
- #
102
- def method_missing(method_id, *arguments, &block)
103
- if %i(get post put delete).include? method_id
104
- connection.send(method_id) do |req|
105
- req.url arguments.first
106
- req.body = arguments[1] unless method_id == :get
107
- end
108
- else
109
- super
110
- end
111
- end
112
-
113
- def respond_to_missing?(method_name, include_private=false)
114
- %i(get post put delete).include? method_name ? true : super
115
- end
116
116
  end
117
117
  end
118
118
  end
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module FinApps
3
- VERSION = '2.0.22'
3
+ VERSION = '2.0.23'
4
4
  end
@@ -39,12 +39,19 @@ RSpec.describe FinApps::REST::BaseClient do
39
39
  end
40
40
 
41
41
  describe '#send_request' do
42
+ it 'should raise FinApps::InvalidArgumentsError if method is NOT supported' do
43
+ expect { subject.send_request('fake_path', :option) }.to raise_error(FinApps::InvalidArgumentsError,
44
+ 'Method not supported: option.')
45
+ end
46
+
42
47
  it 'should raise FinApps::MissingArgumentsError if method is NOT provided' do
43
- expect { subject.send_request(nil, :get) }.to raise_error(FinApps::MissingArgumentsError)
48
+ expect { subject.send_request(nil, :get) }.to raise_error(FinApps::MissingArgumentsError,
49
+ 'Missing argument: path.')
44
50
  end
45
51
 
46
52
  it 'should raise FinApps::MissingArgumentsError if path is NOT provided' do
47
- expect { subject.send_request('fake_path', nil) }.to raise_error(FinApps::MissingArgumentsError)
53
+ expect { subject.send_request('fake_path', nil) }.to raise_error(FinApps::MissingArgumentsError,
54
+ 'Missing argument: method.')
48
55
  end
49
56
 
50
57
  context 'when method and path are provided' do
@@ -102,4 +109,12 @@ RSpec.describe FinApps::REST::BaseClient do
102
109
  it { expect { subject.unsupported }.to raise_error(NoMethodError) }
103
110
  end
104
111
  end
112
+
113
+ describe '#respond_to_missing?' do
114
+ context 'for supported methods' do
115
+ [:get, :post, :put, :delete].each do |method|
116
+ it("responds to #{method}") { expect(subject).to respond_to(method) }
117
+ end
118
+ end
119
+ end
105
120
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: finapps
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.22
4
+ version: 2.0.23
5
5
  platform: ruby
6
6
  authors:
7
7
  - Erich Quintero
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-08-18 00:00:00.000000000 Z
11
+ date: 2016-08-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -235,6 +235,7 @@ extra_rdoc_files:
235
235
  files:
236
236
  - ".codeclimate.yml"
237
237
  - ".gitignore"
238
+ - ".hound.yml"
238
239
  - ".rspec"
239
240
  - ".rubocop.yml"
240
241
  - ".ruby-gemset"