Class: NPR::Entity::BookEdition

Inherits:
Base
  • Object
show all
Defined in:
lib/npr/entity/book_edition.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Concern::ShallowAttributes

included

Methods included from Concern::Relation

included

Constructor Details

#initialize(json) ⇒ BookEdition


Note that the “format” property is represented on this object as “format_num”, because of Kernel’s “format”



14
15
16
17
18
19
20
21
22
23
# File 'lib/npr/entity/book_edition.rb', line 14

def initialize(json)
  @id = json["id"].to_i

  if json["format"]
    @format_num = json["format"]["$text"].to_i
  end

  extract_shallow_attributes(json)
  create_relations(json)
end

Instance Attribute Details

#format_numObject

Returns the value of attribute format_num.



7
8
9
# File 'lib/npr/entity/book_edition.rb', line 7

def format_num
  @format_num
end

#idObject

Returns the value of attribute id.



7
8
9
# File 'lib/npr/entity/book_edition.rb', line 7

def id
  @id
end