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

.new_from_http_request(response_hsh) ⇒ Object


8
9
10
11
12
13
14
15
# 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 { |result| ZipTax::Result.new(result) }
  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