Class: Hypem::User

Inherits:
Object
  • Object
show all
Includes:
Helper
Defined in:
lib/hypem/user.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Helper

included, #update_from_response

Constructor Details

#initialize(name) ⇒ User

Returns a new instance of User.

Raises:

  • (ArgumentError)


12
13
14
15
# File 'lib/hypem/user.rb', line 12

def initialize(name)
  raise ArgumentError unless name.is_a? String
  @name = name
end

Instance Attribute Details

#followed_items_countObject (readonly)

Returns the value of attribute followed_items_count.



8
9
10
# File 'lib/hypem/user.rb', line 8

def followed_items_count
  @followed_items_count
end

#followed_queries_countObject (readonly)

Returns the value of attribute followed_queries_count.



8
9
10
# File 'lib/hypem/user.rb', line 8

def followed_queries_count
  @followed_queries_count
end

#followed_sites_countObject (readonly)

Returns the value of attribute followed_sites_count.



8
9
10
# File 'lib/hypem/user.rb', line 8

def followed_sites_count
  @followed_sites_count
end

#followed_users_countObject (readonly)

Returns the value of attribute followed_users_count.



8
9
10
# File 'lib/hypem/user.rb', line 8

def followed_users_count
  @followed_users_count
end

#friendsObject (readonly)

Returns the value of attribute friends.



8
9
10
# File 'lib/hypem/user.rb', line 8

def friends
  @friends
end

#full_nameObject (readonly)

Returns the value of attribute full_name.



8
9
10
# File 'lib/hypem/user.rb', line 8

def full_name
  @full_name
end

#image_urlObject (readonly)

Returns the value of attribute image_url.



8
9
10
# File 'lib/hypem/user.rb', line 8

def image_url
  @image_url
end

#joined_atObject (readonly)

Returns the value of attribute joined_at.



8
9
10
# File 'lib/hypem/user.rb', line 8

def joined_at
  @joined_at
end

#locationObject (readonly)

Returns the value of attribute location.



8
9
10
# File 'lib/hypem/user.rb', line 8

def location
  @location
end

#nameObject (readonly)

Returns the value of attribute name.



8
9
10
# File 'lib/hypem/user.rb', line 8

def name
  @name
end

#twitter_usernameObject (readonly)

Returns the value of attribute twitter_username.



8
9
10
# File 'lib/hypem/user.rb', line 8

def twitter_username
  @twitter_username
end

Instance Method Details

#favorite_blogsObject



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

def favorite_blogs
  response = get_resource('/get_favorite_blogs')

  response.map do |r|
    blog = Hypem::Blog.new(r['siteid'])
    blog.update_from_response(r)
    blog
  end
end

#feed_playlist(page = 1) ⇒ Object



54
55
56
# File 'lib/hypem/user.rb', line 54

def feed_playlist(page=1)
  @f_p ||= Playlist.feed(@name,page)
end

#friends_favorites_playlist(page = 1) ⇒ Object



58
59
60
# File 'lib/hypem/user.rb', line 58

def friends_favorites_playlist(page=1)
  @f_f_p ||= Playlist.friends_favorites(@name,page)
end

#friends_history_playlist(page = 1) ⇒ Object



62
63
64
# File 'lib/hypem/user.rb', line 62

def friends_history_playlist(page=1)
  @f_h_p ||= Playlist.friends_history(@name,page)
end

#get_profileObject



17
18
19
20
21
22
# File 'lib/hypem/user.rb', line 17

def get_profile
  response = get_resource('/get_profile')
  flattened_response = flatten_response(response)
  update_from_response(flattened_response)
  self
end

#loved_playlist(page = 1) ⇒ Object

playlist requests



46
47
48
# File 'lib/hypem/user.rb', line 46

def loved_playlist(page=1)
  @l_p ||= Playlist.loved(@name,page)
end

#obsessed_playlist(page = 1) ⇒ Object



50
51
52
# File 'lib/hypem/user.rb', line 50

def obsessed_playlist(page=1)
  @o_p ||= Playlist.obsessed(@name,page)
end