Class: Napster::Me
- Inherits:
-
Object
- Object
- Napster::Me
- Defined in:
- lib/napster/me.rb
Overview
Authenticated endpoints under /me namespace
Constant Summary collapse
- MODELS_LIST =
%w(favorite playlist follower tag).freeze
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
Instance Method Summary collapse
- #following ⇒ Object
-
#initialize(client) ⇒ Me
constructor
A new instance of Me.
- #library ⇒ Object
- #listening_history(params) ⇒ Object
- #profile ⇒ Object
Constructor Details
#initialize(client) ⇒ Me
Returns a new instance of Me.
7 8 9 10 11 |
# File 'lib/napster/me.rb', line 7 def initialize(client) validate_access_token(client) @client = client set_models end |
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
5 6 7 |
# File 'lib/napster/me.rb', line 5 def client @client end |
Instance Method Details
#following ⇒ Object
35 36 37 |
# File 'lib/napster/me.rb', line 35 def following Napster::Models::Following.new(client: @client) end |
#library ⇒ Object
27 28 29 |
# File 'lib/napster/me.rb', line 27 def library Napster::Models::Library.new(client: @client) end |
#listening_history(params) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/napster/me.rb', line 13 def listening_history(params) = { params: params, headers: { Authorization: 'Bearer ' + @client.access_token, 'Content-Type' => 'application/json', 'Accept-Version' => '2.0.0' } } response = @client.get('/me/listens', ) Napster::Models::Track .collection(data: response['tracks'], client: @client) end |