Class: SgPostcode::Response
- Inherits:
-
Object
- Object
- SgPostcode::Response
- Defined in:
- lib/sg_postcode/response/response.rb
Instance Method Summary collapse
-
#data ⇒ Object
build the data hash may use Builder object to contruct the output data.
-
#initialize(raw_data, response_type: :json) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(raw_data, response_type: :json) ⇒ Response
Returns a new instance of Response.
5 6 7 8 |
# File 'lib/sg_postcode/response/response.rb', line 5 def initialize(raw_data, response_type: :json) @raw_data = JSON.parse(raw_data) @response_type = response_type end |
Instance Method Details
#data ⇒ Object
build the data hash may use Builder object to contruct the output data
13 14 15 16 17 18 19 20 |
# File 'lib/sg_postcode/response/response.rb', line 13 def data case @response_type when :json ResponseBuilder::JsonOutput.new(@raw_data).data else nil end end |