right_api_client 1.6.1 → 1.6.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rspec +3 -0
- data/CHANGELOG.md +10 -1
- data/Gemfile +6 -7
- data/README.md +8 -4
- data/VERSION +1 -1
- data/bin/console +40 -0
- data/bin/setup +5 -0
- data/config/login.yml.example +43 -0
- data/lib/right_api_client/client.rb +12 -3
- data/lib/right_api_client/errors.rb +6 -2
- data/login_to_client_irb.rb +1 -1
- data/right_api_client.gemspec +95 -0
- data/spec/functional/client_spec.rb +181 -0
- data/spec/spec_helper.rb +25 -0
- data/spec/support/mock_spec_helper.rb +40 -0
- data/spec/unit/client_spec.rb +23 -0
- data/spec/unit/helper_spec.rb +214 -0
- data/spec/unit/instance_facing_spec.rb +25 -0
- data/spec/unit/resource_detail_spec.rb +93 -0
- data/spec/unit/resource_spec.rb +78 -0
- data/spec/unit/resources_spec.rb +60 -0
- metadata +48 -33
- data/Gemfile.lock +0 -99
@@ -0,0 +1,60 @@
|
|
1
|
+
require File.expand_path('../../spec_helper', __FILE__)
|
2
|
+
|
3
|
+
describe RightApi::Resources, :unit=>true do
|
4
|
+
before(:each) do
|
5
|
+
given_user_facing_client
|
6
|
+
end
|
7
|
+
|
8
|
+
subject {RightApi::Resources.new(@client, '/api/resources', 'resources')}
|
9
|
+
|
10
|
+
context "attributes" do
|
11
|
+
its(:client) {should eq @client}
|
12
|
+
its(:path) {should eq '/api/resources'}
|
13
|
+
its(:resource_type) {should eq 'resources'}
|
14
|
+
end
|
15
|
+
|
16
|
+
context ".inspect" do
|
17
|
+
let (:resource) {RightApi::Resources.new(@client, '/api/resources', 'resources')}
|
18
|
+
it "returns correct inspect value" do
|
19
|
+
inspect_text = "#<#{resource.class.name} resource_type=\"#{resource.resource_type}\">"
|
20
|
+
resource.inspect.should == inspect_text
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
context ".to_ary" do
|
25
|
+
let (:resource) {RightApi::Resources.new(@client, '/api/resources', 'resources')}
|
26
|
+
it "returns correct to_array value" do
|
27
|
+
to_array_text = ["#<#{resource.class.name} ","resource_type=\"#{resource.resource_type}\">"]
|
28
|
+
resource.to_ary.should == to_array_text
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
context ".method_missing" do
|
33
|
+
it "sends request with path/method" do
|
34
|
+
client = flexmock(@client)
|
35
|
+
resource = RightApi::Resource.new(client, '/api/resource', 'resource')
|
36
|
+
client.should_receive(:send).with(:do_post, "#{resource.href}/method")
|
37
|
+
resource.method_missing('method')
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
context "given a logged in RightScale user" do
|
42
|
+
it "has the required methods for instances of the Resources class" do
|
43
|
+
resource = RightApi::Resources.new(@client, '/api/deployments', 'deployments')
|
44
|
+
resource.api_methods.sort.collect(&:to_s).should == %w[
|
45
|
+
create index ]
|
46
|
+
end
|
47
|
+
|
48
|
+
it "has index even for instances of the Resources class that do not support it" do
|
49
|
+
resource = RightApi::Resources.new(@client, '/api/tags', 'tags')
|
50
|
+
resource.api_methods.sort.collect(&:to_s).should == %w[
|
51
|
+
by_resource by_tag create index multi_add multi_delete ]
|
52
|
+
end
|
53
|
+
|
54
|
+
it "has resource-specific methods for instances of the Resources class" do
|
55
|
+
resource = RightApi::Resources.new(@client, '/api/backups', 'backups')
|
56
|
+
resource.api_methods.sort.collect(&:to_s).should == %w[
|
57
|
+
cleanup create index ]
|
58
|
+
end
|
59
|
+
end
|
60
|
+
end
|
metadata
CHANGED
@@ -1,125 +1,125 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: right_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.6.
|
4
|
+
version: 1.6.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- RightScale, Inc.
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-11-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - ~>
|
17
|
+
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '1.0'
|
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.0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: mime-types
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - ~>
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '
|
33
|
+
version: '2.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - ~>
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '
|
40
|
+
version: '2.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rest-client
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - ~>
|
45
|
+
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '1.6'
|
48
48
|
type: :runtime
|
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: '1.6'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- -
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0
|
61
|
+
version: '0'
|
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
|
-
version: 0
|
68
|
+
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: rspec
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- -
|
73
|
+
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 2.9
|
75
|
+
version: '2.9'
|
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
|
-
version: 2.9
|
82
|
+
version: '2.9'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: flexmock
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
|
-
- -
|
87
|
+
- - ">="
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0
|
89
|
+
version: '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
|
-
version: 0
|
96
|
+
version: '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'
|
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'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: pry
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
114
114
|
requirements:
|
115
|
-
- -
|
115
|
+
- - ">="
|
116
116
|
- !ruby/object:Gem::Version
|
117
117
|
version: '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'
|
125
125
|
description: |2
|
@@ -128,21 +128,26 @@ description: |2
|
|
128
128
|
It provides a simple object model of the API resources, and handles all of the
|
129
129
|
fine details involved in making HTTP calls and translating their responses.
|
130
130
|
email: rubygems@rightscale.com
|
131
|
-
executables:
|
131
|
+
executables:
|
132
|
+
- console
|
133
|
+
- setup
|
132
134
|
extensions: []
|
133
135
|
extra_rdoc_files:
|
134
136
|
- LICENSE.txt
|
135
137
|
- README.md
|
136
138
|
files:
|
137
|
-
- .coveralls.yml
|
138
|
-
- .
|
139
|
+
- ".coveralls.yml"
|
140
|
+
- ".rspec"
|
141
|
+
- ".travis.yml"
|
139
142
|
- CHANGELOG.md
|
140
143
|
- Gemfile
|
141
|
-
- Gemfile.lock
|
142
144
|
- LICENSE.txt
|
143
145
|
- README.md
|
144
146
|
- Rakefile
|
145
147
|
- VERSION
|
148
|
+
- bin/console
|
149
|
+
- bin/setup
|
150
|
+
- config/login.yml.example
|
146
151
|
- lib/right_api_client.rb
|
147
152
|
- lib/right_api_client/client.rb
|
148
153
|
- lib/right_api_client/errors.rb
|
@@ -153,7 +158,17 @@ files:
|
|
153
158
|
- lib/right_api_client/resources.rb
|
154
159
|
- lib/right_api_client/version.rb
|
155
160
|
- login_to_client_irb.rb
|
161
|
+
- right_api_client.gemspec
|
156
162
|
- right_api_client.rconf
|
163
|
+
- spec/functional/client_spec.rb
|
164
|
+
- spec/spec_helper.rb
|
165
|
+
- spec/support/mock_spec_helper.rb
|
166
|
+
- spec/unit/client_spec.rb
|
167
|
+
- spec/unit/helper_spec.rb
|
168
|
+
- spec/unit/instance_facing_spec.rb
|
169
|
+
- spec/unit/resource_detail_spec.rb
|
170
|
+
- spec/unit/resource_spec.rb
|
171
|
+
- spec/unit/resources_spec.rb
|
157
172
|
homepage: https://github.com/rightscale/right_api_client
|
158
173
|
licenses:
|
159
174
|
- MIT
|
@@ -164,17 +179,17 @@ require_paths:
|
|
164
179
|
- lib
|
165
180
|
required_ruby_version: !ruby/object:Gem::Requirement
|
166
181
|
requirements:
|
167
|
-
- -
|
182
|
+
- - ">="
|
168
183
|
- !ruby/object:Gem::Version
|
169
184
|
version: '0'
|
170
185
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
171
186
|
requirements:
|
172
|
-
- -
|
187
|
+
- - ">="
|
173
188
|
- !ruby/object:Gem::Version
|
174
189
|
version: '0'
|
175
190
|
requirements: []
|
176
191
|
rubyforge_project:
|
177
|
-
rubygems_version: 2.
|
192
|
+
rubygems_version: 2.4.8
|
178
193
|
signing_key:
|
179
194
|
specification_version: 4
|
180
195
|
summary: RightScale MultiCloud API HTTP Client
|
data/Gemfile.lock
DELETED
@@ -1,99 +0,0 @@
|
|
1
|
-
GEM
|
2
|
-
remote: https://rubygems.org/
|
3
|
-
specs:
|
4
|
-
addressable (2.3.6)
|
5
|
-
builder (3.2.2)
|
6
|
-
byebug (6.0.2)
|
7
|
-
coderay (1.1.0)
|
8
|
-
coveralls (0.7.1)
|
9
|
-
multi_json (~> 1.3)
|
10
|
-
rest-client
|
11
|
-
simplecov (>= 0.7)
|
12
|
-
term-ansicolor
|
13
|
-
thor
|
14
|
-
diff-lcs (1.1.3)
|
15
|
-
docile (1.1.5)
|
16
|
-
faraday (0.8.9)
|
17
|
-
multipart-post (~> 1.2.0)
|
18
|
-
flexmock (0.8.7)
|
19
|
-
git (1.2.6)
|
20
|
-
github_api (0.10.1)
|
21
|
-
addressable
|
22
|
-
faraday (~> 0.8.1)
|
23
|
-
hashie (>= 1.2)
|
24
|
-
multi_json (~> 1.4)
|
25
|
-
nokogiri (~> 1.5.2)
|
26
|
-
oauth2
|
27
|
-
hashie (3.0.0)
|
28
|
-
highline (1.6.21)
|
29
|
-
jeweler (2.0.1)
|
30
|
-
builder
|
31
|
-
bundler (>= 1.0)
|
32
|
-
git (>= 1.2.5)
|
33
|
-
github_api
|
34
|
-
highline (>= 1.6.15)
|
35
|
-
nokogiri (>= 1.5.10)
|
36
|
-
rake
|
37
|
-
rdoc
|
38
|
-
json (1.8.1)
|
39
|
-
jwt (0.1.11)
|
40
|
-
multi_json (>= 1.5)
|
41
|
-
method_source (0.8.2)
|
42
|
-
mime-types (1.25.1)
|
43
|
-
multi_json (1.10.1)
|
44
|
-
multi_xml (0.5.5)
|
45
|
-
multipart-post (1.2.0)
|
46
|
-
nokogiri (1.5.11)
|
47
|
-
oauth2 (0.9.3)
|
48
|
-
faraday (>= 0.8, < 0.10)
|
49
|
-
jwt (~> 0.1.8)
|
50
|
-
multi_json (~> 1.3)
|
51
|
-
multi_xml (~> 0.5)
|
52
|
-
rack (~> 1.2)
|
53
|
-
pry (0.10.1)
|
54
|
-
coderay (~> 1.1.0)
|
55
|
-
method_source (~> 0.8.1)
|
56
|
-
slop (~> 3.4)
|
57
|
-
rack (1.5.2)
|
58
|
-
rake (0.8.7)
|
59
|
-
rdoc (4.1.1)
|
60
|
-
json (~> 1.4)
|
61
|
-
rest-client (1.6.8)
|
62
|
-
mime-types (~> 1.16)
|
63
|
-
rdoc (>= 2.4.2)
|
64
|
-
rspec (2.9.0)
|
65
|
-
rspec-core (~> 2.9.0)
|
66
|
-
rspec-expectations (~> 2.9.0)
|
67
|
-
rspec-mocks (~> 2.9.0)
|
68
|
-
rspec-core (2.9.0)
|
69
|
-
rspec-expectations (2.9.1)
|
70
|
-
diff-lcs (~> 1.1.3)
|
71
|
-
rspec-mocks (2.9.0)
|
72
|
-
simplecov (0.9.0)
|
73
|
-
docile (~> 1.1.0)
|
74
|
-
multi_json
|
75
|
-
simplecov-html (~> 0.8.0)
|
76
|
-
simplecov-html (0.8.0)
|
77
|
-
slop (3.6.0)
|
78
|
-
term-ansicolor (1.3.0)
|
79
|
-
tins (~> 1.0)
|
80
|
-
thor (0.19.1)
|
81
|
-
tins (1.3.2)
|
82
|
-
|
83
|
-
PLATFORMS
|
84
|
-
ruby
|
85
|
-
|
86
|
-
DEPENDENCIES
|
87
|
-
byebug
|
88
|
-
coveralls
|
89
|
-
flexmock (= 0.8.7)
|
90
|
-
jeweler (~> 2.0)
|
91
|
-
json (~> 1.0)
|
92
|
-
mime-types (~> 1.0)
|
93
|
-
pry
|
94
|
-
rake (= 0.8.7)
|
95
|
-
rest-client (~> 1.6)
|
96
|
-
rspec (= 2.9.0)
|
97
|
-
|
98
|
-
BUNDLED WITH
|
99
|
-
1.10.6
|