you_got_listed 0.3.3 → 0.3.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/you_got_listed/accounts.rb +2 -2
- data/lib/you_got_listed/agent.rb +6 -6
- data/lib/you_got_listed/client.rb +5 -5
- data/lib/you_got_listed/complex.rb +6 -6
- data/lib/you_got_listed/complexes.rb +8 -8
- data/lib/you_got_listed/error.rb +4 -4
- data/lib/you_got_listed/lead.rb +3 -3
- data/lib/you_got_listed/listing.rb +15 -14
- data/lib/you_got_listed/listings.rb +13 -13
- data/lib/you_got_listed/resource.rb +5 -5
- data/lib/you_got_listed/response.rb +19 -8
- data/lib/you_got_listed/version.rb +1 -1
- data/lib/you_got_listed.rb +0 -1
- data/spec/fixtures/responses/blank.xml +0 -0
- data/spec/fixtures/responses/empty.xml +2 -0
- data/spec/you_got_listed/accounts_spec.rb +5 -5
- data/spec/you_got_listed/agent_spec.rb +14 -14
- data/spec/you_got_listed/client_spec.rb +4 -4
- data/spec/you_got_listed/complex_spec.rb +5 -5
- data/spec/you_got_listed/complexes_spec.rb +13 -13
- data/spec/you_got_listed/error_spec.rb +2 -2
- data/spec/you_got_listed/lead_spec.rb +6 -6
- data/spec/you_got_listed/listing_spec.rb +82 -20
- data/spec/you_got_listed/listings_spec.rb +69 -33
- data/spec/you_got_listed/resource_spec.rb +3 -3
- data/spec/you_got_listed/response_spec.rb +52 -24
- data/you_got_listed.gemspec +1 -2
- metadata +20 -32
@@ -1,13 +1,13 @@
|
|
1
1
|
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
2
2
|
|
3
3
|
describe YouGotListed::Response do
|
4
|
-
|
4
|
+
|
5
5
|
context "should not raise errors" do
|
6
6
|
before do
|
7
7
|
@ygl = new_ygl
|
8
8
|
@accounts = YouGotListed::Accounts.new(@ygl)
|
9
9
|
end
|
10
|
-
|
10
|
+
|
11
11
|
it "should not raise an exception" do
|
12
12
|
lambda {
|
13
13
|
VCR.use_cassette('accounts.search') do
|
@@ -16,13 +16,13 @@ describe YouGotListed::Response do
|
|
16
16
|
}.should_not raise_exception
|
17
17
|
end
|
18
18
|
end
|
19
|
-
|
19
|
+
|
20
20
|
context "should return a response" do
|
21
21
|
before do
|
22
22
|
@ygl = new_ygl
|
23
23
|
@accounts = YouGotListed::Accounts.new(@ygl)
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
it "should not raise an exception" do
|
27
27
|
lambda {
|
28
28
|
VCR.use_cassette('accounts.search') do
|
@@ -30,7 +30,7 @@ describe YouGotListed::Response do
|
|
30
30
|
end
|
31
31
|
}.should_not raise_exception
|
32
32
|
end
|
33
|
-
|
33
|
+
|
34
34
|
it "should be a success" do
|
35
35
|
VCR.use_cassette('accounts.search') do
|
36
36
|
@response = @accounts.search
|
@@ -40,7 +40,7 @@ describe YouGotListed::Response do
|
|
40
40
|
@response.ygl_response.should be_kind_of(Hashie::Rash)
|
41
41
|
end
|
42
42
|
end
|
43
|
-
|
43
|
+
|
44
44
|
context "method missing" do
|
45
45
|
before do
|
46
46
|
@ygl = new_ygl
|
@@ -49,44 +49,72 @@ describe YouGotListed::Response do
|
|
49
49
|
@response = @accounts.search
|
50
50
|
end
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
53
|
it "should allow response.ygl_response methods to be called on response" do
|
54
54
|
body = stub(:total_count => 25)
|
55
55
|
@response.ygl_response = body
|
56
56
|
@response.total_count.should == 25
|
57
57
|
end
|
58
|
-
|
58
|
+
|
59
59
|
it "should call super if ygl_response does not respond to the method" do
|
60
60
|
lambda { @response.bad_method }.should raise_error(NoMethodError, /undefined method `bad_method'/)
|
61
61
|
end
|
62
62
|
end
|
63
|
-
|
63
|
+
|
64
64
|
context "passing raise_errors = true" do
|
65
|
-
|
66
|
-
|
67
|
-
|
65
|
+
context "with errored response" do
|
66
|
+
before do
|
67
|
+
@ygl = new_ygl
|
68
|
+
@mocked_response = httparty_get(@ygl.class.base_uri, '/accounts/search.php', 'error.xml', @ygl.class.default_params)
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should raise errors when raise_errors is true" do
|
72
|
+
lambda {
|
73
|
+
YouGotListed::Response.new(@mocked_response, true)
|
74
|
+
}.should raise_exception(YouGotListed::Error, "YouGotListed Error: Invalid key. (code: 998)")
|
75
|
+
end
|
68
76
|
end
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
77
|
+
|
78
|
+
context "empty response" do
|
79
|
+
before do
|
80
|
+
@ygl = new_ygl
|
81
|
+
@mocked_response = httparty_get(@ygl.class.base_uri, '/accounts/search.php', 'empty.xml', @ygl.class.default_params)
|
82
|
+
end
|
83
|
+
|
84
|
+
it "should raise errors when raise_errors is true" do
|
85
|
+
lambda {
|
86
|
+
YouGotListed::Response.new(@mocked_response, true)
|
87
|
+
}.should raise_exception(YouGotListed::Error, "YouGotListed Error: Empty Response (code: empty_response)")
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
context "blank response" do
|
92
|
+
before do
|
93
|
+
@ygl = new_ygl
|
94
|
+
@mocked_response = httparty_get(@ygl.class.base_uri, '/accounts/search.php', 'blank.xml', @ygl.class.default_params)
|
95
|
+
end
|
96
|
+
|
97
|
+
it "should raise errors when raise_errors is true" do
|
98
|
+
lambda {
|
99
|
+
YouGotListed::Response.new(@mocked_response, true)
|
100
|
+
}.should raise_exception(YouGotListed::Error, "YouGotListed Error: Empty Response (code: empty_response)")
|
101
|
+
end
|
74
102
|
end
|
75
103
|
end
|
76
|
-
|
104
|
+
|
77
105
|
context "client timeout error" do
|
78
106
|
before do
|
79
107
|
@ygl = new_ygl
|
80
108
|
YouGotListed::Client.stub!(:get).and_raise(Timeout::Error)
|
81
109
|
@accounts = YouGotListed::Accounts.new(@ygl)
|
82
110
|
end
|
83
|
-
|
111
|
+
|
84
112
|
it "should not raise errors" do
|
85
113
|
lambda {
|
86
114
|
@response = @accounts.search
|
87
115
|
}.should_not raise_exception
|
88
116
|
end
|
89
|
-
|
117
|
+
|
90
118
|
it "should not be a success" do
|
91
119
|
@response = @accounts.search
|
92
120
|
@response.success?.should be_false
|
@@ -94,20 +122,20 @@ describe YouGotListed::Response do
|
|
94
122
|
@response.error.should == "Timeout"
|
95
123
|
end
|
96
124
|
end
|
97
|
-
|
125
|
+
|
98
126
|
context "client exception" do
|
99
127
|
before do
|
100
128
|
@ygl = new_ygl
|
101
129
|
YouGotListed::Client.stub!(:get).and_raise(Exception)
|
102
130
|
@accounts = YouGotListed::Accounts.new(@ygl)
|
103
131
|
end
|
104
|
-
|
132
|
+
|
105
133
|
it "should not raise errors" do
|
106
134
|
lambda {
|
107
135
|
@response = @accounts.search
|
108
136
|
}.should_not raise_exception
|
109
137
|
end
|
110
|
-
|
138
|
+
|
111
139
|
it "should not be a success" do
|
112
140
|
@response = @accounts.search
|
113
141
|
@response.success?.should be_false
|
@@ -115,5 +143,5 @@ describe YouGotListed::Response do
|
|
115
143
|
@response.error.should == "Unknown Error"
|
116
144
|
end
|
117
145
|
end
|
118
|
-
|
146
|
+
|
119
147
|
end
|
data/you_got_listed.gemspec
CHANGED
@@ -18,8 +18,7 @@ Gem::Specification.new do |s|
|
|
18
18
|
|
19
19
|
s.add_dependency "activesupport", "~> 3"
|
20
20
|
s.add_dependency "httparty", ">= 0.6.1"
|
21
|
-
s.add_dependency "
|
22
|
-
s.add_dependency "rash", ">= 0.2.0"
|
21
|
+
s.add_dependency "rash", ">= 0.3.2"
|
23
22
|
s.add_dependency "will_paginate", ">= 3"
|
24
23
|
s.add_development_dependency "rake", "~> 0.9.2"
|
25
24
|
s.add_development_dependency "rspec", ">= 2.5.0"
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: you_got_listed
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 3
|
9
|
-
-
|
10
|
-
version: 0.3.
|
9
|
+
- 4
|
10
|
+
version: 0.3.4
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Tom Cocca
|
@@ -50,22 +50,6 @@ dependencies:
|
|
50
50
|
prerelease: false
|
51
51
|
- !ruby/object:Gem::Dependency
|
52
52
|
requirement: &id003 !ruby/object:Gem::Requirement
|
53
|
-
none: false
|
54
|
-
requirements:
|
55
|
-
- - ">="
|
56
|
-
- !ruby/object:Gem::Version
|
57
|
-
hash: 15
|
58
|
-
segments:
|
59
|
-
- 0
|
60
|
-
- 4
|
61
|
-
- 0
|
62
|
-
version: 0.4.0
|
63
|
-
version_requirements: *id003
|
64
|
-
name: hashie
|
65
|
-
type: :runtime
|
66
|
-
prerelease: false
|
67
|
-
- !ruby/object:Gem::Dependency
|
68
|
-
requirement: &id004 !ruby/object:Gem::Requirement
|
69
53
|
none: false
|
70
54
|
requirements:
|
71
55
|
- - ">="
|
@@ -73,15 +57,15 @@ dependencies:
|
|
73
57
|
hash: 23
|
74
58
|
segments:
|
75
59
|
- 0
|
60
|
+
- 3
|
76
61
|
- 2
|
77
|
-
|
78
|
-
|
79
|
-
version_requirements: *id004
|
62
|
+
version: 0.3.2
|
63
|
+
version_requirements: *id003
|
80
64
|
name: rash
|
81
65
|
type: :runtime
|
82
66
|
prerelease: false
|
83
67
|
- !ruby/object:Gem::Dependency
|
84
|
-
requirement: &
|
68
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
85
69
|
none: false
|
86
70
|
requirements:
|
87
71
|
- - ">="
|
@@ -90,12 +74,12 @@ dependencies:
|
|
90
74
|
segments:
|
91
75
|
- 3
|
92
76
|
version: "3"
|
93
|
-
version_requirements: *
|
77
|
+
version_requirements: *id004
|
94
78
|
name: will_paginate
|
95
79
|
type: :runtime
|
96
80
|
prerelease: false
|
97
81
|
- !ruby/object:Gem::Dependency
|
98
|
-
requirement: &
|
82
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
99
83
|
none: false
|
100
84
|
requirements:
|
101
85
|
- - ~>
|
@@ -106,12 +90,12 @@ dependencies:
|
|
106
90
|
- 9
|
107
91
|
- 2
|
108
92
|
version: 0.9.2
|
109
|
-
version_requirements: *
|
93
|
+
version_requirements: *id005
|
110
94
|
name: rake
|
111
95
|
type: :development
|
112
96
|
prerelease: false
|
113
97
|
- !ruby/object:Gem::Dependency
|
114
|
-
requirement: &
|
98
|
+
requirement: &id006 !ruby/object:Gem::Requirement
|
115
99
|
none: false
|
116
100
|
requirements:
|
117
101
|
- - ">="
|
@@ -122,12 +106,12 @@ dependencies:
|
|
122
106
|
- 5
|
123
107
|
- 0
|
124
108
|
version: 2.5.0
|
125
|
-
version_requirements: *
|
109
|
+
version_requirements: *id006
|
126
110
|
name: rspec
|
127
111
|
type: :development
|
128
112
|
prerelease: false
|
129
113
|
- !ruby/object:Gem::Dependency
|
130
|
-
requirement: &
|
114
|
+
requirement: &id007 !ruby/object:Gem::Requirement
|
131
115
|
none: false
|
132
116
|
requirements:
|
133
117
|
- - ">="
|
@@ -138,12 +122,12 @@ dependencies:
|
|
138
122
|
- 6
|
139
123
|
- 2
|
140
124
|
version: 1.6.2
|
141
|
-
version_requirements: *
|
125
|
+
version_requirements: *id007
|
142
126
|
name: webmock
|
143
127
|
type: :development
|
144
128
|
prerelease: false
|
145
129
|
- !ruby/object:Gem::Dependency
|
146
|
-
requirement: &
|
130
|
+
requirement: &id008 !ruby/object:Gem::Requirement
|
147
131
|
none: false
|
148
132
|
requirements:
|
149
133
|
- - ">="
|
@@ -154,7 +138,7 @@ dependencies:
|
|
154
138
|
- 8
|
155
139
|
- 0
|
156
140
|
version: 1.8.0
|
157
|
-
version_requirements: *
|
141
|
+
version_requirements: *id008
|
158
142
|
name: vcr
|
159
143
|
type: :development
|
160
144
|
prerelease: false
|
@@ -186,6 +170,8 @@ files:
|
|
186
170
|
- lib/you_got_listed/resource.rb
|
187
171
|
- lib/you_got_listed/response.rb
|
188
172
|
- lib/you_got_listed/version.rb
|
173
|
+
- spec/fixtures/responses/blank.xml
|
174
|
+
- spec/fixtures/responses/empty.xml
|
189
175
|
- spec/fixtures/responses/error.xml
|
190
176
|
- spec/spec.opts
|
191
177
|
- spec/spec_helper.rb
|
@@ -240,6 +226,8 @@ signing_key:
|
|
240
226
|
specification_version: 3
|
241
227
|
summary: ruby api wrapper for you got listings
|
242
228
|
test_files:
|
229
|
+
- spec/fixtures/responses/blank.xml
|
230
|
+
- spec/fixtures/responses/empty.xml
|
243
231
|
- spec/fixtures/responses/error.xml
|
244
232
|
- spec/spec.opts
|
245
233
|
- spec/spec_helper.rb
|