cb-api 0.1.11 → 0.1.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/cb.rb CHANGED
@@ -1,10 +1,3 @@
1
- module Cb
2
- module Utils
3
- module FluidAttributes
4
- end
5
- end
6
- end
7
-
8
1
  require 'cb/config'
9
2
  Dir[File.dirname(__FILE__) + '/cb/utils/*.rb'].each {| file| require file }
10
3
  Dir[File.dirname(__FILE__) + '/cb/clients/*.rb'].each {| file| require file }
@@ -1,17 +1,18 @@
1
- module Cb::Branding
1
+ module Cb
2
+ module Branding
2
3
 
3
- class Media
4
+ class Media
4
5
 
5
- attr_accessor :header, :header_type, :tablet_banner, :mobile_logo, :footer
6
+ attr_accessor :header, :header_type, :tablet_banner, :mobile_logo, :footer
6
7
 
7
- def initialize args = {}
8
- @header = args['Header'] || ''
9
- @header_type = args['HeaderType'] || ''
10
- @tablet_banner = args['TabletBanner'] || ''
11
- @mobile_logo = args['MobileLogo'] || ''
12
- @footer = args['Footer'] || ''
13
- end
8
+ def initialize args = {}
9
+ @header = args['Header'] || ''
10
+ @header_type = args['HeaderType'] || ''
11
+ @tablet_banner = args['TabletBanner'] || ''
12
+ @mobile_logo = args['MobileLogo'] || ''
13
+ @footer = args['Footer'] || ''
14
+ end
14
15
 
16
+ end
15
17
  end
16
-
17
18
  end
@@ -1,20 +1,22 @@
1
- module Cb::Branding
1
+ module Cb
2
+ module Branding
2
3
 
3
- class Section
4
- # Might be changing?
5
- attr_accessor :type, :section_1, :section_2, :section_3, :description, :requirements, :snapshot
4
+ class Section
5
+ # Might be changing?
6
+ attr_accessor :type, :section_1, :section_2, :section_3, :description, :requirements, :snapshot
6
7
 
7
- def initialize type, args = {}
8
- @type = type
8
+ def initialize type, args = {}
9
+ @type = type
9
10
 
10
- @section_1 = args['Section1'] || ''
11
- @section_2 = args['Section2'] || ''
12
- @section_3 = args['Section3'] || ''
13
- @description = args['Description'] || ''
14
- @requirements = args['Requirements'] || ''
15
- @snapshot = args['Snapshot'] || ''
16
- end
11
+ @section_1 = args['Section1'] || ''
12
+ @section_2 = args['Section2'] || ''
13
+ @section_3 = args['Section3'] || ''
14
+ @description = args['Description'] || ''
15
+ @requirements = args['Requirements'] || ''
16
+ @snapshot = args['Snapshot'] || ''
17
+ end
17
18
 
18
- end
19
+ end
20
+ end
19
21
 
20
22
  end
@@ -1,15 +1,17 @@
1
- module Cb::Branding
1
+ module Cb
2
+ module Branding
2
3
 
3
- class Style
4
+ class Style
4
5
 
5
- attr_accessor :page, :job_details, :company_info
6
+ attr_accessor :page, :job_details, :company_info
6
7
 
7
- def initialize args = {}
8
- @page = Cb::Branding::Styles::Page.new args['Page']
9
- @job_details = Cb::Branding::Styles::JobDetails.new args['JobDetails']
10
- @company_info = Cb::Branding::Styles::CompanyInfo.new args['CompanyInfo']
11
- end
8
+ def initialize args = {}
9
+ @page = Cb::Branding::Styles::Page.new args['Page']
10
+ @job_details = Cb::Branding::Styles::JobDetails.new args['JobDetails']
11
+ @company_info = Cb::Branding::Styles::CompanyInfo.new args['CompanyInfo']
12
+ end
12
13
 
13
- end
14
-
14
+ end
15
+
16
+ end
15
17
  end
@@ -1,15 +1,19 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class Base
4
- attr_writer :styles
5
+ class Base
6
+ attr_writer :styles
5
7
 
6
- def initialize args = {}
7
- @styles = args
8
- end
8
+ def initialize args = {}
9
+ @styles = args
10
+ end
9
11
 
