shippo 2.0.4 → 2.0.5

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: 2f9bf9beca739037960540287dff9d9a95ed04b0
4
- data.tar.gz: 1dda325c2990112fdea3cc71fcad284a28f8d4a8
3
+ metadata.gz: c0d04c428bfb2bc14c169cb0c6e5feab577e17b2
4
+ data.tar.gz: 7c2fb58410b3b4f56d9c826d696be85bd3c791b9
5
5
  SHA512:
6
- metadata.gz: 039577c829fecb5a060e9ba366a297162ea8ba5a97e4863203e037fb0b0a9c2911243d9ceedfa0537c3be112b06fffa2bb0629ba710084a49ce0a1e1123e590c
7
- data.tar.gz: 2c79359b3e1bd3842cbce98715bf6548226b1a5a3bdf238301ceaacd8d48bc175e33ff3d5911ba7de42660aa7c2d4c41fad64ab10774a800ee6b3ddfa64ba4fe
6
+ metadata.gz: 7445274d61a5d8fff558a946a929d887e53f0e66b3a6674b5043f8ad2f22edbce4e49080f315cb01c241b65baa603e4cc834ba65b9566fcd6aba07eac989660e
7
+ data.tar.gz: 35b3fecf833f1d7e158c2f0ed6513b61202b549c57d6d16abcc551e798f1c6e5ba2bb2dc417834ba93a169e90b3161fa363f605f39b3ec78fe01953a95314b58
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ #### 2.0.5 release, Oct 24th, 2016
2
+ - Updated README.md
3
+ - now possible to send API version
1
4
  #### 2.0.4 release, Oct 6th 2016
2
5
  - Rails5 Compatibility via relaxed dependencies
3
6
  - removing mime-types dependency
data/README.md CHANGED
@@ -42,7 +42,7 @@ Below we demonstrate the most basic usage of the library:
42
42
  require 'shippo'
43
43
 
44
44
  # Setup your API token
45
- Shippo.api_key = 'aff988f77afa0fdfdfadf' # not an actual valid token
45
+ Shippo::API.token = 'aff988f77afa0fdfdfadf' # not an actual valid token
46
46
 
47
47
  # Setup query parameter hash
48
48
  params = { object_purpose: 'PURCHASE',
data/lib/shippo.rb CHANGED
@@ -18,7 +18,11 @@ module Shippo
18
18
  def self.api_key(value)
19
19
  ::Shippo::API.token = value
20
20
  end
21
+ def self.api_version(value)
22
+ ::Shippo::API.version = value
23
+ end
21
24
  class << self
25
+ alias_method :api_version=, :api_version
22
26
  alias_method :api_key=, :api_key
23
27
  alias_method :api_token=, :api_key
24
28
  end
data/lib/shippo/api.rb CHANGED
@@ -11,8 +11,8 @@ require 'shippo/api/resource'
11
11
 
12
12
  module Shippo
13
13
  module API
14
- @base = 'https://api.goshippo.com/v1'
15
- @version = 1.0
14
+ @base = 'https://api.goshippo.com/'
15
+ @version = nil
16
16
  @token = ''
17
17
  @debug = Integer(ENV['SHIPPO_DEBUG'] || 0) > 0 ? true : false
18
18
  @warnings = true
@@ -127,11 +127,13 @@ module Shippo
127
127
  end
128
128
 
129
129
  def setup_headers!(headers)
130
- headers.merge!(
130
+ additional_hash = {
131
131
  :accept => :json,
132
132
  :content_type => :json,
133
133
  :Authorization => "ShippoToken #{token}"
134
- )
134
+ }
135
+ additional_hash[:'Shippo-API-Version'] = "Shippo-API-Version #{version}" if version
136
+ headers.merge!(additional_hash)
135
137
  end
136
138
 
137
139
  def awesome_print_response(e)
@@ -153,6 +155,10 @@ module Shippo
153
155
  ::Shippo::API.token
154
156
  end
155
157
 
158
+ def version
159
+ ::Shippo::API.version
160
+ end
161
+
156
162
  def connection_error_message(url, error)
157
163
  %Q[Could not connect to the Shippo API, via URL
158
164
  #{url}.
@@ -1,5 +1,5 @@
1
1
  module Shippo
2
2
  module API
3
- VERSION = '2.0.4'
3
+ VERSION = '2.0.5'
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: shippo
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.4
4
+ version: 2.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Shippo & Contributors
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2016-10-06 00:00:00.000000000 Z
12
+ date: 2016-11-03 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client