lob 2.1.1 → 2.1.2

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: 9de1168d1f32c3a7c550f8d0736e77ad9e7a6f6f
4
- data.tar.gz: 1c8d01295bf49455eb8e11f23f08d6ba6ec520ac
3
+ metadata.gz: 79613585b245d843892bf65391541adf1276b3b3
4
+ data.tar.gz: 1b8d68eadfa85cc5f5990accff5131a0d685d20c
5
5
  SHA512:
6
- metadata.gz: cb1e0ecca749119e00aae99d4666e2790b1d23c294e489cb9f01ccdcf4094dc32eefec9775428640f5fa58be676e5c04ff21791c876ce4bd6e7c5cf12c46b598
7
- data.tar.gz: d9b1ff382c0169a33263995b29c150bb6c4e784668469cc00157183a2a7b2fa8539c4980cf2ba9cebe34b6bbc36c65caa3db4f0170c55b922b97f7fb2dcb57fb
6
+ metadata.gz: ecb0d20f58d97392f3484375d01b78acf784ffdb72df9717c6ab3c950c5e644eb99a8209147fbdd543abd417b604036689d572b467c2618f8ae043986bc330a6
7
+ data.tar.gz: 7c399257e3eeea5a134eccac0c0b473d95fabea8cc45c330f421cf80ad787261a858994f9b53f7d2dd7dee117a434951db84895757b2a95a210bcd3b09c22dd4
data/.travis.yml CHANGED
@@ -6,7 +6,8 @@ rvm:
6
6
  - 1.9.3
7
7
  - jruby
8
8
  - 2.0.0
9
- - 2.1.0
9
+ - 2.1
10
+ - 2.2
10
11
 
11
12
  env:
12
13
  JRUBY_OPTS=--2.0
