3scale_api 1.0.12 → 1.0.13

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 902686b9fa039136e7c8a551951c29eafbc111d8
4
- data.tar.gz: bde00070b7af22c4e7716889f59e7f31f2106519
3
+ metadata.gz: 31e70ebb20f63e2977cf75e09ab11737df0fe352
4
+ data.tar.gz: 1aaed0d60427ed3b021551487fb1c0856132d2c0
5
5
  SHA512:
6
- metadata.gz: a53288f1cab2fff5be919f62b13a1aa99e77403f2756668bf762cde25a228bbffc7b2e057d8aa1141dc6e19dca0138755e10ea87b9ed81d83df4252c2b778754
7
- data.tar.gz: 6deb17918e512bef1ee8fd5ec66bf1a06bfd023f66071c84eb4e2bb1d6d3f6654570b97ee236d8f24ba58b27a8b2ed05986ef522f2074082834733094214ece3
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
@@ -1,3 +1,3 @@
1
1
  module Threescale
2
- VERSION = "1.0.12"
2
+ VERSION = "1.0.13"
3
3
  end
@@ -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.12
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-20 00:00:00.000000000 Z
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: