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 +4 -4
- data/.gitignore +1 -0
- data/CHANGELOG +3 -1
- data/README.md +12 -0
- data/chargehound.gemspec +1 -1
- data/lib/chargehound.rb +2 -1
- data/lib/chargehound/api_request.rb +4 -1
- data/lib/chargehound/error.rb +5 -0
- data/lib/chargehound/version.rb +1 -1
- data/test/chargehound_test.rb +6 -0
- data/test/error_test.rb +11 -0
- metadata +22 -22
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: be69ff643cea24f8f25e438f5a168b97b5a594b1
|
4
|
+
data.tar.gz: 81c55ba4fba079039d6e1cdbe9484e07d8e1feda
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed24f3d055251bffe65d6e5bdd1177b7ca6b6faff25b82b0ec74d0523c80f8eab8b74e9fa011dd3049e188088454cffdb18240f7831c2a69a7faaef30b083077
|
7
|
+
data.tar.gz: 1092f2d0b94a1601501255835b04ad67e4a0377a6ed1bb1a162a246c7d8186154bb13c1a62c504a960f2d65dc245e57ed25dc4806aa02b0872cdf397fcf415f9
|
data/.gitignore
CHANGED
data/CHANGELOG
CHANGED
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)
|
data/chargehound.gemspec
CHANGED
@@ -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', '
|
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($/)
|
data/lib/chargehound.rb
CHANGED
@@ -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
|
data/lib/chargehound/error.rb
CHANGED
@@ -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
|
data/lib/chargehound/version.rb
CHANGED
data/test/chargehound_test.rb
CHANGED
data/test/error_test.rb
CHANGED
@@ -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.
|
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-
|
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:
|
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:
|
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
|
-
-
|
106
|
-
-
|
107
|
-
-
|
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.
|
144
|
+
rubygems_version: 2.0.14
|
145
145
|
signing_key:
|
146
146
|
specification_version: 4
|
147
147
|
summary: Ruby bindings for the Chargehound API
|