class Napster::Models::Following
Following
model
Attributes
client[RW]
Public Class Methods
new(arg)
click to toggle source
# File lib/napster/models/following.rb, line 9 def initialize(arg) @client = arg[:client] if arg[:client] end
Public Instance Methods
by?(guids)
click to toggle source
# File lib/napster/models/following.rb, line 26 def by?(guids) path = "/me/following/#{guids.join(',')}" options = { headers: { Authorization: 'Bearer ' + @client.access_token, 'Content-Type' => 'application/json', 'Accept-Version' => '2.0.0' } } @client.get(path, options)['members'] end
follow(array)
click to toggle source
# File lib/napster/models/following.rb, line 38 def follow(array) body = Oj.dump('members' => array) options = { headers: { Authorization: 'Bearer ' + @client.access_token, 'Content-Type' => 'application/json', 'Accept-Version' => '2.0.0' } } @client.post('/me/following', body, options) end
members(params)
click to toggle source
# File lib/napster/models/following.rb, line 13 def members(params) options = { params: params, headers: { Authorization: 'Bearer ' + @client.access_token, 'Content-Type' => 'application/json', 'Accept-Version' => '2.0.0' } } response = @client.get('/me/following', options) Member.collection(data: response['members'], client: @client) end
unfollow(array)
click to toggle source
# File lib/napster/models/following.rb, line 50 def unfollow(array) options = { headers: { Authorization: 'Bearer ' + @client.access_token, 'Content-Type' => 'application/json', 'Accept-Version' => '2.0.0' } } @client.delete("/me/following/#{array.join(',')}", options) end