chargehound 1.1.0 → 1.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: 96fdbfcdee29473624d86e92f503c57e96ec3cbb
4
- data.tar.gz: 2c9da9c4681ffe84ddbfdd764d809d5041461d59
3
+ metadata.gz: be69ff643cea24f8f25e438f5a168b97b5a594b1
4
+ data.tar.gz: 81c55ba4fba079039d6e1cdbe9484e07d8e1feda
5
5
  SHA512:
6
- metadata.gz: 4f769e8fd6fe26a5c410d4f9a7ebfaee1b32366fd356e21fa53a566ad840f4cf750963f58cb499fea5cfef0e55254a82f06ff2f8d1584469d0b6035c65319183
7
- data.tar.gz: 2e3eccc4d0977b48b24c53219518910a32b0b765ad8156fa44daa3f32f812a3be2eb2348d12321f52e0ce9c88c49ae877051434ac095308669da7c21bff4573d
6
+ metadata.gz: ed24f3d055251bffe65d6e5bdd1177b7ca6b6faff25b82b0ec74d0523c80f8eab8b74e9fa011dd3049e188088454cffdb18240f7831c2a69a7faaef30b083077
7
+ data.tar.gz: 1092f2d0b94a1601501255835b04ad67e4a0377a6ed1bb1a162a246c7d8186154bb13c1a62c504a960f2d65dc245e57ed25dc4806aa02b0872cdf397fcf415f9
data/.gitignore CHANGED
@@ -5,3 +5,4 @@ Gemfile.lock
5
5
  vendor
6
6
  .idea/
7
7
  *.iml
8
+ *.gem
data/CHANGELOG CHANGED
@@ -1,4 +1,6 @@
1
1
  1.0.0 April, 2016
2
2
  - Initial release with disputes API
3
3
  1.1.0 June, 2016
4
- - Added APIs to pass product lists
4
+ - Added APIs to pass product lists
5
+ 1.2.0 July, 2016
6
+ - Added timeout option
data/README.md CHANGED
@@ -35,3 +35,15 @@ Run tests:
35
35
  ```bash
36
36
  $ bundle exec rake
37
37
  ```
