Class: LibraryItem

Inherits:
Helpers show all
Defined in:
lib/foxit/objects.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Helpers

#objects_to_hash, #to_hash

Constructor Details

#initialize(user_id, entry_result, media_result) ⇒ LibraryItem

Returns a new instance of LibraryItem.



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/foxit/objects.rb', line 8

def initialize user_id, entry_result, media_result
  @user_id = user_id.to_i
  @record_id = entry_result['id'].to_i
  @status = entry_result['attributes']['status']

  rating = entry_result['attributes']['ratingTwenty']
  @rating = rating.nil? ? nil : rating.to_i
  
  @media_id = media_result['data']['id'].to_i
  @type = media_result['data']['type']
end

Instance Attribute Details

#media_idObject (readonly)

Returns the value of attribute media_id.



6
7
8
# File 'lib/foxit/objects.rb', line 6

def media_id
  @media_id
end

#ratingObject (readonly)

Returns the value of attribute rating.



6
7
8
# File 'lib/foxit/objects.rb', line 6

def rating
  @rating
end

#record_idObject (readonly)

Returns the value of attribute record_id.



6
7
8
# File 'lib/foxit/objects.rb', line 6

def record_id
  @record_id
end

#statusObject (readonly)

Returns the value of attribute status.



6
7
8
# File 'lib/foxit/objects.rb', line 6

def status
  @status
end

#typeObject (readonly)

Returns the value of attribute type.



6
7
8
# File 'lib/foxit/objects.rb', line 6

def type
  @type
end

#user_idObject (readonly)

Returns the value of attribute user_id.



6
7
8
# File 'lib/foxit/objects.rb', line 6

def user_id
  @user_id
end