3scale_api 1.0.12 → 1.0.13
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 +27 -0
- data/lib/3scale_api/version.rb +1 -1
- data/spec/3scale_api_spec.rb +9 -0
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 31e70ebb20f63e2977cf75e09ab11737df0fe352
|
4
|
+
data.tar.gz: 1aaed0d60427ed3b021551487fb1c0856132d2c0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bce09b3e8e3483c706d2fc8ab4497427850dc0c085a28bc8f9d82c735704be6ed95bdca6bddb0de92af71b2cc5fe3dbb79c4a8d810807c90e6d546855e887d39
|
7
|
+
data.tar.gz: 2bcbd3aa7af9f4e38d296a50b0a2bccb480e97dc1052c18e18f5443f69aee031da4eb1c0f53832c5d233a8be6cd860ee97a2429da0287b05eea550ff442f3ec7
|
@@ -101,6 +101,19 @@ module Threescale
|
|
101
101
|
end
|
102
102
|
end
|
103
103
|
|
104
|
+
def get_service_plans_by_
|
105
|
+
results = Array.new
|
106
|
+
response = @conn.get "/admin/api/application_plans.xml", {:provider_key => @provider_key }
|
107
|
+
xml = Nokogiri::XML(response.body)
|
108
|
+
plans = xml.xpath("//plans/plan")
|
109
|
+
plans = plans.map do |plan|
|
110
|
+
{
|
111
|
+
:name => plan.css("name").text,
|
112
|
+
:service_plan_id => plan.css("service_id").text
|
113
|
+
}
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
104
117
|
def get_services
|
105
118
|
results = Array.new
|
106
119
|
response = @conn.get "/admin/api/services.xml", {:provider_key => @provider_key }
|
@@ -193,5 +206,19 @@ module Threescale
|
|
193
206
|
response.status == 201
|
194
207
|
end
|
195
208
|
|
209
|
+
def load_application_data(account_id, application_id)
|
210
|
+
response = @conn.get "/admin/api/accounts/#{account_id}/applications/#{application_id}.xml",{
|
211
|
+
:provider_key => @provider_key}
|
212
|
+
return false if response.status != 200
|
213
|
+
xml = Nokogiri::XML(response.body)
|
214
|
+
application_data = {:keys => Array.new}
|
215
|
+
xml.xpath("//keys/key").map do |key|
|
216
|
+
application_data[:keys].push key.text
|
217
|
+
end
|
218
|
+
application_data[:app_id] = xml.css("application application_id").text
|
219
|
+
application_data[:name] = xml.css("application name").text
|
220
|
+
application_data[:description] = xml.css("application description").text
|
221
|
+
application_data
|
222
|
+
end
|
196
223
|
end
|
197
224
|
end
|
data/lib/3scale_api/version.rb
CHANGED
data/spec/3scale_api_spec.rb
CHANGED
@@ -221,5 +221,14 @@ describe "3scaleApi" do
|
|
221
221
|
@threescale.get_account_plans
|
222
222
|
end
|
223
223
|
end
|
224
|
+
|
225
|
+
describe "load_application_data" do
|
226
|
+
it "should call /admin/api/accounts/{account_id}/applications/{application_id}.xml" do
|
227
|
+
stub_request(:get, "http://test-url.test/admin/api/accounts/account-id/applications/application-id.xml?provider_key=provider-key").
|
228
|
+
with(:headers => {'Accept'=>'*/*', 'Accept-Encoding'=>'gzip;q=1.0,deflate;q=0.6,identity;q=0.3', 'User-Agent'=>'Faraday v0.9.1'}).
|
229
|
+
to_return(:status => 200, :body => "", :headers => {})
|
230
|
+
@threescale.load_application_data "account-id", "application-id"
|
231
|
+
end
|
232
|
+
end
|
224
233
|
end
|
225
234
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: 3scale_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.13
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robbie Holmes
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-04-
|
11
|
+
date: 2015-04-30 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: This gem is to be used to interact with 3Scale's API.
|
14
14
|
email:
|