Class: Traktr::Activity::User

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/traktr/activity/user.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ User

Returns a new instance of User.



7
8
9
# File 'lib/traktr/activity/user.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#episodes(username, title, season, episode, actions = :all, start_ts = 0, end_ts = Time.now.to_i) ⇒ Object

Raises:

  • (ResponseError)


11
12
13
14
15
16
# File 'lib/traktr/activity/user.rb', line 11

def episodes(username, title, season, episode, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
  response = self.class.get('/' + File.join('episodes.json', @client.api_key, username, title, season.to_s, episode.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
  raise ResponseError.new(response) if response.code != 200

  Mash.new(response.parsed_response)
end

#movies(username, title, actions = :all, start_ts = 0, end_ts = Time.now.to_i) ⇒ Object

Raises:

  • (ResponseError)


18
19
20
21
22
23
# File 'lib/traktr/activity/user.rb', line 18

def movies(username, title, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
  response = self.class.get('/' + File.join('movies.json', @client.api_key, username, title, actions.to_s, start_ts.to_s, end_ts.to_s))
  raise ResponseError.new(response) if response.code != 200
 
  Mash.new(response.parsed_response)
end

#seasons(username, title, season, actions = :all, start_ts = 0, end_ts = Time.now.to_i) ⇒ Object

Raises:

  • (ResponseError)


25
26
27
28
29
30
# File 'lib/traktr/activity/user.rb', line 25

def seasons(username, title, season, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
  response = self.class.get('/' + File.join('seasons.json', @client.api_key, username, title, season.to_s, actions.to_s, start_ts.to_s, end_ts.to_s))
  raise ResponseError.new(response) if response.code != 200
 
  Mash.new(response.parsed_response)
end

#shows(username, title, actions = :all, start_ts = 0, end_ts = Time.now.to_i) ⇒ Object

Raises:

  • (ResponseError)


32
33
34
35
36
37
# File 'lib/traktr/activity/user.rb', line 32

def shows(username, title, actions = :all, start_ts = 0, end_ts = Time.now.to_i)
  response = self.class.get('/' + File.join('shows.json', @client.api_key, username, title, actions.to_s, start_ts.to_s, end_ts.to_s))
  raise ResponseError.new(response) if response.code != 200
 
  Mash.new(response.parsed_response)
end