Class: Gumroad::Session

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/gumroad/session.rb

Instance Method Summary collapse

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

#destroyObject



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


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