class SgPostcode::Response

Public Class Methods

new(raw_data, response_type: :json) click to toggle source
# 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

Public Instance Methods

data() click to toggle source

build the data hash may use Builder object to contruct the output data

# 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