Class: Ecommerce::Client
- Inherits:
-
Object
- Object
- Ecommerce::Client
- Defined in:
- lib/ecommerce/client.rb
Instance Attribute Summary collapse
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
-
#token ⇒ Object
readonly
Returns the value of attribute token.
Instance Method Summary collapse
- #authenticated?(plan) ⇒ Boolean
-
#initialize(token, secret) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(token, secret) ⇒ Client
Returns a new instance of Client.
8 9 10 11 |
# File 'lib/ecommerce/client.rb', line 8 def initialize(token, secret) @token = token @secret = secret end |
Instance Attribute Details
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
6 7 8 |
# File 'lib/ecommerce/client.rb', line 6 def secret @secret end |
#token ⇒ Object (readonly)
Returns the value of attribute token.
6 7 8 |
# File 'lib/ecommerce/client.rb', line 6 def token @token end |
Instance Method Details
#authenticated?(plan) ⇒ Boolean
13 14 15 16 17 18 |
# File 'lib/ecommerce/client.rb', line 13 def authenticated?(plan) get("/api/orders/#{plan}/") { |response| response.code == 200 } rescue RequestError => e raise e unless [401, 403].include?(e.code) false end |