module DomainListing
Public Class Methods
index(http_client, type='residential', params={})
click to toggle source
# File lib/domain_com_au/domain_listing.rb, line 6 def self.index(http_client, type='residential', params={}) url = "#{Constants::BASE_API_URL}/listings/#{type}/_search" uri = URI(url) check_response_and_return(http_client.post(uri,params)) end
show(http_client, id)
click to toggle source
# File lib/domain_com_au/domain_listing.rb, line 12 def self.show(http_client, id) url = "#{Constants::BASE_API_URL}/listings/#{id}" uri = URI(url) check_response_and_return(http_client.get(uri)) end
Private Class Methods
check_response_and_return(res)
click to toggle source
# File lib/domain_com_au/domain_listing.rb, line 20 def self.check_response_and_return(res) raise StandardError.new("domain.com.au error: res.code #{res.code}, with res.body #{res.body}") unless res.code && res.body JSON.parse(res.body) end