Class: Napster::Models::LibraryDateTime

Inherits:
Object
  • Object
show all
Defined in:
lib/napster/models/library_date_time.rb

Overview

LibraryDateTime model Only used for /me/library/updated

Constant Summary collapse

ATTRIBUTES =
[:date,
:time_zone,
:time_in_millis].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg) ⇒ LibraryDateTime

Returns a new instance of LibraryDateTime.



18
19
20
21
22
23
24
# File 'lib/napster/models/library_date_time.rb', line 18

def initialize(arg)
  @client = arg[:client] if arg[:client]
  return unless arg[:data]
  ATTRIBUTES.each do |attribute|
    send("#{attribute}=", arg[:data][attribute.to_s.camel_case_lower])
  end
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



16
17
18
# File 'lib/napster/models/library_date_time.rb', line 16

def client
  @client
end

Class Method Details

.collection(arg) ⇒ Object



26
27
28
29
30
# File 'lib/napster/models/library_date_time.rb', line 26

def self.collection(arg)
  arg[:data].map do |library_date_time|
    LibraryDateTime.new(data: library_date_time, client: @client)
  end
end