38
+
39
+ ## Deployment
40
+
41
+ To deploy a new version of the SDK, perform the following steps:
42
+
43
+ 1. Update the CHANGELOG to describe what feature have been added.
44
+ 2. Bump the version number in `/lib/chargehound/version.rb`
45
+ 3. Rebuild the gem with:
46
+ ```gem build chargehound.gemspec```
47
+ 4. Deploy the new gemfile to rubygems with:
48
+ ``` gem push <name_of_generated_gem>```
49
+ 5. Confirm the new gem version is available at [https://rubygems.org/gems/chargehound](https://rubygems.org/gems/chargehound)
@@ -19,7 +19,7 @@ Gem::Specification.new do |spec|
19
19
  spec.add_development_dependency 'bundler', '~> 1.5'
20
20
  spec.add_development_dependency 'minitest', '~> 5.8'
21
21
  spec.add_development_dependency 'rake', '~> 11.1'
22
- spec.add_development_dependency 'rubocop', '~> 0.39'
22
+ spec.add_development_dependency 'rubocop', '0.41.0'
23
23
  spec.add_development_dependency 'webmock', '~> 2.0'
24
24
 
25
25
  spec.files = `git ls-files`.split($/)
@@ -6,8 +6,9 @@ module Chargehound
6
6
  @host = 'api.chargehound.com'
7
7
  @base_path = '/v1/'
8
8
  @api_key = ''
9
+ @timeout = 60
9
10
 
10
11
  class << self
11
- attr_accessor :api_key, :host, :base_path
12
+ attr_accessor :api_key, :host, :base_path, :timeout
12
13
  end
13
14
  end
@@ -14,6 +14,8 @@ module Chargehound
14
14
  def run
15
15
  response = @request.run
16
16
 
17
+ raise ChargehoundError.create_timeout_error if response.timed_out?
18
+
17
19
  body = parse_request_body response.body
18
20
 
19
21
  unless response.success?
@@ -47,7 +49,8 @@ module Chargehound
47
49
  req_opts = {
48
50
  method: http_method,
49
51
  headers: headers,
50
- params: query_params
52
+ params: query_params,
53
+ timeout: Chargehound.timeout
51
54
  }
52
55
  build_body req_opts, http_method, opts
53
56
  req_opts
@@ -23,8 +23,13 @@ module Chargehound
23
23
  ChargehoundError.new(error)
24
24
  end
25
25
  end
26
+
27
+ def self.create_timeout_error
28
+ ChargehoundTimeoutError.new('Connection timed out')
29
+ end
26
30
  end
27
31
 
28
32
  class ChargehoundAuthenticationError < ChargehoundError; end
29
33
  class ChargehoundBadRequestError < ChargehoundError; end
34
+ class ChargehoundTimeoutError < StandardError; end
30
35
  end
@@ -1,3 +1,3 @@
1
1
  module Chargehound
2
- VERSION = '1.1.0'.freeze
2
+ VERSION = '1.2.0'.freeze
3
3
  end
@@ -31,4 +31,10 @@ describe Chargehound do
31
31
  Chargehound::Disputes.list
32
32
  assert_requested stub
33
33
  end
34
+
35
+ it 'can set the timeout on the module' do
36
+ Chargehound.timeout = 3
37
+
38
+ assert_equal(3, Chargehound.timeout)
39
+ end
34
40
  end
@@ -37,4 +37,15 @@ describe Chargehound::ChargehoundError do
37
37
  assert_equal('(Status 400) Bad Request', error.to_s)
38
38
  end
39
39
  end
40
+
41
+ it 'should throw a typed error on timeout' do
42
+ stub_request(:any, 'https://api.chargehound.com/v1/disputes').to_timeout
43
+
44
+ begin
45
+ Chargehound::Disputes.list
46
+ rescue Chargehound::ChargehoundTimeoutError => error
47
+ assert(error.is_a?(Chargehound::ChargehoundTimeoutError))
48
+ assert_equal('Connection timed out', error.to_s)
49
+ end
50
+ end
40
51
  end
metadata CHANGED
@@ -1,97 +1,97 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chargehound
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Chargehound
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-13 00:00:00.000000000 Z
11
+ date: 2016-07-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "<"
17
+ - - <
18
18
  - !ruby/object:Gem::Version
19
19
  version: '2.0'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "<"
24
+ - - <
25
25
  - !ruby/object:Gem::Version
26
26
  version: '2.0'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: bundler
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.5'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.5'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: minitest
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: '5.8'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: '5.8'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: rake
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: '11.1'
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: '11.1'
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rubocop
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - '='
74
74
  - !ruby/object:Gem::Version
75
- version: '0.39'
75
+ version: 0.41.0
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - '='
81
81
  - !ruby/object:Gem::Version
82
- version: '0.39'
82
+ version: 0.41.0
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: webmock
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - "~>"
87
+ - - ~>
88
88
  - !ruby/object:Gem::Version
89
89
  version: '2.0'
90
90
  type: :development
91
91
  prerelease: false
92
92
  version_requirements: !ruby/object:Gem::Requirement
93
93
  requirements:
94
- - - "~>"
94
+ - - ~>
95
95
  - !ruby/object:Gem::Version
96
96
  version: '2.0'
97
97
  description: Automatically fight disputes in Stripe
@@ -102,9 +102,9 @@ extensions: []
102
102
  extra_rdoc_files:
103
103
  - README.md
104
104
  files:
105
- - ".gitignore"
106
- - ".rubocop.yml"
107
- - ".travis.yml"
105
+ - .gitignore
106
+ - .rubocop.yml
107
+ - .travis.yml
108
108
  - CHANGELOG
109
109
  - Gemfile
110
110
  - LICENSE
@@ -131,17 +131,17 @@ require_paths:
131
131
  - lib
132
132
  required_ruby_version: !ruby/object:Gem::Requirement
133
133
  requirements:
134
- - - ">="
134
+ - - '>='
135
135
  - !ruby/object:Gem::Version
136
136
  version: 1.9.3
137
137
  required_rubygems_version: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - ">="
139
+ - - '>='
140
140
  - !ruby/object:Gem::Version
141
141
  version: '0'
142
142
  requirements: []
143
143
  rubyforge_project:
144
- rubygems_version: 2.4.3
144
+ rubygems_version: 2.0.14
145
145
  signing_key:
146
146
  specification_version: 4
147
147
  summary: Ruby bindings for the Chargehound API