harpy 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -37,7 +37,7 @@ module Harpy
37
37
  def from_url(url)
38
38
  case url
39
39
  when Array
40
- Harpy.client.run(client.get url).collect{|response| from_url_handler response}
40
+ Harpy.client.run(Harpy.client.get url).collect{|response| from_url_handler response}
41
41
  else
42
42
  from_url_handler Harpy.client.get url
43
43
  end
data/lib/harpy/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Harpy
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
@@ -80,6 +80,38 @@ describe "class including Harpy::Resource" do
80
80
  Harpy::Spec::Company.from_url(url)
81
81
  end
82
82
  end
83
+ context "called with multiple urls" do
84
+ let(:url1){ "http://localhost/company/1" }
85
+ let(:url2){ "http://localhost/company/2" }
86
+ it "is a properly filled-in instance of Harpy::Spec::Company on success" do
87
+ response1 = Typhoeus::Response.new :code => 200, :body => <<-eos
88
+ {
89
+ "name": "Harpy Ltd",
90
+ "link": [
91
+ {"rel": "self", "href": "#{url1}"}
92
+ ]
93
+ }
94
+ eos
95
+ response2 = Typhoeus::Response.new :code => 200, :body => <<-eos
96
+ {
97
+ "name": "Harpy Inc",
98
+ "link": [
99
+ {"rel": "self", "href": "#{url2}"}
100
+ ]
101
+ }
102
+ eos
103
+ Typhoeus::Hydra.hydra.stub(:get, url1).and_return response1
104
+ Typhoeus::Hydra.hydra.stub(:get, url2).and_return response2
105
+ results = Harpy::Spec::Company.from_url [url1, url2]
106
+ results.should have(2).items
107
+ results[0].should be_kind_of Harpy::Spec::Company
108
+ results[0].name.should == "Harpy Ltd"
109
+ results[0].link("self").should == url1
110
+ results[1].should be_kind_of Harpy::Spec::Company
111
+ results[1].name.should == "Harpy Inc"
112
+ results[1].link("self").should == url2
113
+ end
114
+ end
83
115
  end
84
116
  describe ".from_id(id)" do
85
117
  context "when entry point is configured" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: harpy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: typhoeus
18
- requirement: &2153432240 !ruby/object:Gem::Requirement
18
+ requirement: &2165828200 !ruby/object:Gem::Requirement
19
19
  none: false
20
20
  requirements:
21
21
  - - ~>
@@ -23,10 +23,10 @@ dependencies:
23
23
  version: 0.2.4
24
24
  type: :runtime
25
25
  prerelease: false
26
- version_requirements: *2153432240
26
+ version_requirements: *2165828200
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: activesupport
29
- requirement: &2153431720 !ruby/object:Gem::Requirement
29
+ requirement: &2165827680 !ruby/object:Gem::Requirement
30
30
  none: false
31
31
  requirements:
32
32
  - - ! '>='
@@ -34,10 +34,10 @@ dependencies:
34
34
  version: 3.0.0
35
35
  type: :runtime
36
36
  prerelease: false
37
- version_requirements: *2153431720
37
+ version_requirements: *2165827680
38
38
  - !ruby/object:Gem::Dependency
39
39
  name: activemodel
40
- requirement: &2153431240 !ruby/object:Gem::Requirement
40
+ requirement: &2165827200 !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
43
  - - ! '>='
@@ -45,10 +45,10 @@ dependencies:
45
45
  version: 3.0.0
46
46
  type: :runtime
47
47
  prerelease: false
48
- version_requirements: *2153431240
48
+ version_requirements: *2165827200
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: hash-deep-merge
51
- requirement: &2155946200 !ruby/object:Gem::Requirement
51
+ requirement: &2165826720 !ruby/object:Gem::Requirement
52
52
  none: false
53
53
  requirements:
54
54
  - - ~>
@@ -56,10 +56,10 @@ dependencies:
56
56
  version: 0.1.1
57
57
  type: :runtime
58
58
  prerelease: false
59
- version_requirements: *2155946200
59
+ version_requirements: *2165826720
60
60
  - !ruby/object:Gem::Dependency
61
61
  name: yajl-ruby
62
- requirement: &2155945720 !ruby/object:Gem::Requirement
62
+ requirement: &2165826240 !ruby/object:Gem::Requirement
63
63
  none: false
64
64
  requirements:
65
65
  - - ~>
@@ -67,10 +67,10 @@ dependencies:
67
67
  version: 0.8.2
68
68
  type: :runtime
69
69
  prerelease: false
70
- version_requirements: *2155945720
70
+ version_requirements: *2165826240
71
71
  - !ruby/object:Gem::Dependency
72
72
  name: rake
73
- requirement: &2155945240 !ruby/object:Gem::Requirement
73
+ requirement: &2165825760 !ruby/object:Gem::Requirement
74
74
  none: false
75
75
  requirements:
76
76
  - - ~>
@@ -78,10 +78,10 @@ dependencies:
78
78
  version: 0.8.7
79
79
  type: :development
80
80
  prerelease: false
81
- version_requirements: *2155945240
81
+ version_requirements: *2165825760
82
82
  - !ruby/object:Gem::Dependency
83
83
  name: rspec
84
- requirement: &2155944760 !ruby/object:Gem::Requirement
84
+ requirement: &2156256500 !ruby/object:Gem::Requirement
85
85
  none: false
86
86
  requirements:
87
87
  - - ~>
@@ -89,10 +89,10 @@ dependencies:
89
89
  version: 2.6.0
90
90
  type: :development
91
91
  prerelease: false
92
- version_requirements: *2155944760
92
+ version_requirements: *2156256500
93
93
  - !ruby/object:Gem::Dependency
94
94
  name: rocco
95
- requirement: &2155944280 !ruby/object:Gem::Requirement
95
+ requirement: &2156256020 !ruby/object:Gem::Requirement
96
96
  none: false
97
97
  requirements:
98
98
  - - ~>
@@ -100,7 +100,7 @@ dependencies:
100
100
  version: '0.7'
101
101
  type: :development
102
102
  prerelease: false
103
- version_requirements: *2155944280
103
+ version_requirements: *2156256020
104
104
  description: Client for REST API with HATEOAS
105
105
  email:
106
106
  - joseph.halter@thetalentbox.com