cb-api 1.1.8 → 1.2.0

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.
@@ -0,0 +1,13 @@
1
+ module Cb
2
+ module Clients
3
+
4
+ class ApiRequest
5
+
6
+ attr_accessor :cb_client, :list_endpoint, :show_endpoint, :create_endpoint, :update_endpoint, :delete_endpoint
7
+
8
+ def initialize
9
+ @cb_client = Cb.api_client.new
10
+ end
11
+ end
12
+ end
13
+ end
@@ -56,7 +56,6 @@ module Cb
56
56
  def self.find_by_did(did)
57
57
  criteria = Cb::JobDetailsCriteria.new()
58
58
  criteria.did = did
59
- criteria.show_custom_values = true
60
59
  return find_by_criteria(criteria)
61
60
  end
62
61
 
@@ -2,8 +2,7 @@ module Cb
2
2
  class JobDetailsCriteria
3
3
  extend Cb::Utils::FluidAttributes
4
4
 
5
- fluid_attr_accessor :did, :show_job_skin, :site_id, :lhs, :cobrand, :show_apply_requirements,
6
- :show_custom_values
5
+ fluid_attr_accessor :did, :show_job_skin, :site_id, :lhs, :cobrand, :show_apply_requirements
7
6
 
8
7
  def find
9
8
  Cb.job.find_by_criteria(self)
@@ -3,7 +3,7 @@ module Cb
3
3
 
4
4
  class Media
5
5
 
6
- attr_accessor :header, :header_type, :tablet_banner, :mobile_logo, :footer, :is_multi_video
6
+ attr_accessor :header, :header_type, :tablet_banner, :mobile_logo, :footer, :video, :is_multi_video
7
7
 
8
8
  def initialize args = {}
9
9
  @header = args['Header'] || ''
@@ -11,6 +11,7 @@ module Cb
11
11
  @tablet_banner = args['TabletBanner'] || ''
12
12
  @mobile_logo = args['MobileLogo'] || ''
13
13
  @footer = args['Footer'] || ''
14
+ @video = args['Video'] || ''
14
15
  @is_multi_video = args['IsMultiVideo'] == 'true'
15
16
  end
16
17
 
@@ -15,8 +15,6 @@ module Cb
15
15
  def extract
16
16
  if response_has_collection?
17
17
  extract_array_from_collection
18
- elsif response_has_array?
19
- build_array_from_delimited_values
20
18
  else
21
19
  []
22
20
  end
@@ -24,18 +22,10 @@ module Cb
24
22
 
25
23
  private
26
24
 
27
- def response_has_array?
28
- !@response_hash[@key].nil? && @response_hash[@key].class != Hash
29
- end
30
-
31
25
  def response_has_collection?
32
26
  !@response_hash[@key].nil? && !@response_hash[@key][@singular_key].nil?
33
27
  end
34
28
 
35
- def build_array_from_delimited_values
36
- @response_hash[@key].split(',')
37
- end
38
-
39
29
  def extract_array_from_collection
40
30
  if @response_hash[@key][@singular_key].is_a?(Array)
41
31
  @response_hash[@key][@singular_key]
@@ -1,3 +1,3 @@
1
1
  module Cb
2
- VERSION = '1.1.8'
2
+ VERSION = '1.2.0'
3
3
  end
@@ -0,0 +1,86 @@
1
+ module Memory
2
+ # sizes are guessed, I was too lazy to look
3
+ # them up and then they are also platform
4
+ # dependent
5
+ REF_SIZE = 4 # ?
6
+ OBJ_OVERHEAD = 4 # ?
7
+ FIXNUM_SIZE = 4 # ?
8
+
9
+ # informational output from analysis
10
+ MemoryInfo = Struct.new :roots, :objects, :bytes, :loops
11
+
12
+ def self.analyze(*roots)
13
+ an = Analyzer.new
14
+ an.roots = roots
15
+ an.analyze
16
+ end
17
+
18
+ class Analyzer
19
+ attr_accessor :roots
20
+ attr_reader :result
21
+
22
+ def analyze
23
+ @result = MemoryInfo.new roots, 0, 0, 0
24
+ @objs = {}
25
+
26
+ queue = roots.dup
27
+
28
+ until queue.empty?
29
+ obj = queue.shift
30
+
31
+ case obj
32
+ # special treatment for some types
33
+ # some are certainly missing from this
34
+ when IO
35
+ visit(obj)
36
+ when String
37
+ visit(obj) { @result.bytes += obj.size }
38
+ when Fixnum
39
+ @result.bytes += FIXNUM_SIZE
40
+ when Array
41
+ visit(obj) do
42
+ @result.bytes += obj.size * REF_SIZE
43
+ queue.concat(obj)
44
+ end
45
+ when Hash
46
+ visit(obj) do
47
+ @result.bytes += obj.size * REF_SIZE * 2
48
+ obj.each {|k,v| queue.push(k).push(v)}
49
+ end
50
+ when Enumerable
51
+ visit(obj) do
52
+ obj.each do |o|
53
+ @result.bytes += REF_SIZE
54
+ queue.push(o)
55
+ end
56
+ end
57
+ else
58
+ visit(obj) do
59
+ obj.instance_variables.each do |var|
60
+ @result.bytes += REF_SIZE
61
+ queue.push(obj.instance_variable_get(var))
62
+ end
63
+ end
64
+ end
65
+ end
66
+
67
+ @result
68
+ end
69
+
70
+ private
71
+ def visit(obj)
72
+ id = obj.object_id
73
+
74
+ if @objs.has_key? id
75
+ @result.loops += 1
76
+ false
77
+ else
78
+ @objs[id] = true
79
+ @result.bytes += OBJ_OVERHEAD
80
+ @result.objects += 1
81
+ yield obj if block_given?
82
+ true
83
+ end
84
+ end
85
+ end
86
+ 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: 1.1.8
4
+ version: 1.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -19,7 +19,7 @@ authors:
19
19
  autorequire:
20
20
  bindir: bin
21
21
  cert_chain: []
22
- date: 2013-12-17 00:00:00.000000000 Z
22
+ date: 2014-01-08 00:00:00.000000000 Z
23
23
  dependencies:
24
24
  - !ruby/object:Gem::Dependency
25
25
  name: httparty
@@ -167,6 +167,7 @@ extensions: []
167
167
  extra_rdoc_files: []
168
168
  files:
169
169
  - lib/cb/clients/anon_saved_search_api.rb
170
+ - lib/cb/clients/api_request.rb
170
171
  - lib/cb/clients/application_api.rb
171
172
  - lib/cb/clients/application_external_api.rb
172
173
  - lib/cb/clients/category_api.rb
@@ -226,6 +227,7 @@ files:
226
227
  - lib/cb/utils/validator.rb
227
228
  - lib/cb/version.rb
228
229
  - lib/cb.rb
230
+ - lib/memory.rb
229
231
  - README.md
230
232
  homepage: http://api.careerbuilder.com
231
233
  licenses:
@@ -248,9 +250,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
250
  version: '0'
249
251
  requirements: []
250
252
  rubyforge_project:
251
- rubygems_version: 1.8.25
253
+ rubygems_version: 1.8.28
252
254
  signing_key:
253
255
  specification_version: 3
254
256
  summary: Ruby wrapper around Careerbuilder Public API.
255
257
  test_files: []
256
- has_rdoc: