Class: Traktr::Lists::Items

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

Instance Method Summary collapse

Methods inherited from Endpoint

#initialize

Constructor Details

This class inherits a constructor from Traktr::Endpoint

Instance Method Details

#add(slug, items) ⇒ Object



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

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

#delete(slug, items) ⇒ Object



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

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