3scale_api 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/3scale_api/3scale/api.rb +1 -1
- data/lib/3scale_api/version.rb +1 -1
- data/spec/3scale_api_spec.rb +23 -10
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2ff1614a78872c23c9f770ece900b9c9a1bb9963
|
4
|
+
data.tar.gz: 4282f1bba90c89c3a35f6c59c815d62934fe756c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d090343d4890466f9969cf4546d539147a45f34dcc84f0d7364352dfa7e87b5944f9e3d621acff9a95bdb3df383681d996566c8a96c0db532b9c4fd5e0792ad1
|
7
|
+
data.tar.gz: 4acebf3cd1b5ea33875693b3105f9e3f60a7d4384a73362abde06ea421c3f362b4b6856aa6331841d3d35c8ce128265a4dad67edb7ee301424dd1f5a8fc1c0d1
|
@@ -130,7 +130,7 @@ module Threescale
|
|
130
130
|
end
|
131
131
|
end
|
132
132
|
response = @conn.post "/admin/api/signup.xml", params
|
133
|
-
return false
|
133
|
+
return false if response.status != 201
|
134
134
|
xml = Nokogiri::XML(response.body)
|
135
135
|
account_id = xml.xpath('//account/id').first.text
|
136
136
|
user_id = xml.xpath('//account/users/user/id').text
|
data/lib/3scale_api/version.rb
CHANGED
data/spec/3scale_api_spec.rb
CHANGED
@@ -145,16 +145,6 @@ describe "3scaleApi" do
|
|
145
145
|
end
|
146
146
|
end
|
147
147
|
|
148
|
-
describe "create_account" do
|
149
|
-
it "should call /admin/api/accounts/{account_id}/applications.xml" do
|
150
|
-
stub_request(:post, "http://test-url.test/admin/api/services/service-id/application_plans.xml").
|
151
|
-
with(:body => {"name"=>"name", "provider_key"=>"provider-key"},
|
152
|
-
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.1'}).
|
153
|
-
to_return(:status => 200, :body => "", :headers => {})
|
154
|
-
@threescale.create_account "name", "service-id"
|
155
|
-
end
|
156
|
-
end
|
157
|
-
|
158
148
|
describe "create_user" do
|
159
149
|
it "should call /admin/api/accounts/{account_id}/users.xml" do
|
160
150
|
stub_request(:post, "http://test-url.test/admin/api/accounts/account-id/users.xml").
|
@@ -194,5 +184,28 @@ describe "3scaleApi" do
|
|
194
184
|
@threescale.change_role_to_member "account-id", "user-id"
|
195
185
|
end
|
196
186
|
end
|
187
|
+
|
188
|
+
describe "change_role_to_member" do
|
189
|
+
it "should call /admin/api/signup.xml" do
|
190
|
+
stub_request(:post, "http://test-url.test/admin/api/signup.xml").
|
191
|
+
with(:body => {"account_plan_id"=>"account_plan_id", "application_plan_id"=>"application_plan_id", "email"=>"emailorg_name", "org_name"=>"password", "password"=>"service_plan_id", "provider_key"=>"provider-key", "service_plan_id"=>"username", "username"=>{"first_field"=>"first-field"}},
|
192
|
+
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.1'}).
|
193
|
+
to_return(:status => 200, :body => "", :headers => {})
|
194
|
+
|
195
|
+
@threescale.signup_express "account_plan_id", "application_plan_id", "email" "org_name", "password",
|
196
|
+
"service_plan_id", "username", {:first_field => 'first-field'}
|
197
|
+
end
|
198
|
+
end
|
199
|
+
|
200
|
+
describe "approve_account" do
|
201
|
+
it "should call /admin/api/accounts/{account_id}/users/{user_id}/member.xml" do
|
202
|
+
stub_request(:put, "http://test-url.test/admin/api/accounts/account_id/approve.xml").
|
203
|
+
with(:body => {"provider_key"=>"provider-key"},
|
204
|
+
:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'Content-Type'=>'application/x-www-form-urlencoded', 'User-Agent'=>'Faraday v0.9.1'}).
|
205
|
+
to_return(:status => 200, :body => "", :headers => {})
|
206
|
+
|
207
|
+
@threescale.approve_account "account_id"
|
208
|
+
end
|
209
|
+
end
|
197
210
|
end
|
198
211
|
end
|