Class: Traktr::Lists

Inherits:
Endpoint show all
Defined in:
lib/traktr/lists.rb,
lib/traktr/lists/items.rb

Defined Under Namespace

Classes: Items

Instance Method Summary collapse

Methods inherited from Endpoint

#initialize

Constructor Details

This class inherits a constructor from Traktr::Endpoint

Instance Method Details

#add(data) ⇒ Object



3
4
5
6
# File 'lib/traktr/lists.rb', line 3

def add( data )
  data.merge!(@auth)
  parse_response self.class.post('/' + File.join('add', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end

#delete(slug) ⇒ Object



8
9
10
11
# File 'lib/traktr/lists.rb', line 8

def delete( slug )
  data = @auth.merge({:slug => slug})
  parse_response self.class.post('/' + File.join('delete', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end

#itemsObject



18
19
20
# File 'lib/traktr/lists.rb', line 18

def items
  @items ||= Traktr::Lists::Items.new(@client)
end

#update(slug, data) ⇒ Object



13
14
15
16
# File 'lib/traktr/lists.rb', line 13

def update( slug, data )
  data.merge!(@auth.merge({:slug => slug}))
  parse_response self.class.post('/' + File.join('update', @client.api_key), body: data.to_json, headers: { 'Content-Type' => 'application/json'})
end