Class: Bitlyr::Strategy::Base
- Inherits:
-
Object
- Object
- Bitlyr::Strategy::Base
- Defined in:
- lib/bitlyr/strategy/base.rb
Direct Known Subclasses
Instance Method Summary collapse
- #request(*args) ⇒ Object
-
#validate(x_login, x_api_key) ⇒ Object
(also: #valid?)
Validates a login and api key.
Instance Method Details
#request(*args) ⇒ Object
4 5 6 7 8 9 10 11 |
# File 'lib/bitlyr/strategy/base.rb', line 4 def request(*args) response = Bitlyr::Response.new(run_request(*args)) if response.success? response.body else raise BitlyrError.new(response) end end |
#validate(x_login, x_api_key) ⇒ Object Also known as: valid?
Validates a login and api key
14 15 16 17 |
# File 'lib/bitlyr/strategy/base.rb', line 14 def validate(x_login, x_api_key) response = request(:get, :validate, :x_login => x_login, :x_apiKey => x_api_key) return response['valid'] == 1 end |