chargehound 2.1.0 → 2.2.0

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: e767aef37bedc764dfca2f44290236044ed54d31
4
- data.tar.gz: 1eff03558a88bb462a8eb55f84fb3c99e3dbb977
3
+ metadata.gz: 31be9dbdfb185724f781b20725eb877783e3c664
4
+ data.tar.gz: 9319f70f475d27941ba96704aec1eacf799ae49d
5
5
  SHA512:
6
- metadata.gz: 3c5ff14ab50d78e158be1c0845a33abd27956ccd7908e4550b98842b98ef7af804ff1c1ddf015534f85350d6f294dfe4d9a9fe167811ac2b3442ca789ef6e806
7
- data.tar.gz: 4b6440c357c1901d4a14bca0f25dbd7d1846bbf94dbf4a99c119cfca18e7d791b47aeaac33419591b9c3f4e535c3fac07a4584cd855d326e6c7c8b65f2ce79c8
6
+ metadata.gz: f02ea14de6beeb51ab586ebd55a2be71b9e2ac0398b6a0f5350b16fbfbcfb723b6ba3185ef746aa38ad3682e1dc74ec19907d5d4997558c218fc81614a888930
7
+ data.tar.gz: 16ec1a8b42319611385c23586084898dc5be3ec2ebf17d85945d3ac2ff25981e1aa69c38f5c0318cabb9e8fb6a79ec9e24f3f102528cef2280b43d8247d93a41
data/CHANGELOG CHANGED
@@ -12,3 +12,5 @@
12
12
  - Add typed response models
13
13
  2.1.0 July, 2017
14
14
  - Add Accept endpoint
15
+ 2.2.0 November, 2017
16
+ - Add support for overriding version
data/lib/chargehound.rb CHANGED
@@ -6,9 +6,10 @@ module Chargehound
6
6
  @host = 'api.chargehound.com'
7
7
  @base_path = '/v1/'
8
8
  @api_key = ''
9
+ @version = nil
9
10
  @timeout = 60
10
11
 
11
12
  class << self
12
- attr_accessor :api_key, :host, :base_path, :timeout
13
+ attr_accessor :api_key, :host, :base_path, :timeout, :version
13
14
  end
14
15
  end
@@ -50,6 +50,9 @@ module Chargehound
50
50
  'Accept' => 'application/json',
51
51
  'User-Agent' => "Chargehound/v1 RubyBindings/#{VERSION}"
52
52
  }
53
+ unless Chargehound.version.nil?
54
+ headers['Chargehound-Version'] = Chargehound.version
55
+ end
53
56
  body && headers['Content-Type'] = 'application/json'
54
57
  headers
55
58
  end
@@ -1,3 +1,3 @@
1
1
  module Chargehound
2
- VERSION = '2.1.0'.freeze
2
+ VERSION = '2.2.0'.freeze
3
3
  end
@@ -10,6 +10,7 @@ describe Chargehound do
10
10
  after do
11
11
  Chargehound.api_key = ''
12
12
  Chargehound.host = original_host
13
+ Chargehound.version = nil
13
14
  WebMock.reset!
14
15
  end
15
16
 
@@ -23,6 +24,17 @@ describe Chargehound do
23
24
  assert_requested stub
24
25
  end
25
26
 
27
+ it 'can set the version on the module' do
28
+ Chargehound.api_key = 'API_KEY'
29
+ Chargehound.version = '1999-01-01'
30
+ stub = stub_request(:get, 'https://api.chargehound.com/v1/disputes')
31
+ .with(headers: { 'Chargehound-Version' => '1999-01-01' })
32
+ .to_return(body: {}.to_json)
33
+
34
+ Chargehound::Disputes.list
35
+ assert_requested stub
36
+ end
37
+
26
38
  it 'can set the base host on the module' do
27
39
  Chargehound.host = 'test'
28
40
  stub = stub_request(:get, 'https://test/v1/disputes')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chargehound
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.0
4
+ version: 2.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: 2017-07-27 00:00:00.000000000 Z
11
+ date: 2017-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler