Module: Traktr::User::Network

Includes:
HTTParty
Defined in:
lib/traktr/user/network.rb

Class Method Summary collapse

Class Method Details

.followers(username = Traktr.username) ⇒ Object

Raises:

  • (ResponseError)


7
8
9
10
11
12
13
14
# File 'lib/traktr/user/network.rb', line 7

def self.followers(username = Traktr.username)
  response = self.get('/' + File.join('followers.json', Traktr.api_key, username))
  raise ResponseError.new(response) if response.code != 200

  response.parsed_response.collect do |item|
    Mash.new(item)
  end
end

.following(username = Traktr.username) ⇒ Object

Raises:

  • (ResponseError)


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

def self.following(username = Traktr.username)
  response = self.get('/' + File.join('following.json', Traktr.api_key, username))
  raise ResponseError.new(response) if response.code != 200

  response.parsed_response.collect do |item|
    Mash.new(item)
  end
end

.friends(username = Traktr.username) ⇒ Object

Raises:

  • (ResponseError)


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

def self.friends(username = Traktr.username)
  response = self.get('/' + File.join('friends.json', Traktr.api_key, username))
  raise ResponseError.new(response) if response.code != 200

  response.parsed_response.collect do |item|
    Mash.new(item)
  end
end