Class: Oodler::Client
Instance Attribute Summary collapse
-
#http_options ⇒ Object
readonly
Returns the value of attribute http_options.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
- #company_attribute(title) ⇒ Object
- #get(path, options = {}) ⇒ Object
- #industry_attribute(title) ⇒ Object
-
#initialize(key = Oodler.key, options = {}) ⇒ Client
constructor
A new instance of Client.
- #job_title_attribute(title) ⇒ Object
- #job_type_attribute(string) ⇒ Object
-
#listing(options = {}) ⇒ Object
the generic pash a hash version example client.listing(:region=>“chicago”, :category => “vehicle/car”) returns an OodleResponse.
-
#search(region, options = {}) ⇒ Object
client.search(“chicago”, =>“vehicle/cars”).
-
#search_by_category(region, category, options = {}) ⇒ Object
helper method - client.search_by_category(“chicago”, “vehicle/car”).
-
#usa_job_search(options) ⇒ Object
specify the :location key for city search, i.e :location=>“Houston, Tx”.
- #web_client ⇒ Object
Constructor Details
#initialize(key = Oodler.key, options = {}) ⇒ Client
Returns a new instance of Client.
7 8 9 |
# File 'lib/oodler/client.rb', line 7 def initialize(key=Oodler.key,={}) @key, @http_options = key, end |
Instance Attribute Details
#http_options ⇒ Object (readonly)
Returns the value of attribute http_options.
5 6 7 |
# File 'lib/oodler/client.rb', line 5 def @http_options end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/oodler/client.rb', line 5 def key @key end |
Instance Method Details
#company_attribute(title) ⇒ Object
66 67 68 |
# File 'lib/oodler/client.rb', line 66 def company_attribute(title) "company_#{title}" end |
#get(path, options = {}) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/oodler/client.rb', line 16 def get(path, ={}) path = "/listings#{path}" validate_parameters() response = web_client.get(path, ) raise_errors(response) response.body end |
#industry_attribute(title) ⇒ Object
62 63 64 |
# File 'lib/oodler/client.rb', line 62 def industry_attribute(title) "industry_#{title}" end |
#job_title_attribute(title) ⇒ Object
58 59 60 |
# File 'lib/oodler/client.rb', line 58 def job_title_attribute(title) "job_title_#{title}" end |
#job_type_attribute(string) ⇒ Object
70 71 72 |
# File 'lib/oodler/client.rb', line 70 def job_type_attribute(string) "job_type_#{title}" end |
#listing(options = {}) ⇒ Object
the generic pash a hash version example client.listing(:region=>“chicago”, :category => “vehicle/car”) returns an OodleResponse
52 53 54 55 56 |
# File 'lib/oodler/client.rb', line 52 def listing(={}) path = "" = {:query =>} OodleResponse.from_xml(get(path, )) end |
#search(region, options = {}) ⇒ Object
client.search(“chicago”, =>“vehicle/cars”)
25 26 27 28 29 30 |
# File 'lib/oodler/client.rb', line 25 def search( region, ={}) = {:query =>} [:query].merge!({:region => region}) if region self.listing() end |
#search_by_category(region, category, options = {}) ⇒ Object
helper method - client.search_by_category(“chicago”, “vehicle/car”)
33 34 35 36 37 38 39 |
# File 'lib/oodler/client.rb', line 33 def search_by_category(region,category, ={}) = {:query =>} [:query].merge!({:region => region}) if region [:query].merge!({:category => category}) if category self.listing() end |
#usa_job_search(options) ⇒ Object
specify the :location key for city search, i.e :location=>“Houston, Tx”
42 43 44 45 46 |
# File 'lib/oodler/client.rb', line 42 def usa_job_search() .merge!({:region => "usa"}) .merge!({:category => "job"}) self.listing() end |