3scale-3scale_ws_api_for_ruby 0.4.8 → 0.4.9

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.
data/README CHANGED
@@ -18,7 +18,9 @@ If you are using older version, put there this instead:
18
18
  First, create new interface object with 3scale backed hostname and Your
19
19
  private authentication key:
20
20
 
21
- interface = ThreeScale::Interface.new("http://3scale.net", "a3b034...")
21
+ interface = ThreeScale::Interface.new(backend_host, provider_key)
22
+
23
+ You can find the backend hostname on http://www.3scale.net/support/api.
22
24
 
23
25
  Because the object is stateless, you can create just one and store it globally.
24
26
 
@@ -61,3 +63,7 @@ Or call it with actual resource usage, if it differs from predicted one:
61
63
 
62
64
  3. Send response back to the user together with +provider_verification_key+.
63
65
 
66
+ == Legal:
67
+
68
+ Copyright (c) 2008 3scale networks S.L., released under the MIT license.
69
+
@@ -112,7 +112,7 @@ module ThreeScale # :nodoc:
112
112
  def start(user_key, usage = {})
113
113
  uri = URI.parse("#{host}/transactions.xml")
114
114
  params = {
115
- 'user_key' => prepare_key(user_key),
115
+ 'user_key' => user_key,
116
116
  'provider_key' => provider_authentication_key
117
117
  }
118
118
  params.merge!(encode_params(usage, 'usage'))
@@ -215,10 +215,6 @@ module ThreeScale # :nodoc:
215
215
  end
216
216
  end
217
217
 
218
- def prepare_key(key)
219
- system_key?(key) ? key[KEY_PREFIX.length..-1] : key
220
- end
221
-
222
218
  CODES_TO_EXCEPTIONS = {
223
219
  'user.exceeded_limits' => LimitsExceeded,
224
220
  'user.invalid_key' => UserKeyInvalid,
@@ -233,4 +229,4 @@ module ThreeScale # :nodoc:
233
229
  raise CODES_TO_EXCEPTIONS[element[:id]] || UnknownError, element.inner_text
234
230
  end
235
231
  end
236
- end
232
+ end
@@ -92,20 +92,6 @@ class InterfaceTest < Test::Unit::TestCase
92
92
  assert_equal 'ultimate', result[:contract_name]
93
93
  end
94
94
 
95
- def test_start_should_strip_3scale_prefix_from_user_key_before_sending
96
- Net::HTTP.expects(:post_form).with(anything,
97
- has_entries('user_key' => 'foo')).returns(stub_response)
98
-
99
- @interface.start('3scale-foo')
100
- end
101
-
102
- def test_start_should_leave_user_key_unchanged_if_it_does_not_contain_3scale_prefix
103
- Net::HTTP.expects(:post_form).with(anything,
104
- has_entries('user_key' => 'foo')).returns(stub_response)
105
-
106
- @interface.start('foo')
107
- end
108
-
109
95
  def test_confirm_should_raise_exception_on_invalid_transaction
110
96
  FakeWeb.register_uri('http://3scale.net/transactions/42/confirm.xml',
111
97
  :status => ['404', 'Not Found'],
@@ -215,4 +201,4 @@ class InterfaceTest < Test::Unit::TestCase
215
201
  response.stubs(:body).returns('<transaction></transaction>')
216
202
  response
217
203
  end
218
- end
204
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 3scale-3scale_ws_api_for_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.8
4
+ version: 0.4.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - "Adam Cig\xC3\xA1nek"
@@ -10,11 +10,12 @@ autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
12
 
13
- date: 2008-10-27 00:00:00 -07:00
13
+ date: 2009-05-16 00:00:00 -07:00
14
14
  default_executable:
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: hpricot
18
+ type: :runtime
18
19
  version_requirement:
19
20
  version_requirements: !ruby/object:Gem::Requirement
20
21
  requirements: