Class: Zester::Resource

Inherits:
Object
  • Object
show all
Defined in:
lib/zester/resource.rb

Direct Known Subclasses

Mortgage, Neighborhood, Property, Valuation

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resource

Returns a new instance of Resource.



6
7
8
# File 'lib/zester/resource.rb', line 6

def initialize(client)
  self.client = client
end

Instance Attribute Details

#clientObject

Returns the value of attribute client.



4
5
6
# File 'lib/zester/resource.rb', line 4

def client
  @client
end

Instance Method Details

#get_results(endpoint, resource_type, params = {}) ⇒ Object



10
11
12
13
14
15
16
# File 'lib/zester/resource.rb', line 10

def get_results(endpoint, resource_type, params = {})
  begin
    Response.new(self.client.perform_get(endpoint, params), resource_type)
  rescue Timeout::Error, Exception
    Response.new({resource_type => {:message => {:code => "3", :text => "Web services are currently unavailable"}}}, resource_type)
  end
end