avvo_api 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +18 -15
- data/avvo_api.gemspec +2 -2
- data/lib/avvo_api/version.rb +1 -1
- data/test/unit/base_test.rb +6 -6
- data/test/unit/headshot_test.rb +5 -5
- data/test/unit/lawyer_test.rb +3 -3
- metadata +7 -13
data/Gemfile.lock
CHANGED
@@ -1,28 +1,31 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
avvo_api (0.2.
|
5
|
-
activeresource (
|
6
|
-
reactive_resource (~> 0.
|
4
|
+
avvo_api (0.2.1)
|
5
|
+
activeresource (>= 3.0.0)
|
6
|
+
reactive_resource (~> 0.7)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: http://rubygems.org/
|
10
10
|
specs:
|
11
|
-
activemodel (3.
|
12
|
-
activesupport (= 3.
|
13
|
-
builder (~>
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
11
|
+
activemodel (3.2.12)
|
12
|
+
activesupport (= 3.2.12)
|
13
|
+
builder (~> 3.0.0)
|
14
|
+
activeresource (3.2.12)
|
15
|
+
activemodel (= 3.2.12)
|
16
|
+
activesupport (= 3.2.12)
|
17
|
+
activesupport (3.2.12)
|
18
|
+
i18n (~> 0.6)
|
19
|
+
multi_json (~> 1.0)
|
19
20
|
addressable (2.2.2)
|
20
|
-
builder (
|
21
|
+
builder (3.0.4)
|
21
22
|
crack (0.1.8)
|
22
|
-
i18n (0.
|
23
|
+
i18n (0.6.1)
|
24
|
+
multi_json (1.6.1)
|
23
25
|
rake (0.8.7)
|
24
|
-
reactive_resource (0.
|
25
|
-
activeresource (>=
|
26
|
+
reactive_resource (0.7.1)
|
27
|
+
activeresource (>= 3.1)
|
28
|
+
activesupport (>= 3.1)
|
26
29
|
shoulda (2.11.3)
|
27
30
|
webmock (1.6.2)
|
28
31
|
addressable (>= 2.2.2)
|
data/avvo_api.gemspec
CHANGED
@@ -12,8 +12,8 @@ Gem::Specification.new do |s|
|
|
12
12
|
s.summary = %q{An ActiveResource client to the Avvo API}
|
13
13
|
s.description = %q{An ActiveResource client to the Avvo API}
|
14
14
|
|
15
|
-
s.add_dependency "activeresource", '
|
16
|
-
s.add_dependency "reactive_resource", '~> 0.
|
15
|
+
s.add_dependency "activeresource", '>= 3.0.0'
|
16
|
+
s.add_dependency "reactive_resource", '~> 0.7'
|
17
17
|
s.add_development_dependency "shoulda", '~> 2.11.3'
|
18
18
|
s.add_development_dependency "webmock", '~> 1.6.1'
|
19
19
|
|
data/lib/avvo_api/version.rb
CHANGED
data/test/unit/base_test.rb
CHANGED
@@ -15,7 +15,7 @@ class AvvoApi::BaseTest < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
should "hit the Avvo API with the correct URL when retrieved" do
|
18
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1.json").to_return(:body => {:id => '1'}.to_json)
|
18
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1.json").to_return(:body => {:id => '1', :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
19
19
|
AvvoApi::Lawyer.find(1)
|
20
20
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1.json")
|
21
21
|
end
|
@@ -31,7 +31,7 @@ class AvvoApi::BaseTest < Test::Unit::TestCase
|
|
31
31
|
|
32
32
|
context "with a has_one relationship to another object" do
|
33
33
|
should "hit the associated object's URL with the correct parameters when requested" do
|
34
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah"}.to_json)
|
34
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah", :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
35
35
|
@object.id = 1
|
36
36
|
@object.headshot
|
37
37
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json")
|
@@ -50,7 +50,7 @@ class AvvoApi::BaseTest < Test::Unit::TestCase
|
|
50
50
|
end
|
51
51
|
|
52
52
|
should "hit the Avvo API with the correct URL when retrieved" do
|
53
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/specialties/3.json").to_return(:body => {:id => '3'}.to_json)
|
53
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/specialties/3.json").to_return(:body => {:id => '3', :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
54
54
|
AvvoApi::Specialty.find(3, :params => {:lawyer_id => 2})
|
55
55
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/specialties/3.json")
|
56
56
|
end
|
@@ -94,7 +94,7 @@ class AvvoApi::BaseTest < Test::Unit::TestCase
|
|
94
94
|
@object.lawyer_id = 2
|
95
95
|
@object.address_id = 3
|
96
96
|
assert_equal 3, @object.address_id
|
97
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3.json").to_return(:body => {:id => '3'}.to_json)
|
97
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3.json").to_return(:body => {:id => '3', :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
98
98
|
@object.address
|
99
99
|
@object.address
|
100
100
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3.json", :times => 1)
|
@@ -107,7 +107,7 @@ class AvvoApi::BaseTest < Test::Unit::TestCase
|
|
107
107
|
end
|
108
108
|
|
109
109
|
should "hit the Avvo API with the correct URL when updated" do
|
110
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3/phones/4.json").to_return(:body => {:id => '4'}.to_json)
|
110
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3/phones/4.json").to_return(:body => {:id => '4', :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
111
111
|
phone = AvvoApi::Phone.find(4, :params => {:lawyer_id => 2, :address_id => 3})
|
112
112
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3/phones/4.json")
|
113
113
|
|
@@ -125,7 +125,7 @@ class AvvoApi::BaseTest < Test::Unit::TestCase
|
|
125
125
|
end
|
126
126
|
|
127
127
|
should "hit the Avvo API with the correct URL when retrieved" do
|
128
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3/phones/4.json").to_return(:body => {:id => '4'}.to_json)
|
128
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3/phones/4.json").to_return(:body => {:id => '4', :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
129
129
|
AvvoApi::Phone.find(4, :params => {:lawyer_id => 2, :address_id => 3})
|
130
130
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/2/addresses/3/phones/4.json")
|
131
131
|
end
|
data/test/unit/headshot_test.rb
CHANGED
@@ -9,7 +9,7 @@ class AvvoApi::HeadshotTest < Test::Unit::TestCase
|
|
9
9
|
end
|
10
10
|
|
11
11
|
should "get the correct url" do
|
12
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah"}.to_json)
|
12
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah", :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
13
13
|
AvvoApi::Headshot.find(:one, :params => {:lawyer_id => 1})
|
14
14
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json")
|
15
15
|
end
|
@@ -22,15 +22,15 @@ class AvvoApi::HeadshotTest < Test::Unit::TestCase
|
|
22
22
|
end
|
23
23
|
|
24
24
|
should "be able to update an existing headshot" do
|
25
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah"}.to_json)
|
25
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah", :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
26
26
|
@headshot = AvvoApi::Headshot.find(:one, :params => {:lawyer_id => 1})
|
27
|
-
stub_request(:
|
27
|
+
stub_request(:put, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json")
|
28
28
|
@headshot.save
|
29
|
-
assert_requested(:
|
29
|
+
assert_requested(:put, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json")
|
30
30
|
end
|
31
31
|
|
32
32
|
should "be able to destroy a headshot" do
|
33
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah"}.to_json)
|
33
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json").to_return(:body => {:headshot_url => "blah", :updated_at => '2013-02-10T00:46:12-08:00'}.to_json)
|
34
34
|
@headshot = AvvoApi::Headshot.find(:one, :params => {:lawyer_id => 1})
|
35
35
|
stub_request(:delete, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/1/headshot.json")
|
36
36
|
@headshot.destroy
|
data/test/unit/lawyer_test.rb
CHANGED
@@ -27,7 +27,7 @@ class AvvoApi::LawyerTest < Test::Unit::TestCase
|
|
27
27
|
end
|
28
28
|
|
29
29
|
should "have errors on the firstname attribute" do
|
30
|
-
assert_match "can't be blank", @lawyer.errors
|
30
|
+
assert_match "can't be blank", @lawyer.errors[:firstname].first
|
31
31
|
end
|
32
32
|
end
|
33
33
|
|
@@ -66,14 +66,14 @@ class AvvoApi::LawyerTest < Test::Unit::TestCase
|
|
66
66
|
context "AvvoApi::Lawyer.resolve" do
|
67
67
|
|
68
68
|
should "return the appropriate lawyer" do
|
69
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/resolve.json?params%5Bname%5D=Mark%20Britton¶ms%5Bzip_code%5D=98101").to_return(:body => {:lawyers => [{:id => 1}]}.to_json)
|
69
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/resolve.json?params%5Bname%5D=Mark%20Britton¶ms%5Bzip_code%5D=98101").to_return(:body => {:lawyers => [{:id => 1}], :annotation => nil}.to_json)
|
70
70
|
lawyers = AvvoApi::Lawyer.resolve({:name => 'Mark Britton', :zip_code => 98101})
|
71
71
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/resolve.json?params%5Bname%5D=Mark%20Britton¶ms%5Bzip_code%5D=98101")
|
72
72
|
assert_equal 1, lawyers.length
|
73
73
|
end
|
74
74
|
|
75
75
|
should "return an empty array if the lawyer can't be found" do
|
76
|
-
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/resolve.json?params%5Bname%5D=Mark%20Britton¶ms%5Bzip_code%5D=98101").to_return(:body => {:lawyers => []}.to_json)
|
76
|
+
stub_request(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/resolve.json?params%5Bname%5D=Mark%20Britton¶ms%5Bzip_code%5D=98101").to_return(:body => {:lawyers => [], :annotation => nil}.to_json)
|
77
77
|
lawyers = AvvoApi::Lawyer.resolve({:name => 'Mark Britton', :zip_code => 98101})
|
78
78
|
assert_requested(:get, "https://test_account%40avvo.com:password@api.avvo.com/api/1/lawyers/resolve.json?params%5Bname%5D=Mark%20Britton¶ms%5Bzip_code%5D=98101")
|
79
79
|
assert_equal 0, lawyers.length
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: avvo_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,14 +9,14 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2013-02-15 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activeresource
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
|
-
- -
|
19
|
+
- - ! '>='
|
20
20
|
- !ruby/object:Gem::Version
|
21
21
|
version: 3.0.0
|
22
22
|
type: :runtime
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
none: false
|
26
26
|
requirements:
|
27
|
-
- -
|
27
|
+
- - ! '>='
|
28
28
|
- !ruby/object:Gem::Version
|
29
29
|
version: 3.0.0
|
30
30
|
- !ruby/object:Gem::Dependency
|
@@ -34,7 +34,7 @@ dependencies:
|
|
34
34
|
requirements:
|
35
35
|
- - ~>
|
36
36
|
- !ruby/object:Gem::Version
|
37
|
-
version: '0.
|
37
|
+
version: '0.7'
|
38
38
|
type: :runtime
|
39
39
|
prerelease: false
|
40
40
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -42,7 +42,7 @@ dependencies:
|
|
42
42
|
requirements:
|
43
43
|
- - ~>
|
44
44
|
- !ruby/object:Gem::Version
|
45
|
-
version: '0.
|
45
|
+
version: '0.7'
|
46
46
|
- !ruby/object:Gem::Dependency
|
47
47
|
name: shoulda
|
48
48
|
requirement: !ruby/object:Gem::Requirement
|
@@ -122,21 +122,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
122
122
|
- - ! '>='
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '0'
|
125
|
-
segments:
|
126
|
-
- 0
|
127
|
-
hash: -3858919658491321272
|
128
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
126
|
none: false
|
130
127
|
requirements:
|
131
128
|
- - ! '>='
|
132
129
|
- !ruby/object:Gem::Version
|
133
130
|
version: '0'
|
134
|
-
segments:
|
135
|
-
- 0
|
136
|
-
hash: -3858919658491321272
|
137
131
|
requirements: []
|
138
132
|
rubyforge_project: avvo_api
|
139
|
-
rubygems_version: 1.8.
|
133
|
+
rubygems_version: 1.8.25
|
140
134
|
signing_key:
|
141
135
|
specification_version: 3
|
142
136
|
summary: An ActiveResource client to the Avvo API
|