Class: Cb::Models::SavedSearch

Inherits:
Object
  • Object
show all
Defined in:
lib/cb/models/implementations/saved_search.rb

Defined Under Namespace

Classes: Delete, SearchParameters

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ SavedSearch

Returns a new instance of SavedSearch.



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/cb/models/implementations/saved_search.rb', line 21

def initialize(args = {})
  @host_site                  = args['HostSite'] || args[:host_site] || ''
  @cobrand                    = args['Cobrand'] || args[:cobrand] || ''
  @search_name                = args['SearchName'] || args[:search_name] || ''
  @site_id                    = args['SiteId'] || args[:site_id] || ''
  @is_daily_email             = args['IsDailyEmail'] || args[:is_daily_email] || false
  @email_delivery_day         = args['EmailDeliveryDay'] || args[:email_delivery_day] || ''
  @job_search_url             = args['JobSearchUrl'] || args[:job_search_url] || ''
  @external_id                = args['ExternalID'] || args[:external_id] || ''
  @external_user_id           = args['ExternalUserID'] || args[:external_user_id] || ''
  @browser_id                 = args['BrowserID'] || args[:browser_id] || nil
  @session_id                 = args['SessionID'] || args[:session_id] || ''
  @email_address              = args['EmailAddress'] || args[:email_address] || ''
  @did                        = args['DID'] || args[:did] || ''
  @user_oauth_token           = args['userOAuthToken'] || args[:user_oauth_token] || ''
  @search_parameters          = SearchParameters.new(args['SavedSearchParameters'] || {})
end

Instance Attribute Details

#boolean_operatorObject

Returns the value of attribute boolean_operator.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def boolean_operator
  @boolean_operator
end

#browser_idObject

Returns the value of attribute browser_id.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def browser_id
  @browser_id
end

#categoryObject

Returns the value of attribute category.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def category
  @category
end

#cityObject

Returns the value of attribute city.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def city
  @city
end

#cobrandObject

Returns the value of attribute cobrand.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def cobrand
  @cobrand
end

#companyObject

Returns the value of attribute company.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def company
  @company
end

#countryObject

Returns the value of attribute country.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def country
  @country
end

#didObject

Returns the value of attribute did.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def did
  @did
end

#education_codeObject

Returns the value of attribute education_code.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def education_code
  @education_code
end

#email_addressObject

Returns the value of attribute email_address.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def email_address
  @email_address
end

#email_delivery_dayObject

Returns the value of attribute email_delivery_day.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def email_delivery_day
  @email_delivery_day
end

#emp_typeObject

Returns the value of attribute emp_type.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def emp_type
  @emp_type
end

#errorsObject

Returns the value of attribute errors.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def errors
  @errors
end

#exclude_company_namesObject

Returns the value of attribute exclude_company_names.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def exclude_company_names
  @exclude_company_names
end

#exclude_job_titlesObject

Returns the value of attribute exclude_job_titles.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def exclude_job_titles
  @exclude_job_titles
end

#exclude_nationalObject

Returns the value of attribute exclude_national.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def exclude_national
  @exclude_national
end

#external_idObject

Returns the value of attribute external_id.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def external_id
  @external_id
end

#external_user_idObject

Returns the value of attribute external_user_id.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def external_user_id
  @external_user_id
end

#host_siteObject

Returns the value of attribute host_site.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def host_site
  @host_site
end

#industry_codesObject

Returns the value of attribute industry_codes.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def industry_codes
  @industry_codes
end

#is_daily_emailObject

Returns the value of attribute is_daily_email.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def is_daily_email
  @is_daily_email
end

#job_categoryObject

Returns the value of attribute job_category.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def job_category
  @job_category
end

#job_search_urlObject

Returns the value of attribute job_search_url.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def job_search_url
  @job_search_url
end

#jrdidObject

Returns the value of attribute jrdid.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def jrdid
  @jrdid
end

#keywordsObject

Returns the value of attribute keywords.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def keywords
  @keywords
