Class: Gumroad::LinkProxy

Inherits:
Object
  • Object
show all
Defined in:
lib/gumroad/link_proxy.rb

Instance Method Summary collapse

Constructor Details

#initialize(session) ⇒ LinkProxy

Returns a new instance of LinkProxy.



3
4
5
# File 'lib/gumroad/link_proxy.rb', line 3

def initialize(session)
  @session = session
end

Instance Method Details

#allObject



11
12
13
14
15
# File 'lib/gumroad/link_proxy.rb', line 11

def all
  @session.get('/links')['links'].map do |json|
    Gumroad::Link.new(@session, json)
  end
end

#create(params = {}) ⇒ Object



17
18
19
20
# File 'lib/gumroad/link_proxy.rb', line 17

def create(params={})
  json = @session.post('/links', params)
  Gumroad::Link.new(@session, json['link'])
end

#find(id) ⇒ Object



7
8
9
# File 'lib/gumroad/link_proxy.rb', line 7

def find(id)
  Gumroad::Link.new(@session, @session.get("/links/#{id}")['link'])
end