Sha256: a52bea42c6fb98c3f134cbb080f87adb5afa4240e062cfddfe156aa783a708ab
Contents?: true
Size: 645 Bytes
Versions: 2
Compression:
Stored size: 645 Bytes
Contents
# Response data is data provided through the response body # but made accssible in the ruby world class LHC::Response::Data def initialize(response) @response = response set_dynamic_accessor_methods end def as_json response.format.as_json(response) end def as_open_struct response.format.as_open_struct(response) end def [](key) @hash ||= as_json.with_indifferent_access @hash[key] end private attr_reader :response def set_dynamic_accessor_methods as_json.keys.each do |key| define_singleton_method key do |*args| as_open_struct.send key, *args end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
lhc-3.7.0 | lib/lhc/response/data.rb |
lhc-3.7.0.pre1 | lib/lhc/response/data.rb |