shippo 2.0.4 → 2.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/README.md +1 -1
- data/lib/shippo.rb +4 -0
- data/lib/shippo/api.rb +2 -2
- data/lib/shippo/api/request.rb +8 -2
- data/lib/shippo/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c0d04c428bfb2bc14c169cb0c6e5feab577e17b2
|
4
|
+
data.tar.gz: 7c2fb58410b3b4f56d9c826d696be85bd3c791b9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7445274d61a5d8fff558a946a929d887e53f0e66b3a6674b5043f8ad2f22edbce4e49080f315cb01c241b65baa603e4cc834ba65b9566fcd6aba07eac989660e
|
7
|
+
data.tar.gz: 35b3fecf833f1d7e158c2f0ed6513b61202b549c57d6d16abcc551e798f1c6e5ba2bb2dc417834ba93a169e90b3161fa363f605f39b3ec78fe01953a95314b58
|
data/CHANGELOG.md
CHANGED
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.
|
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/
|
15
|
-
@version =
|
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
|
data/lib/shippo/api/request.rb
CHANGED
@@ -127,11 +127,13 @@ module Shippo
|
|
127
127
|
end
|
128
128
|
|
129
129
|
def setup_headers!(headers)
|
130
|
-
|
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}.
|
data/lib/shippo/api/version.rb
CHANGED
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
|
+
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-
|
12
|
+
date: 2016-11-03 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: rest-client
|