Class: NounProjectApi::Collection
Overview
A single Collection as an abstracted ruby object.
Constant Summary
collapse
- ITEM_NAME =
"collection".freeze
Instance Attribute Summary
Attributes inherited from BaseItem
#original_hash
Instance Method Summary
collapse
Methods inherited from BaseItem
#id, #initialize, #to_json
Instance Method Details
#author_id ⇒ Object
8
9
10
|
# File 'lib/noun-project-api/collection.rb', line 8
def author_id
original_hash["author_id"].to_i
end
|
#author_name ⇒ Object
12
13
14
|
# File 'lib/noun-project-api/collection.rb', line 12
def author_name
original_hash["author"]["name"]
end
|
#icon_count ⇒ Object
16
17
18
|
# File 'lib/noun-project-api/collection.rb', line 16
def icon_count
original_hash["icon_count"].to_i
end
|
#is_published? ⇒ Boolean
20
21
22
|
# File 'lib/noun-project-api/collection.rb', line 20
def is_published?
original_hash["is_published"].to_i == 1
end
|
#to_hash ⇒ Object
24
25
26
27
28
29
30
31
32
|
# File 'lib/noun-project-api/collection.rb', line 24
def to_hash
{
id: id,
author_id: author_id,
author_name: author_name,
icon_count: icon_count,
is_published: is_published?
}
end
|