Class: RedHaze::Me
Constant Summary
collapse
- FILTERS =
[:all, :tracks_affiliated, :tracks_exclusive, :own]
Instance Attribute Summary
#id
Instance Method Summary
collapse
Methods inherited from User
#comments, #favorites, #followers, #followings, #groups, #playlists
#delete_endpoint, #get_endpoint, included, #put_endpoint, #sync, #url
Constructor Details
#initialize ⇒ Me
Returns a new instance of Me.
7
8
9
10
11
12
|
# File 'lib/red_haze/me.rb', line 7
def initialize
unless RedHaze.client.access_token
raise "You cannot access this object without a client access_token"
end
sync
end
|
Instance Method Details
#activities(args = {}) ⇒ Object
14
15
16
17
18
19
20
21
|
# File 'lib/red_haze/me.rb', line 14
def activities(args = {})
filter = args.delete(:filter) || :all
raise "Bad Activities filter: #{filter}" unless FILTERS.include?(filter)
filter = filter.to_s.sub('_','/')
get_endpoint("/activities/#{filter}", query: args)
end
|
#favorite!(arg) ⇒ Object
35
36
37
|
# File 'lib/red_haze/me.rb', line 35
def favorite!(arg)
put_endpoint "/favorites/#{item_id(arg)}"
end
|
#favorite?(arg) ⇒ Boolean
43
44
45
|
# File 'lib/red_haze/me.rb', line 43
def favorite?(arg)
existence_check "/me/favorites", arg
end
|
#follow!(arg) ⇒ Object
23
24
25
|
# File 'lib/red_haze/me.rb', line 23
def follow!(arg)
put_endpoint "/followings/#{item_id(arg)}"
end
|
#follows?(arg) ⇒ Boolean
31
32
33
|
# File 'lib/red_haze/me.rb', line 31
def follows?(arg)
existence_check "/me/followings", arg
end
|
#unfavorite!(arg) ⇒ Object
39
40
41
|
# File 'lib/red_haze/me.rb', line 39
def unfavorite!(arg)
delete_endpoint "/favorites/#{item_id(arg)}"
end
|
#unfollow!(arg) ⇒ Object
27
28
29
|
# File 'lib/red_haze/me.rb', line 27
def unfollow!(arg)
delete_endpoint "/followings/#{item_id(arg)}"
end
|