Class: Rowling::Rank
- Inherits:
-
Object
- Object
- Rowling::Rank
- Defined in:
- lib/rowling/rank.rb
Instance Attribute Summary collapse
-
#book_list_api_url ⇒ Object
Returns the value of attribute book_list_api_url.
-
#date ⇒ Object
Returns the value of attribute date.
-
#rank ⇒ Object
Returns the value of attribute rank.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(response) ⇒ Rank
constructor
A new instance of Rank.
Constructor Details
#initialize(response) ⇒ Rank
Returns a new instance of Rank.
4 5 6 7 8 |
# File 'lib/rowling/rank.rb', line 4 def initialize(response) self.date = Rowling::Rank.parse_rank_date(response["BookListDate"]) self.rank = response["Rank"] self.book_list_api_url = response["BookListDate"]["BookListAPIUrl"] end |
Instance Attribute Details
#book_list_api_url ⇒ Object
Returns the value of attribute book_list_api_url.
10 11 12 |
# File 'lib/rowling/rank.rb', line 10 def book_list_api_url @book_list_api_url end |
#date ⇒ Object
Returns the value of attribute date.
10 11 12 |
# File 'lib/rowling/rank.rb', line 10 def date @date end |
#rank ⇒ Object
Returns the value of attribute rank.
10 11 12 |
# File 'lib/rowling/rank.rb', line 10 def rank @rank end |
Class Method Details
.parse_rank_date(date_response) ⇒ Object
12 13 14 |
# File 'lib/rowling/rank.rb', line 12 def self.parse_rank_date(date_response) Date.new(date_response["Year"].to_i, date_response["Month"].to_i, date_response["Date"].to_i) end |