hawatel_search_jobs 0.1.3 → 0.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.
@@ -11,6 +11,8 @@ module HawatelSearchJobs::Api
11
11
  :company => ''
12
12
  }
13
13
 
14
+ RESULT_LIMIT = 25
15
+
14
16
  # @see https://github.com/xing/xing_api
15
17
  # Search jobs based on specified keywords
16
18
  #
@@ -30,9 +32,13 @@ module HawatelSearchJobs::Api
30
32
  def search(args)
31
33
  args[:query] = DEFAULT.merge(args[:query]) if args[:query]
32
34
  keywords = args[:query][:keywords]
33
- result = send_request({:keywords => keywords, :offset => 0, :settings => args[:settings]})
35
+ page_size = args[:settings][:page_size].to_s.empty? ? RESULT_LIMIT : args[:settings][:page_size].to_i
36
+ page_size = RESULT_LIMIT if page_size <= 0 || page_size > 100
37
+
38
+ result = send_request({:keywords => keywords, :offset => 0, :settings => args[:settings], :page_size => page_size})
39
+
34
40
  if !result[:code]
35
- set_attributes({:result => result, :page => 0, :keywords => keywords})
41
+ set_attributes({:result => result, :page => 0, :keywords => keywords, :page_size => page_size})
36
42
  else
37
43
  OpenStruct.new({:code => 501, :msg => 'incorrect settings'})
38
44
  end
@@ -50,8 +56,11 @@ module HawatelSearchJobs::Api
50
56
  # @return [Hash<OpenStruct>]
51
57
  def page(args)
52
58
  args[:page] = 0 if args[:page].nil?
53
- result = XingApi::Job.search(args[:query_key], {:limit => 25, :offset => args[:page]*25})
54
- set_attributes({:result => result, :page => args[:page], :keywords => args[:query_key]})
59
+ page_size = args[:settings][:page_size].to_s.empty? ? RESULT_LIMIT : args[:settings][:page_size].to_i
60
+ page_size = RESULT_LIMIT if page_size <= 0 || page_size > 100
61
+
62
+ result = XingApi::Job.search(args[:query_key], {:limit => page_size, :offset => args[:page]*page_size})
63
+ set_attributes({:result => result, :page => args[:page], :keywords => args[:query_key], :page_size => page_size})
55
64
  rescue XingApi::Error => e
56
65
  {:code => e.status_code, :msg => e.text}
57
66
  end
@@ -66,7 +75,8 @@ module HawatelSearchJobs::Api
66
75
  # @return [Hash<OpenStruct>]
67
76
  def send_request(args)
68
77
  set_settings(args[:settings])
69
- XingApi::Job.search(args[:keywords], {:limit => 25, :offset => 0})
78
+
79
+ XingApi::Job.search(args[:keywords], {:limit => args[:page_size], :offset => 0})
70
80
  rescue XingApi::Error => e
71
81
  {:code => e.status_code, :msg => e.text}
72
82
  end
@@ -79,7 +89,7 @@ module HawatelSearchJobs::Api
79
89
  attributes[:code] = '200'
80
90
  attributes[:msg] = "OK"
81
91
  attributes[:page] = args[:page]
82
- attributes[:last] = args[:result][:jobs][:total] / 25
92
+ attributes[:last] = args[:result][:jobs][:total] / args[:page_size]
83
93
  attributes[:key] = args[:keywords]
84
94
  attributes[:jobs] = parse_raw_data(args[:result])
85
95
  OpenStruct.new(attributes)
