Class: DMM::Response::Result
- Inherits:
-
Object
- Object
- DMM::Response::Result
- Defined in:
- lib/ruby-dmm/response.rb
Constant Summary collapse
- RESULT_KEYS =
[:result_count, :total_count, :first_position, :items]
Instance Method Summary collapse
-
#initialize(result) ⇒ Result
constructor
A new instance of Result.
Constructor Details
#initialize(result) ⇒ Result
Returns a new instance of Result.
17 18 19 20 21 22 23 24 25 |
# File 'lib/ruby-dmm/response.rb', line 17 def initialize(result) (RESULT_KEYS - [:items]).each do |key| instance_variable_set("@#{key}", result[key].to_i) end @items = [result[:items][:item]].flatten.map do |item| DMM::Response::Item.new(item) end end |