Class: LHC::Response::Data::Item

Inherits:
OpenStruct
  • Object
show all
Includes:
Base
Defined in:
lib/lhc/response/data/item.rb

Instance Method Summary collapse

Methods included from Base

#as_json, #as_open_struct

Constructor Details

#initialize(response, data: nil) ⇒ Item

Returns a new instance of Item.


6
7
8
9
10
11
12
13
# File 'lib/lhc/response/data/item.rb', line 6

def initialize(response, data: nil)
  @response = response
  @data = data

  set_dynamic_accessor_methods

  super(as_json)
end

Instance Method Details

#[](key) ⇒ Object


15
16
17
18
# File 'lib/lhc/response/data/item.rb', line 15

def [](key)
  @hash ||= as_json.with_indifferent_access
  @hash[key]
end