@@ -1,172 +1,170 @@
1
- module HawatelSearchJobs
2
- ##
3
- # = Client for a jobs search engine
4
- #
5
- # @!attribute [rw] indeed
6
- # @return [Hash] settings of API
7
- # @!attribute [rw] xing
8
- # @return [Hash] settings of API
9
- # @!attribute [rw] reed
10
- # @return [Hash] settings of API
11
- # @!attribute [rw] careerbuilder
12
- # @return [Hash] settings of API
13
- # @!attribute [rw] careerjet
14
- # @return [Hash] settings of API
15
- class Client
16
- include HawatelSearchJobs::Api
17
-
18
- # Values have to be the same name like module name of usesd APIs (HawatelSearchJobs::Api::[ApiName])
19
- APIS = ['Indeed', 'Xing', 'Reed', 'Careerbuilder', 'CareerJet']
20
-
21
- attr_reader :jobs_table
22
-
23
- DEFAULT = {
24
- :keywords => '',
25
- :location => '',
26
- :company => '',
27
- }
28
-
29
- def initialize
30
- APIS.each do |api|
31
- metaclasses.send(:attr_reader, api.downcase.to_sym)
32
- api_conf = HawatelSearchJobs.instance_variable_get("@"+api.downcase)
33
-
34
- if api_conf.nil?
35
- HawatelSearchJobs.configure
36
- api_conf = HawatelSearchJobs.instance_variable_get("@"+api.downcase)
37
- end
38
-
39
- instance_variable_set("@#{api.downcase}", api_conf.dup)
40
- end
41
- end
42
-
43
- def metaclasses
44
- class << self; self; end
45
- end
46
-
47
- # Search Jobs by specific criteria
48
- # @param query [Hash]
49
- # @option query [String] :keywords
50
- # @option query [String] :location
51
- # @option query [String] :company not working in Reed API
52
- # @example
53
- # HawatelSearchJobs.configure do |config|
54
- # config.indeed[:activated] = true
55
- # config.indeed[:api] = 'api.indeed.com'
56
- # config.indeed[:version] = '2'
57
- # config.indeed[:publisher] = 'secret-key'
58
- #
59
- # config.xing[:activated] = true
60
- # config.xing[:consumer_key] = 'secret-key'
61
- # config.xing[:consumer_secret] = 'secret-key'
62
- # config.xing[:oauth_token] = 'secret-key'
63
- # config.xing[:oauth_token_secret] = 'secret-key'
64
- #
65
- # config.reed[:activated] = true
66
- # config.reed[:api] = 'reed.co.uk/api'
67
- # config.reed[:clientid] = 'secret-key'
68
- # config.reed[:version] = '1.0'
69
- #
70
- # config.careerbuilder[:activated] = true
71
- # config.careerbuilder[:api] = 'api.careerbuilder.com'
72
- # config.careerbuilder[:clientid] = 'secret-key'
73
- # config.careerbuilder[:version] = 'v2'
74
- #
75
- # config.careerjet[:activated] = true
76
- # config.careerjet[:api] = 'public.api.careerjet.net'
77
- # end
78
- #
79
- # client = HawatelSearchJobs::Client.new
80
- # client.search_jobs({:keywords => 'ruby'})
81
- #
82
- # p client.jobs_table[:indeed]
83
- # p client.jobs_table[:xing]
84
- # p client.jobs_table[:reed]
85
- # p client.jobs_table[:careerbuilder]
86
- # p client.jobs_table[:careerjet]
87
- #
88
- # client.next
89
- # @return [Hash] First page of result for all providers (default maximum 25 records for each page)
90
- def search_jobs(query = {})
91
- query = DEFAULT.merge(query)
92
-
93
- @jobs_table = Hash.new
94
-
95
- APIS.each do |api|
96
- api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
97
- api_inst_var = instance_variable_get("@"+api.downcase)
98
- @jobs_table[api.downcase.to_sym] = api_module_name.search({:settings => api_inst_var, :query => query}) if api_inst_var[:activated]
99
- end
100
-
101
- @jobs_table
102
- end
103
-
104
- # Get next page of result
105
- # @example
106
- # p client.next
107
- # p client.jobs_table
108
- # @return [Hash] Next page of result for all providers (default maximum 25 records for each)
109
- def next
110
- next_result = Hash.new
111
- APIS.each do |api|
112
- api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
113
- api_inst_var = instance_variable_get("@"+api.downcase)
114
- api_sym_name = api.downcase.to_sym
115
-
116
- if api_inst_var[:activated] && next_result?(api_sym_name)
117
- next_result[api_sym_name] = api_module_name.page({:settings => api_inst_var,
118
- :page => @jobs_table[api_sym_name].page + 1,
119
- :query_key => @jobs_table[api_sym_name].key})
120
- end
121
- end
122
-
123
- return nil if next_result.empty?
124
-
125
- @jobs_table = next_result
126
- end
127
-
128
-
129
- # Sum jobs offers from specified api or count all
130
- #
131
- # @param args [Hash]
132
- # @option args [String] :api name
133
- # @example
134
- # p client.count
135
- # p client.count('indeed')
136
- #
137
- # @return [Integer]
138
- def count(api = nil)
139
- sum = 0
140
-
141
- if api
142
- api = api.downcase
143
- api_inst_var = instance_variable_get("@"+api)
144
- if api_inst_var[:activated]
145
- sum = @jobs_table[:"#{api}"].totalResults if @jobs_table[:"#{api}"].totalResults
146
- end
147
- else
148
- APIS.each do |provider|
149
- api_inst_var = instance_variable_get("@"+provider.downcase)
150
- if api_inst_var[:activated]
151
- provider = provider.downcase
152
- sum += @jobs_table[:"#{provider}"].totalResults if @jobs_table[:"#{provider}"].totalResults
153
- end
154
- end
155
- end
156
- return sum
157
- end
158
-
159
- private
160
- def next_result?(provider)
161
- if @jobs_table[provider] && @jobs_table[provider].page && @jobs_table[provider].last &&
162
- @jobs_table[provider].page < @jobs_table[provider].last
163
- true
164
- else
165
- false
166
- end
167
-
168
- end
169
-
170
- end
171
- end
172
-
1
+ module HawatelSearchJobs
2
+ ##
3
+ # = Client for a jobs search engine
4
+ #
5
+ # @!attribute [rw] indeed
6
+ # @return [Hash] settings of API
7
+ # @!attribute [rw] xing
8
+ # @return [Hash] settings of API
9
+ # @!attribute [rw] reed
10
+ # @return [Hash] settings of API
11
+ # @!attribute [rw] careerbuilder
12
+ # @return [Hash] settings of API
13
+ # @!attribute [rw] careerjet
14
+ # @return [Hash] settings of API
15
+ class Client
16
+ include HawatelSearchJobs::Api
17
+
18
+ # Values have to be the same name like module name of usesd APIs (HawatelSearchJobs::Api::[ApiName])
19
+ APIS = ['Indeed', 'Xing', 'Reed', 'Careerbuilder', 'CareerJet']
20
+
21
+ attr_reader :jobs_table
22
+
23
+ DEFAULT = {
24
+ :keywords => '',
25
+ :location => '',
26
+ :company => '',
27
+ }
28
+
29
+ def initialize
30
+ APIS.each do |api|
31
+ metaclasses.send(:attr_reader, api.downcase.to_sym)
32
+ instance_variable_set("@#{api.downcase}", HawatelSearchJobs.instance_variable_get("@"+api.downcase))
33
+ end
34
+ end
35
+
36
+ def metaclasses
37
+ class << self; self; end
38
+ end
39
+
40
+ # Search Jobs by specific criteria
41
+ # @param query [Hash]
42
+ # @option query [String] :keywords
43
+ # @option query [String] :location not working in Xing API
44
+ # @option query [String] :company not working in Reed API
45
+ # @example
46
+ # HawatelSearchJobs.configure do |config|
47
+ # config.indeed[:activated] = true
48
+ # config.indeed[:api] = 'api.indeed.com'
49
+ # config.indeed[:version] = '2'
50
+ # config.indeed[:publisher] = 'secret-key'
51
+ # config.indeed[:page_size] = 25 # allowed range <1,25>
52
+ #
53
+ # config.xing[:activated] = true
54
+ # config.xing[:consumer_key] = 'secret-key'
55
+ # config.xing[:consumer_secret] = 'secret-key'
56
+ # config.xing[:oauth_token] = 'secret-key'
57
+ # config.xing[:oauth_token_secret] = 'secret-key'
58
+ # config.xing[:page_size] = 25 # allowed range <1,100>
59
+ #
60
+ # config.reed[:activated] = true
61
+ # config.reed[:api] = 'reed.co.uk/api'
62
+ # config.reed[:clientid] = 'secret-key'
63
+ # config.reed[:version] = '1.0'
64
+ # config.reed[:page_size] = 25 # allowed range <1,100>
65
+ #
66
+ # config.careerbuilder[:activated] = true
67
+ # config.careerbuilder[:api] = 'api.careerbuilder.com'
68
+ # config.careerbuilder[:clientid] = 'secret-key'
69
+ # config.careerbuilder[:version] = 'v2'
70
+ # config.careerbuilder[:page_size] = 25 # allowed range <1,100>
71
+ #
72
+ # config.careerjet[:activated] = true
73
+ # config.careerjet[:api] = 'public.api.careerjet.net'
74
+ # config.careerjet[:page_size] = 25 # allowed range <1,99>
75
+ # end
76
+ #
77
+ # client = HawatelSearchJobs::Client.new
78
+ # client.search_jobs({:keywords => 'ruby'})
79
+ #
80
+ # p client.jobs_table[:indeed]
81
+ # p client.jobs_table[:xing]
82
+ # p client.jobs_table[:reed]
83
+ # p client.jobs_table[:careerbuilder]
84
+ # p client.jobs_table[:careerjet]
85
+ #
86
+ # client.next
87
+ # @return [Hash] First page of result for all providers (default maximum 25 records for each page)
88
+ def search_jobs(query = {})
89
+ query = DEFAULT.merge(query)
90
+
91
+ @jobs_table = Hash.new
92
+
93
+ APIS.each do |api|
94
+ api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
95
+ api_inst_var = instance_variable_get("@"+api.downcase)
96
+ @jobs_table[api.downcase.to_sym] = api_module_name.search({:settings => api_inst_var, :query => query}) if api_inst_var[:activated]
97
+ end
98
+
99
+ @jobs_table
100
+ end
101
+
102
+ # Get next page of result
103
+ # @example
104
+ # p client.next
105
+ # p client.jobs_table
106
+ # @return [Hash] Next page of result for all providers (default maximum 25 records for each)
107
+ def next
108
+ next_result = Hash.new
109
+ APIS.each do |api|
110
+ api_module_name = Object.const_get('HawatelSearchJobs').const_get('Api').const_get(api)
111
+ api_inst_var = instance_variable_get("@"+api.downcase)
112
+ api_sym_name = api.downcase.to_sym
113
+
114
+ if api_inst_var[:activated] && next_result?(api_sym_name)
115
+ next_result[api_sym_name] = api_module_name.page({:settings => api_inst_var,
116
+ :page => @jobs_table[api_sym_name].page + 1,
117
+ :query_key => @jobs_table[api_sym_name].key})
118
+ end
119
+ end
120
+
121
+ return nil if next_result.empty?
122
+
123
+ @jobs_table = next_result
124
+ end
125
+
126
+
127
+ # Sum jobs offers from specified api or count all
128
+ #
129
+ # @param args [Hash]
130
+ # @option args [String] :api name
131
+ # @example
132
+ # p client.count
133
+ # p client.count('indeed')
134
+ #
135
+ # @return [Integer]
136
+ def count(api = nil)
137
+ sum = 0
138
+
139
+ if api
140
+ api = api.downcase
141
+ api_inst_var = instance_variable_get("@"+api)
142
+ if api_inst_var[:activated]
143
+ sum = @jobs_table[:"#{api}"].totalResults if @jobs_table[:"#{api}"].totalResults
144
+ end
145
+ else
146
+ APIS.each do |provider|
147
+ api_inst_var = instance_variable_get("@"+provider.downcase)
148
+ if api_inst_var[:activated]
149
+ provider = provider.downcase
150
+ sum += @jobs_table[:"#{provider}"].totalResults if @jobs_table[:"#{provider}"].totalResults
151
+ end
152
+ end
153
+ end
154
+ return sum
155
+ end
156
+
157
+ private
158
+ def next_result?(provider)
159
+ if @jobs_table[provider] && @jobs_table[provider].page && @jobs_table[provider].last &&
160
+ @jobs_table[provider].page < @jobs_table[provider].last
161
+ true
162
+ else
163
+ false
164
+ end
165
+
166
+ end
167
+
168
+ end
169
+ end
170
+
@@ -1,3 +1,3 @@
1
1
  module HawatelSearchJobs
