Class: Sendcloud::Base
- Inherits:
-
Object
- Object
- Sendcloud::Base
- Includes:
- HTTParty
- Defined in:
- lib/sendcloud/base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_secret ⇒ Object
Returns the value of attribute api_secret.
Instance Method Summary collapse
-
#auth ⇒ Hash
get the auth hash to use for all the requests since the sendcloud api uses basic authentication it will be used in the subclasses like this: ‘HTTParty.get(“twitter.com/statuses/public_timeline.json”, :basic_auth => auth)`.
-
#initialize(api_key, api_secret) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(api_key, api_secret) ⇒ Base
Returns a new instance of Base.
14 15 16 17 |
# File 'lib/sendcloud/base.rb', line 14 def initialize(api_key, api_secret) self.api_key = api_key self.api_secret = api_secret end |
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
9 10 11 |
# File 'lib/sendcloud/base.rb', line 9 def api_key @api_key end |
#api_secret ⇒ Object
Returns the value of attribute api_secret.
9 10 11 |
# File 'lib/sendcloud/base.rb', line 9 def api_secret @api_secret end |
Instance Method Details
#auth ⇒ Hash
get the auth hash to use for all the requests since the sendcloud api uses basic authentication it will be used in the subclasses like this: ‘HTTParty.get(“twitter.com/statuses/public_timeline.json”, :basic_auth => auth)`
25 26 27 |
# File 'lib/sendcloud/base.rb', line 25 def auth { username: api_key, password: api_secret} end |