Class: ZipTax::Response

Inherits:
OpenStruct
  • Object
show all
Defined in:
lib/zip_tax/response.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_result_from_response(result) ⇒ Object



19
20
21
# File 'lib/zip_tax/response.rb', line 19

def self.create_result_from_response(result)
  ZipTax::Result.new(result)
end

.new_from_http_request(response_hsh) ⇒ Object



8
9
10
11
12
13
14
15
16
17
# File 'lib/zip_tax/response.rb', line 8

def self.new_from_http_request(response_hsh)
  #NOTE: xml is not supported by this gem right now
  # it is supported in the API
  hsh = JSON.parse(response_hsh)
  resp = ZipTax::Response.new(hsh)
  resp.results = hsh['results'].collect do |result|
    self.create_result_from_response(result)
  end
  resp
end

Instance Method Details

#success?Boolean

Returns:

  • (Boolean)


4
5
6
# File 'lib/zip_tax/response.rb', line 4

def success?
  self.rCode && self.rCode == 100
end