data/CHANGELOG.md CHANGED
@@ -1,3 +1,6 @@
1
+ ## [**2.1.2**](https://github.com/lob/lob-ruby/releases/tag/v2.1.2)
2
+ - [**#127**] (https://github.com/lob/lob-ruby/pull/127) Ensure JSON.parse is never passes nil
3
+
1
4
  ## [**2.1.1**](https://github.com/lob/lob-ruby/releases/tag/v2.1.1)
2
5
  - [**#124**] (https://github.com/lob/lob-ruby/pull/124) routes#find accepts single ZIP code
3
6
 
data/lib/lob.rb CHANGED
@@ -48,11 +48,13 @@ module Lob
48
48
 
49
49
  def self.handle_api_error(error)
50
50
  begin
51
- response = JSON.parse(error.http_body)
51
+ response = JSON.parse(error.http_body.to_s)
52
52
  message = response.fetch("error").fetch("message")
53
53
  raise InvalidRequestError.new(message, error.http_code, error.http_body, error.response)
54
54
  rescue JSON::ParserError, KeyError
55
+ # :nocov:
55
56
  raise LobError.new("Invalid response object:", error.http_code, error.http_body)
57
+ # :nocov:
56
58
  end
57
59
  end
58
60
 
@@ -66,10 +68,8 @@ module Lob
66
68
  value.map { |k, v|
67
69
  build_nested_query(v, prefix ? "#{prefix}[#{URI.encode_www_form_component(k)}]" : URI.encode_www_form_component(k))
68
70
  }.reject(&:empty?).join('&')
69
- when nil
70
- prefix
71
71
  else
72
- raise ArgumentError, "value must be a Hash" if prefix.nil?
72
+ raise ArgumentError, "value must be an Array or Hash" if prefix.nil?
73
73
  "#{prefix}=#{URI.encode_www_form_component(value)}"
74
74
  end
75
75
  end
@@ -40,10 +40,6 @@ module Lob
40
40
  Lob::V1::Object.new(self)
41
41
  end
42
42
 
43
- def packagings
44
- Lob::V1::Packaging.new(self)
45
- end
46
-
47
43
  def postcards
48
44
  Lob::V1::Postcard.new(self)
49
45
  end
data/lib/lob/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Lob
2
- VERSION = "2.1.1"
2
+ VERSION = "2.1.2"
3
3
  end
@@ -24,7 +24,7 @@ describe Lob::V1::Postcard do
24
24
 
25
25
  describe "list" do
26
26
  it "should list postcards" do
27
- assert subject.postcards.list["object"] == "list"
27
+ assert subject.postcards.list({ include: ['total_count'] })["object"] == "list"
28
28
  end
29
29
  end
30
30
 
data/spec/lob_spec.rb CHANGED
@@ -3,6 +3,7 @@ require "spec_helper"
3
3
  describe Lob do
4
4
 
5
5
  after do
6
+ Lob.api_key = nil
6
7
  Lob.api_version = nil
7
8
  end
8
9
 
@@ -19,6 +20,12 @@ describe Lob do
19
20
  Lob(api_key: "test").options[:api_key].must_equal "test"
20
21
  end
21
22
 
23
+ it "should raise an error if no API key is supplied" do
24
+ assert_raises ArgumentError do
25
+ Lob()
26
+ end
27
+ end
28
+
22
29
  it "should allow detailed configuration" do
23
30
  Lob.configure do |config|
24
31
  config.api_key = "test"
metadata CHANGED
@@ -1,139 +1,139 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lob
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.1.1
4
+ version: 2.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lob
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-07-23 00:00:00.000000000 Z
11
+ date: 2015-10-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - ~>
17
+ - - "~>"
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.8'
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: '1.8'
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.3'
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.3'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rake
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ~>
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
47
  version: 10.4.2
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: 10.4.2
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: minitest
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 5.6.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: 5.6.1
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: webmock
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ~>
73
+ - - "~>"
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.2'
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
82
  version: '1.2'
83
83
  - !ruby/object:Gem::Dependency
84
84
  name: travis-lint
85
85
  requirement: !ruby/object:Gem::Requirement
86
86
  requirements:
87
- - - ~>
87
+ - - "~>"
88
88
  - !ruby/object:Gem::Version
89
89
  version: 2.0.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.0
97
97
  - !ruby/object:Gem::Dependency
98
98
  name: coveralls
99
99
  requirement: !ruby/object:Gem::Requirement
100
100
  requirements:
101
- - - ~>
101
+ - - "~>"
102
102
  - !ruby/object:Gem::Version
103
103
  version: 0.8.1
104
104
  type: :development
105
105
  prerelease: false
106
106
  version_requirements: !ruby/object:Gem::Requirement
107
107
  requirements:
108
- - - ~>
108
+ - - "~>"
109
109
  - !ruby/object:Gem::Version
110
110
  version: 0.8.1
111
111
  - !ruby/object:Gem::Dependency
112
112
  name: simplecov
113
113
  requirement: !ruby/object:Gem::Requirement
114
114
  requirements:
115
- - - ~>
115
+ - - "~>"
116
116
  - !ruby/object:Gem::Version
117
117
  version: 0.10.0
118
118
  type: :development
119
119
  prerelease: false
120
120
  version_requirements: !ruby/object:Gem::Requirement
121
121
  requirements:
122
- - - ~>
122
+ - - "~>"
123
123
  - !ruby/object:Gem::Version
124
124
  version: 0.10.0
125
125
  - !ruby/object:Gem::Dependency
126
126
  name: pry
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - ~>
129
+ - - "~>"
130
130
  - !ruby/object:Gem::Version
131
131
  version: 0.10.0
132
132
  type: :development
133
133
  prerelease: false
134
134
  version_requirements: !ruby/object:Gem::Requirement
135
135
  requirements:
136
- - - ~>
136
+ - - "~>"
137
137
  - !ruby/object:Gem::Version
138
138
  version: 0.10.0
139
139
  description: Lob API Ruby wrapper
@@ -143,8 +143,8 @@ executables: []
143
143
  extensions: []
144
144
  extra_rdoc_files: []
145
145
  files:
146
- - .gitignore
147
- - .travis.yml
146
+ - ".gitignore"
147
+ - ".travis.yml"
148
148
  - CHANGELOG.md
149
149
  - Gemfile
150
150
  - LICENSE.txt
@@ -210,17 +210,17 @@ require_paths:
210
210
  - lib
211
211
  required_ruby_version: !ruby/object:Gem::Requirement
212
212
  requirements:
213
- - - '>='
213
+ - - ">="
214
214
  - !ruby/object:Gem::Version
215
215
  version: '0'
216
216
  required_rubygems_version: !ruby/object:Gem::Requirement
217
217
  requirements:
218
- - - '>='
218
+ - - ">="
219
219
  - !ruby/object:Gem::Version
220
220
  version: '0'
221
221
  requirements: []
222
222
  rubyforge_project:
223
- rubygems_version: 2.0.14
223
+ rubygems_version: 2.4.6
224
224
  signing_key:
225
225
  specification_version: 4
226
226
  summary: Ruby wrapper for Lob.com API with ActiveRecord-style syntax