10
- def raw
11
- @styles
12
- end
13
- end
12
+ def raw
13
+ @styles
14
+ end
15
+ end
16
+ end
17
+ end
14
18
 
15
19
  end
@@ -1,8 +1,12 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class Buttons < Base
4
- include Cb::Branding::Styles::CssAdapter
5
+ class Buttons < Base
6
+ include Cb::Branding::Styles::CssAdapter
5
7
 
6
- end
8
+ end
9
+ end
10
+ end
7
11
 
8
12
  end
@@ -1,16 +1,19 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class CompanyInfo < Base
4
- attr_accessor :buttons, :container, :content, :headings
5
+ class CompanyInfo < Base
6
+ attr_accessor :buttons, :container, :content, :headings
5
7
 
6
- def initialize args = {}
7
- super
8
-
9
- @buttons = Buttons.new args
10
- @container = Container.new args
11
- @content = Content.new args
12
- @headings = Headings.new args
13
- end
14
- end
8
+ def initialize args = {}
9
+ super
15
10
 
11
+ @buttons = Buttons.new args
12
+ @container = Container.new args
13
+ @content = Content.new args
14
+ @headings = Headings.new args
15
+ end
16
+ end
17
+ end
18
+ end
16
19
  end
@@ -1,8 +1,12 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class Container < Base
4
- include CssAdapter
5
+ class Container < Base
6
+ include CssAdapter
5
7
 
6
- end
8
+ end
7
9
 
8
- end
10
+ end
11
+ end
12
+ end
@@ -1,8 +1,11 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class Content < Base
4
- include CssAdapter
5
-
6
- end
5
+ class Content < Base
6
+ include CssAdapter
7
7
 
8
+ end
9
+ end
10
+ end
8
11
  end