end

#locationObject

Returns the value of attribute location.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def location
  @location
end

#order_byObject

Returns the value of attribute order_by.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def order_by
  @order_by
end

#order_directionObject

Returns the value of attribute order_direction.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def order_direction
  @order_direction
end

#pay_highObject

Returns the value of attribute pay_high.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def pay_high
  @pay_high
end

#pay_info_onlyObject

Returns the value of attribute pay_info_only.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def pay_info_only
  @pay_info_only
end

#pay_lowObject

Returns the value of attribute pay_low.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def pay_low
  @pay_low
end

#posted_withinObject

Returns the value of attribute posted_within.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def posted_within
  @posted_within
end

#radiusObject

Returns the value of attribute radius.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def radius
  @radius
end

#search_nameObject

Returns the value of attribute search_name.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def search_name
  @search_name
end

#search_parametersObject

Returns the value of attribute search_parameters.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def search_parameters
  @search_parameters
end

#session_idObject

Returns the value of attribute session_id.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def session_id
  @session_id
end

#site_idObject

Returns the value of attribute site_id.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def site_id
  @site_id
end

#specific_educationObject

Returns the value of attribute specific_education.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def specific_education
  @specific_education
end

#stateObject

Returns the value of attribute state.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def state
  @state
end

#testObject

Returns the value of attribute test.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def test
  @test
end

#user_oauth_tokenObject

Returns the value of attribute user_oauth_token.



14
15
16
# File 'lib/cb/models/implementations/saved_search.rb', line 14

def user_oauth_token
  @user_oauth_token
end

Instance Method Details

#create_anon_to_xmlObject



53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
# File 'lib/cb/models/implementations/saved_search.rb', line 53

def create_anon_to_xml
  <<-eos
    <Request>
      <HostSite>#{host_site}</HostSite>
      <Cobrand>#{cobrand}</Cobrand>
      <BrowserID>#{browser_id}</BrowserID>
      <SessionID>#{session_id}</SessionID>
      <Test>false</Test>
      <EmailAddress>#{email_address}</EmailAddress>
      <SearchName>#{search_name}</SearchName>
      #{search_parameters.to_xml}
      <IsDailyEmail>#{is_daily_email.to_s.upcase}</IsDailyEmail>
      <DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>
    </Request>
  eos
end

#create_to_xmlObject



39
40
41
42
43
44
45
46
47
48
49
50
51
# File 'lib/cb/models/implementations/saved_search.rb', line 39

def create_to_xml
  <<-eos
    <Request>
      <HostSite>#{host_site}</HostSite>
      <Cobrand>#{cobrand}</Cobrand>
      <SearchName>#{search_name}</SearchName>
      #{search_parameters.to_xml}
      <IsDailyEmail>#{is_daily_email.to_s.upcase}</IsDailyEmail>
      <ExternalUserID>#{external_user_id}</ExternalUserID>
      <DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>
    </Request>
  eos
end

#delete_anon_to_xmlObject



85
86
87
88
89
90
91
92
93
# File 'lib/cb/models/implementations/saved_search.rb', line 85

def delete_anon_to_xml
  <<-eos
    <Request>
      <ExternalID>#{external_id}</ExternalID>
      <DeveloperKey>#{Cb.configuration.dev_key}</DeveloperKey>
      <Test>false</Test>
    </Request>
  eos
end

#update_to_jsonObject



70
71
72
73
74
75
76
77
78
79
80
81
82
83
# File 'lib/cb/models/implementations/saved_search.rb', line 70

def update_to_json
  hash = {
    'DID' => did,
    'SearchName' => search_name,
    'HostSite' => host_site,
    'SiteID' => site_id,
    'Cobrand' => cobrand,
    'IsDailyEmail' => is_daily_email,
    'userOAuthToken' => user_oauth_token,
    'SavedSearchParameters' => search_parameters.to_hash
  }
  hash['EmailDeliveryDay'] = email_delivery_day unless is_daily_email
  hash.to_json
end