Class: Gumroad::Session
- Inherits:
-
Object
- Object
- Gumroad::Session
- Includes:
- HTTParty
- Defined in:
- lib/gumroad/session.rb
Instance Method Summary collapse
- #delete(path) ⇒ Object
- #destroy ⇒ Object
- #get(path) ⇒ Object
-
#initialize(email, password) ⇒ Session
constructor
A new instance of Session.
- #links ⇒ Object
- #post(path, params) ⇒ Object
Constructor Details
#initialize(email, password) ⇒ Session
Returns a new instance of Session.
8 9 10 11 12 13 |
# File 'lib/gumroad/session.rb', line 8 def initialize(email, password) token = post('/sessions', { email: email, password: password })['token'] self.class.basic_auth token, '' end |
Instance Method Details
#delete(path) ⇒ Object
27 28 29 |
# File 'lib/gumroad/session.rb', line 27 def delete(path) self.class.delete(path) end |
#destroy ⇒ Object
15 16 17 |
# File 'lib/gumroad/session.rb', line 15 def destroy delete('/sessions') end |
#get(path) ⇒ Object
23 24 25 |
# File 'lib/gumroad/session.rb', line 23 def get(path) self.class.get(path) end |
#links ⇒ Object
31 32 33 |
# File 'lib/gumroad/session.rb', line 31 def links Gumroad::LinkProxy.new(self) end |
#post(path, params) ⇒ Object
19 20 21 |
# File 'lib/gumroad/session.rb', line 19 def post(path, params) self.class.post(path, query: params) end |