Module: Traktr::User::Network

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

Instance Method Summary collapse

Instance Method Details

#followers(username = @client.username) ⇒ Object

Raises:

  • (ResponseError)


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

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

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

#following(username = @client.username) ⇒ Object

Raises:

  • (ResponseError)


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

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

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

#friends(username = @client.username) ⇒ Object

Raises:

  • (ResponseError)


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

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

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