2
- VERSION = "0.1.3"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -1,83 +1,143 @@
1
- require 'spec_helper'
2
-
3
- xdescribe HawatelSearchJobs::Api::Careerbuilder do
4
- before(:each) do
5
- HawatelSearchJobs.configure do |config|
6
- config.careerbuilder[:api] = 'api.careerbuilder.com'
7
- config.careerbuilder[:version] = 'v2'
8
- config.careerbuilder[:clientid] = ''
9
- end
10
- end
11
-
12
- context 'APIs returned jobs' do
13
- before(:each) do
14
- @query_api = {:keywords => 'ruby', :location => ''}
15
- @result = HawatelSearchJobs::Api::Careerbuilder.search(
16
- :settings => HawatelSearchJobs.careerbuilder,
17
- :query => {
18
- :keywords => @query_api[:keywords],
19
- :location => @query_api[:location]
20
- })
21
- end
22
-
23
- it '#search' do
24
- validate_result(@result, @query_api)
25
- expect(@result.page).to be >= 0
26
- expect(@result.last).to be >= 0
27
- end
28
-
29
- it '#page' do
30
- validate_result(@result, @query_api)
31
- page_result = HawatelSearchJobs::Api::Careerbuilder.page({
32
- :settings => HawatelSearchJobs.careerbuilder,
33
- :query_key => @result.key,
34
- :page => 1})
35
- expect(page_result.key).to match(/&PageNumber=2/)
36
- expect(page_result.page).to be == 1
37
- expect(page_result.last).to be >= 0
38
- end
39
- end
40
-
41
- context 'APIs returned empty table' do
42
- before(:each) do
43
- @query_api = {:keywords => 'job-not-found-zero-records', :location => 'London'}
44
- @result = HawatelSearchJobs::Api::Careerbuilder.search(
45
- :settings => HawatelSearchJobs.careerbuilder,
46
- :query => {
47
- :keywords => @query_api[:keywords],
48
- :location => @query_api[:location]
49
- })
50
- end
51
-
52
- it '#search' do
53
- validate_result(@result, @query_api)
54
- expect(@result.totalResults).to eq(0)
55
- expect(@result.page).to be_nil
56
- expect(@result.last).to be_nil
57
- expect(@result.jobs).to be_nil
58
- end
59
-
60
- it '#page' do
61
- validate_result(@result, @query_api)
62
- page_result = HawatelSearchJobs::Api::Careerbuilder.page({
63
- :settings => HawatelSearchJobs.careerbuilder,
64
- :query_key => @result.key,
65
- :page => 1})
66
- expect(page_result.key).to match(/&PageNumber=2/)
67
- expect(@result.totalResults).to eq(0)
68
- expect(@result.page).to be_nil
69
- expect(@result.last).to be_nil
70
- expect(@result.jobs).to be_nil
71
- end
72
- end
73
-
74
- private
75
-
76
- def validate_result(result, query_api)
77
- expect(result.code).to eq(200)
78
- expect(result.msg).to eq('OK')
79
- expect(result.totalResults).to be >= 0
80
- expect(result.key).to match("Location=#{query_api[:location]}")
81
- expect(result.key).to match("Keywords=#{query_api[:keywords]}")
82
- end
1
+ require 'spec_helper'
2
+ require 'time'
3
+
4
+ xdescribe HawatelSearchJobs::Api::Careerbuilder do
5
+ before(:each) do
6
+ HawatelSearchJobs.configure do |config|
7
+ config.careerbuilder[:api] = 'api.careerbuilder.com'
8
+ config.careerbuilder[:version] = 'v2'
9
+ config.careerbuilder[:clientid] = ''
10
+ config.careerbuilder[:page_size]= 100
11
+ end
12
+ end
13
+
14
+ context 'APIs returned jobs' do
15
+ before(:each) do
16
+ @query_api = {:keywords => 'ruby', :location => ''}
17
+ @result = HawatelSearchJobs::Api::Careerbuilder.search(
18
+ :settings => HawatelSearchJobs.careerbuilder,
19
+ :query => {
20
+ :keywords => @query_api[:keywords],
21
+ :location => @query_api[:location]
22
+ })
23
+ end
24
+
25
+ it '#search' do
26
+ validate_result(@result, @query_api)
27
+ expect(@result.page).to be >= 0
28
+ expect(@result.last).to be >= 0
29
+ end
30
+
31
+ it '#results ordered by date descending' do
32
+ validate_result(@result, @query_api)
33
+
34
+ last_date = nil
35
+ @result.jobs.each do |job|
36
+ if !job.date.to_s.empty?
37
+ if !last_date.nil?
38
+ expect(convert_date_to_timestamp(job.date)).to be <= last_date
39
+ end
40
+ last_date = convert_date_to_timestamp(job.date)
41
+ end
42
+ end
43
+ end
44
+
45
+ it '#page' do
46
+ validate_result(@result, @query_api)
47
+
48
+ page_result =
49
+ HawatelSearchJobs::Api::Careerbuilder.page({
50
+ :settings => HawatelSearchJobs.careerbuilder,
51
+ :query_key => @result.key,
52
+ :page => 1})
53
+ expect(page_result.key).to match(/&PageNumber=2/)
54
+ expect(page_result.page).to be == 1
55
+ expect(page_result.last).to be >= 0
56
+ end
57
+
58
+ it '#count of jobs is the same like page_size' do
59
+ validate_result(@result, @query_api)
60
+ expect(@result.jobs.count).to eq(HawatelSearchJobs.careerbuilder[:page_size])
61
+ end
62
+
63
+ it '#next page does not contain last page' do
64
+ validate_result(@result, @query_api)
65
+
66
+ first_page =
67
+ HawatelSearchJobs::Api::Careerbuilder.page({
68
+ :settings => HawatelSearchJobs.careerbuilder,
69
+ :query_key => @result.key,
70
+ :page => 1})
71
+ expect(first_page.key).to match(/&PageNumber=2/)
72
+ expect(first_page.page).to be == 1
73
+ expect(first_page.last).to be >= 0
74
+
75
+ second_page =
76
+ HawatelSearchJobs::Api::Careerbuilder.page({
77
+ :settings => HawatelSearchJobs.careerbuilder,
78
+ :query_key => @result.key,
79
+ :page => 2})
80
+
81
+ expect(second_page.key).to match(/&PageNumber=3/)
82
+ expect(second_page.page).to be == 2
83
+ expect(second_page.last).to be >= 0
84
+
85
+ first_page.jobs.each do |first_job|
86
+ second_page.jobs.each do |second_job|
87
+ expect(first_job.url).not_to eq(second_job.url)
88
+ end
89
+ end
90
+
91
+ end
92
+ end
93
+
94
+ context 'APIs returned empty table' do
95
+ before(:each) do
96
+ @query_api = {:keywords => 'job-not-found-zero-records', :location => 'London'}
97
+ @result = HawatelSearchJobs::Api::Careerbuilder.search(
98
+ :settings => HawatelSearchJobs.careerbuilder,
99
+ :query => {
100
+ :keywords => @query_api[:keywords],
101
+ :location => @query_api[:location]
102
+ })
103
+ end
104
+
105
+ it '#search' do
106
+ validate_result(@result, @query_api)
107
+ expect(@result.totalResults).to eq(0)
108
+ expect(@result.page).to be_nil
109
+ expect(@result.last).to be_nil
110
+ expect(@result.jobs).to be_nil
111
+ end
112
+
113
+ it '#page' do
114
+ validate_result(@result, @query_api)
115
+ page_result =
116
+ HawatelSearchJobs::Api::Careerbuilder.page({
117
+ :settings => HawatelSearchJobs.careerbuilder,
118
+ :query_key => @result.key,
119
+ :page => 1})
120
+ expect(page_result.key).to match(/&PageNumber=2/)
121
+ expect(@result.totalResults).to eq(0)
122
+ expect(@result.page).to be_nil
123
+ expect(@result.last).to be_nil
124
+ expect(@result.jobs).to be_nil
125
+ end
126
+ end
127
+
128
+ private
129
+
130
+ def validate_result(result, query_api)
131
+ expect(result.code).to eq(200)
132
+ expect(result.msg).to eq('OK')
133
+ expect(result.totalResults).to be >= 0
134
+ expect(result.key).to match("Location=#{query_api[:location]}")
135
+ expect(result.key).to match("Keywords=#{query_api[:keywords]}")
136
+ end
137
+
138
+ def convert_date_to_timestamp(job_date)
139
+ date = job_date.split('/')
140
+ return Time.parse("#{date[2]}-#{date[1]}-#{date[0]}").to_i
141
+ end
142
+
83
143
  end