@@ -1,48 +1,49 @@
1
- module Cb::Branding
2
-
3
- module Styles
4
-
5
- module CssAdapter
6
-
7
- def to_css
8
- css = ''
9
-
10
- @styles.each do |style, value|
11
- css += generate_style style, value
12
- end
13
-
14
- css
15
- end
16
-
17
- private
18
- def generate_style style, value
19
- {
20
- 'BackgroundColor' => "background-color: #{value};",
21
- 'BackgroundImage' => "background-image: url(#{value});",
22
- 'BackgroundGradient' => "background: #{value['Color1']};
23
- background: -moz-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%, #{value['Color2']} 100%);
24
- background: -webkit-gradient(linear, left top, #{value['Orientation'] == 'Vertical' ? 'left bottom' : 'right top'}, color-stop(0%,#{value['Color1']}), color-stop(100%,#{value['Color2']}));
25
- background: -webkit-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
26
- background: -o-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
27
- background: -ms-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
28
- background: linear-gradient(to #{value['Orientation'] == 'Vertical' ? 'bottom' : 'right'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
29
- filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{value['Color1']}', endColorstr='#{value['Color2']}',GradientType=#{value['Orientation'] == 'Vertical' ? '0' : '1'} );",
30
- 'BorderSize' => "border-width: #{value};",
31
- 'BorderColor' => "border-color: #{value};",
32
- 'BorderRadius' => "-webkit-border-radius: #{value};
33
- -moz-border-radius: #{value};
34
- border-radius: #{value};",
35
- 'BoxShadow' => "-webkit-box-shadow: #{value};
36
- -moz-box-shadow: #{value};
37
- box-shadow: #{value};",
38
- 'FontColor' => "color: #{value};",
39
- 'FontSize' => "font-size: #{value};",
40
- 'FontStyle' => "font-family: #{value};"
41
- }[style].gsub(/\s+/, '')
42
- end
43
-
44
- end
45
-
46
- end
47
-
1
+ module Cb
2
+ module Branding
3
+
4
+ module Styles
5
+
6
+ module CssAdapter
7
+
8
+ def to_css
9
+ css = ''
10
+
11
+ @styles.each do |style, value|
12
+ css += generate_style style, value
13
+ end
14
+
15
+ css
16
+ end
17
+
18
+ private
19
+ def generate_style style, value
20
+ {
21
+ 'BackgroundColor' => "background-color: #{value};",
22
+ 'BackgroundImage' => "background-image: url(#{value});",
23
+ 'BackgroundGradient' => "background: #{value['Color1']};
24
+ background: -moz-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%, #{value['Color2']} 100%);
25
+ background: -webkit-gradient(linear, left top, #{value['Orientation'] == 'Vertical' ? 'left bottom' : 'right top'}, color-stop(0%,#{value['Color1']}), color-stop(100%,#{value['Color2']}));
26
+ background: -webkit-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
27
+ background: -o-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
28
+ background: -ms-linear-gradient(#{value['Orientation'] == 'Vertical' ? 'top' : 'left'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
29
+ background: linear-gradient(to #{value['Orientation'] == 'Vertical' ? 'bottom' : 'right'}, #{value['Color1']} 0%,#{value['Color2']} 100%);
30
+ filter: progid:DXImageTransform.Microsoft.gradient( startColorstr='#{value['Color1']}', endColorstr='#{value['Color2']}',GradientType=#{value['Orientation'] == 'Vertical' ? '0' : '1'} );",
31
+ 'BorderSize' => "border-width: #{value};",
32
+ 'BorderColor' => "border-color: #{value};",
33
+ 'BorderRadius' => "-webkit-border-radius: #{value};
34
+ -moz-border-radius: #{value};
35
+ border-radius: #{value};",
36
+ 'BoxShadow' => "-webkit-box-shadow: #{value};
37
+ -moz-box-shadow: #{value};
38
+ box-shadow: #{value};",
39
+ 'FontColor' => "color: #{value};",
40
+ 'FontSize' => "font-size: #{value};",
41
+ 'FontStyle' => "font-family: #{value};"
42
+ }[style].gsub(/\s+/, '')
43
+ end
44
+
45
+ end
46
+
47
+ end
48
+ end
48
49
  end
@@ -1,8 +1,11 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class Headings < Base
4
- include CssAdapter
5
-
6
- end
5
+ class Headings < Base
6
+ include CssAdapter
7
7
 
8
+ end
9
+ end
10
+ end
8
11
  end
@@ -1,16 +1,19 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class JobDetails < Base
4
- attr_accessor :container, :content, :headings
5
+ class JobDetails < Base
6
+ attr_accessor :container, :content, :headings
5
7
 
6
- def initialize args = {}
7
- super
8
+ def initialize args = {}
9
+ super
8
10
 
9
- @container = Container.new args
10
- @content = Content.new args
11
- @headings = Headings.new args
12
- end
13
-
14
- end
11
+ @container = Container.new args
12
+ @content = Content.new args
13
+ @headings = Headings.new args
14
+ end
15
15
 
16
+ end
17
+ end
18
+ end
16
19
  end
@@ -1,8 +1,11 @@
1
- module Cb::Branding::Styles
1
+ module Cb
2
+ module Branding
3
+ module Styles
2
4
 
3
- class Page < Base
4
- include CssAdapter
5
+ class Page < Base
6
+ include CssAdapter
5
7
 
6
- end
7
-
8
+ end
9
+ end
10
+ end
8
11
  end
@@ -1,13 +1,14 @@
1
- module Cb::Branding
1
+ module Cb
2
+ module Branding
2
3
 
3
- class Widget
4
- attr_accessor :type, :url
4
+ class Widget
5
+ attr_accessor :type, :url
5
6
 
6
- def initialize type, url
7
- @type = type
8
- @url = url
9
- end
10
-
11
- end
7
+ def initialize type, url
8
+ @type = type
9
+ @url = url
10
+ end
12
11
 
12
+ end
13
+ end
13
14
  end
@@ -0,0 +1,101 @@
1
+ require 'httparty'
2
+
3
+ module Cb
4
+ module Utils
5
+ class Api
6
+ include HTTParty
7
+ base_uri 'http://api.careerbuilder.com'
8
+
9
+ def initialize
10
+ self.class.debug_output $stderr if Cb.configuration.debug_api
11
+ self.class.default_params :developerkey => Cb.configuration.dev_key,
12
+ :outputjson => Cb.configuration.use_json.to_s
13
+
14
+ self.class.default_timeout Cb.configuration.time_out
15
+ end
16
+
17
+ def cb_get(*args, &block)
18
+ self.class.base_uri 'http://api.careerbuilder.com'
19
+ self.class.get(*args, &block)
20
+ end
21
+
22
+ def cb_post(*args, &block)
23
+ self.class.base_uri 'https://api.careerbuilder.com'
24
+ self.class.post(*args, &block)
25
+ end
26
+
27
+ def append_api_responses(obj, resp)
28
+ if obj.respond_to?('cb_response')
29
+ meta_class = obj.cb_response
30
+ else
31
+ meta_class = Cb::Utils::MetaValues.new()
32
+ end
33
+
34
+ resp.each do | api_key, api_value |
35
+ meta_name = get_meta_name_for api_key
36
+
37
+ unless meta_name.empty?
38
+ if meta_name == 'errors' && api_value.is_a?(Hash)
39
+ api_value = api_value.values
40
+ elsif self.class.is_numeric?(api_value)
41
+ api_value = api_value.to_i
42
+ end
43
+
44
+ meta_class.class.send(:attr_reader, meta_name)
45
+ meta_class.instance_variable_set(:"@#{meta_name}", api_value)
46
+ end
47
+ end
48
+
49
+ obj.class.send(:attr_reader, 'cb_response')
50
+ obj.instance_variable_set(:@cb_response, meta_class)
51
+ end
52
+
53
+ def self.criteria_to_hash(criteria)
54
+ params = Hash.new
55
+ if criteria.respond_to?(:instance_variables)
56
+ criteria.instance_variables.each do |var|
57
+ var_name = var.to_s
58
+ var_name.slice!(0)
59
+ var_name_hash_safe = camelize(var_name)
60
+ params["#{var_name_hash_safe}"] = criteria.instance_variable_get(var)
61
+ end
62
+ end
63
+ return params
64
+ end
65
+
66
+ def self.is_numeric?(obj)
67
+ true if Float(obj) rescue false
68
+ end
69
+
70
+ private
71
+ #############################################################################
72
+ def self.camelize(input)
73
+ input.sub!(/^[a-z\d]*/) { $&.capitalize }
74
+ input.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$2.capitalize}" }.gsub('/', '::')
75
+ end
76
+
77
+ def get_meta_name_for(api_key)
78
+ key_map = {
79
+ 'Errors' => 'errors',
80
+ 'TimeResponseSent' => 'time_sent',
81
+ 'TimeElapsed' => 'time_elapsed',
82
+ 'TotalPages' => 'total_pages',
83
+ 'TotalCount' => 'total_count',
84
+ 'FirstItemIndex' => 'first_item_index',
85
+ 'LastItemIndex' => 'last_item_index',
86
+ 'CountryCode' => 'country_code',
87
+ 'DeveloperKey' => 'developer_key',
88
+ 'SiteID' => 'site_id',
89
+ 'CoBrand' => 'co_brand',
90
+ 'CountLimit' => 'count_limit',
91
+ 'MinQualityLimit' => 'min_quality',
92
+ 'RecommendationsAvailable' => 'recs_available',
93
+ 'ApplicationStatus' => 'application_status',
94
+ 'Status' => 'status'
95
+ }
96
+
97
+ key_map["#{api_key}"] ||= ''
98
+ end
99
+ end
100
+ end
101
+ end
@@ -0,0 +1,26 @@
1
+ module Cb
2
+ module Utils
3
+ class Country
4
+ # These aren't all country codes. We get it. Our naming scheme didn't hold up over time.
5
+ def self.get_supported
6
+ %w(AH BE CA CC CE CH CN CP CS CY DE DK E1 ER ES EU F1
7
+ FR GC GR I1 IE IN IT J1 JC JS LJ M1 MY NL NO PD PI
8
+ PL RM RO RX S1 SE SF SG T1 T2 UK US WH WM WR)
9
+ end
10
+
11
+ def self.is_valid?(country)
12
+ get_supported.include? country
13
+ end
14
+
15
+ def self.inject_convenience_methods
16
+ get_supported.each do |country|
17
+ unless self.respond_to? "#{country}"
18
+ self.define_singleton_method "#{country}" do
19
+ return country
20
+ end
21
+ end
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
@@ -0,0 +1,28 @@
1
+ module Cb
2
+ module Utils
3
+ module FluidAttributes
4
+
5
+ def fluid_attr_accessor(*names)
6
+ names.each do |name|
7
+
8
+ define_method :"#{name}" do |*args|
9
+ return instance_variable_get(:"@#{name}") if args.length == 0
10
+
11
+ if args.length == 1
12
+ instance_variable_set(:"@#{name}", args[0])
13
+ return self
14
+ end
15
+
16
+ raise ArgumentError.new("Wrong number of arguments (#{args.length} for 1)")
17
+ end
18
+
19
+ define_method :"#{name}=" do |*args|
20
+ instance_variable_set(:"@#{name}", args[0]) if args.length == 1
21
+ return self
22
+ raise ArgumentError, "Wrong number of arguments (#{args.length} for 1)"
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,15 @@
1
+ module Cb
2
+ module Utils
3
+ class MetaValues
4
+ # This class will be dynamically constructed at run time.
5
+ # I don't want values that don't make sense to the API call you made to be accessible
6
+ # I'm not dynamically creating the class because we may want to add functionality at some point
7
+
8
+ # This class, with its dynamically created attr_accr's will be dynamically appended to api
9
+ # entities, like job and company. It will contain things like errors, time elapsed, and
10
+ # any other meta values that the API may return.
11
+
12
+ # The mapping for allowed values, and what they translate to on this object live in Cb::utils::Api
13
+ end
14
+ end
15
+ end
File without changes
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '0.1.11'
2
+ VERSION = '0.1.12'
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cb-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.11
4
+ version: 0.1.12
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -15,7 +15,7 @@ authors:
15
15
  autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
- date: 2013-07-09 00:00:00.000000000 Z
18
+ date: 2013-07-10 00:00:00.000000000 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: httparty
@@ -113,11 +113,11 @@ files:
113
113
  - lib/cb/models/cb_job.rb
114
114
  - lib/cb/models/cb_job_branding.rb
115
115
  - lib/cb/models/cb_user.rb
116
- - lib/cb/Utils/api.rb
117
- - lib/cb/Utils/country.rb
118
- - lib/cb/Utils/fluid_attributes.rb
119
- - lib/cb/Utils/meta_values.rb
120
- - lib/cb/Utils/string.rb
116
+ - lib/cb/utils/api.rb
117
+ - lib/cb/utils/country.rb
118
+ - lib/cb/utils/fluid_attributes.rb
119
+ - lib/cb/utils/meta_values.rb
120
+ - lib/cb/utils/string.rb
121
121
  - lib/cb/version.rb
122
122
  - lib/cb.rb
123
123
  - README.md
@@ -1,99 +0,0 @@
1
- require 'httparty'
2
-
3
- module Cb::Utils
4
- class Api
5
- include HTTParty
6
- base_uri 'http://api.careerbuilder.com'
7
-
8
- def initialize
9
- self.class.debug_output $stderr if Cb.configuration.debug_api
10
- self.class.default_params :developerkey => Cb.configuration.dev_key,
11
- :outputjson => Cb.configuration.use_json.to_s
12
-
13
- self.class.default_timeout Cb.configuration.time_out
14
- end
15
-
16
- def cb_get(*args, &block)
17
- self.class.base_uri 'http://api.careerbuilder.com'
18
- self.class.get(*args, &block)
19
- end
20
-
21
- def cb_post(*args, &block)
22
- self.class.base_uri 'https://api.careerbuilder.com'
23
- self.class.post(*args, &block)
24
- end
25
-
26
- def append_api_responses(obj, resp)
27
- if obj.respond_to?('cb_response')
28
- meta_class = obj.cb_response
29
- else
30
- meta_class = Cb::Utils::MetaValues.new()
31
- end
32
-
33
- resp.each do | api_key, api_value |
34
- meta_name = get_meta_name_for api_key
35
-
36
- unless meta_name.empty?
37
- if meta_name == 'errors' && api_value.is_a?(Hash)
38
- api_value = api_value.values
39
- elsif self.class.is_numeric?(api_value)
40
- api_value = api_value.to_i
41
- end
42
-
43
- meta_class.class.send(:attr_reader, meta_name)
44
- meta_class.instance_variable_set(:"@#{meta_name}", api_value)
45
- end
46
- end
47
-
48
- obj.class.send(:attr_reader, 'cb_response')
49
- obj.instance_variable_set(:@cb_response, meta_class)
50
- end
51
-
52
- def self.criteria_to_hash(criteria)
53
- params = Hash.new
54
- if criteria.respond_to?(:instance_variables)
55
- criteria.instance_variables.each do |var|
56
- var_name = var.to_s
57
- var_name.slice!(0)
58
- var_name_hash_safe = camelize(var_name)
59
- params["#{var_name_hash_safe}"] = criteria.instance_variable_get(var)
60
- end
61
- end
62
- return params
63
- end
64
-
65
- def self.is_numeric?(obj)
66
- true if Float(obj) rescue false
67
- end
68
-
69
- private
70
- #############################################################################
71
- def self.camelize(input)
72
- input.sub!(/^[a-z\d]*/) { $&.capitalize }
73
- input.gsub(/(?:_|(\/))([a-z\d]*)/) { "#{$2.capitalize}" }.gsub('/', '::')
74
- end
75
-
76
- def get_meta_name_for(api_key)
77
- key_map = {
78
- 'Errors' => 'errors',
79
- 'TimeResponseSent' => 'time_sent',
80
- 'TimeElapsed' => 'time_elapsed',
81
- 'TotalPages' => 'total_pages',
82
- 'TotalCount' => 'total_count',
83
- 'FirstItemIndex' => 'first_item_index',
84
- 'LastItemIndex' => 'last_item_index',
85
- 'CountryCode' => 'country_code',
86
- 'DeveloperKey' => 'developer_key',
87
- 'SiteID' => 'site_id',
88
- 'CoBrand' => 'co_brand',
89
- 'CountLimit' => 'count_limit',
90
- 'MinQualityLimit' => 'min_quality',
91
- 'RecommendationsAvailable' => 'recs_available',
92
- 'ApplicationStatus' => 'application_status',
93
- 'Status' => 'status'
94
- }
95
-
96
- key_map["#{api_key}"] ||= ''
97
- end
98
- end
99
- end
@@ -1,24 +0,0 @@
1
- module Cb::Utils
2
- class Country
3
- # These aren't all country codes. We get it. Our naming scheme didn't hold up over time.
4
- def self.get_supported
5
- %w(AH BE CA CC CE CH CN CP CS CY DE DK E1 ER ES EU F1
6
- FR GC GR I1 IE IN IT J1 JC JS LJ M1 MY NL NO PD PI
7
- PL RM RO RX S1 SE SF SG T1 T2 UK US WH WM WR)
8
- end
9
-
10
- def self.is_valid?(country)
11
- get_supported.include? country
12
- end
13
-
14
- def self.inject_convenience_methods
15
- get_supported.each do |country|
16
- unless self.respond_to? "#{country}"
17
- self.define_singleton_method "#{country}" do
18
- return country
19
- end
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,26 +0,0 @@
1
- module Cb::Utils
2
- module FluidAttributes
3
-
4
- def fluid_attr_accessor(*names)
5
- names.each do |name|
6
-
7
- define_method :"#{name}" do |*args|
8
- return instance_variable_get(:"@#{name}") if args.length == 0
9
-
10
- if args.length == 1
11
- instance_variable_set(:"@#{name}", args[0])
12
- return self
13
- end
14
-
15
- raise ArgumentError.new("Wrong number of arguments (#{args.length} for 1)")
16
- end
17
-
18
- define_method :"#{name}=" do |*args|
19
- instance_variable_set(:"@#{name}", args[0]) if args.length == 1
20
- return self
21
- raise ArgumentError, "Wrong number of arguments (#{args.length} for 1)"
22
- end
23
- end
24
- end
25
- end
26
- end
@@ -1,13 +0,0 @@
1
- module Cb::Utils
2
- class MetaValues
3
- # This class will be dynamically constructed at run time.
4
- # I don't want values that don't make sense to the API call you made to be accessible
5
- # I'm not dynamically creating the class because we may want to add functionality at some point
6
-
7
- # This class, with its dynamically created attr_accr's will be dynamically appended to api
8
- # entities, like job and company. It will contain things like errors, time elapsed, and
9
- # any other meta values that the API may return.
10
-
11
- # The mapping for allowed values, and what they translate to on this object live in Cb::Utils::Api
12
- end
13
- end