hawatel_search_jobs 0.2.1 → 0.3.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.
@@ -1,7 +1,7 @@
1
- language: ruby
2
- rvm:
3
- - 2.0.0
4
- - 2.1.0
5
- - 2.2.1
6
- - 2.2.4
1
+ language: ruby
2
+ rvm:
3
+ - 2.2.2
4
+ - 2.2.5
5
+ - 2.3.0
6
+ - 2.3.1
7
7
  before_install: gem install bundler -v 1.10.6
@@ -1,13 +1,13 @@
1
- # Contributor Code of Conduct
2
-
3
- As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
-
5
- We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
-
7
- Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
-
9
- Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
-
11
- Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
-
13
- This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
1
+ # Contributor Code of Conduct
2
+
3
+ As contributors and maintainers of this project, we pledge to respect all people who contribute through reporting issues, posting feature requests, updating documentation, submitting pull requests or patches, and other activities.
4
+
5
+ We are committed to making participation in this project a harassment-free experience for everyone, regardless of level of experience, gender, gender identity and expression, sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion.
6
+
7
+ Examples of unacceptable behavior by participants include the use of sexual language or imagery, derogatory comments or personal attacks, trolling, public or private harassment, insults, or other unprofessional conduct.
8
+
9
+ Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed from the project team.
10
+
11
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by opening an issue or contacting one or more of the project maintainers.
12
+
13
+ This Code of Conduct is adapted from the [Contributor Covenant](http://contributor-covenant.org), version 1.0.0, available at [http://contributor-covenant.org/version/1/0/0/](http://contributor-covenant.org/version/1/0/0/)
@@ -1,70 +1,70 @@
1
- # Contributing
2
-
3
- Bug reports and pull requests are welcome on GitHub at https://github.com/Hawatel/hawatel_search_jobs. This project is intended to be a safe, welcoming space for collaboration, and contributors.
4
-
5
- 1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork,
6
- and configure the remotes:
7
-
8
- ```sh
9
- # Clone your fork of the repo into the current directory
10
- git clone https://github.com/<your-username>/hawatel_search_jobs
11
- # Navigate to the newly cloned directory
12
- cd hawatel_search_jobs
13
- # Assign the original repo to a remote called "upstream"
14
- git remote add upstream https://github.com/Hawatel/hawatel_search_jobs
15
- ```
16
-
17
- 2. If you cloned a while ago, get the latest changes from upstream:
18
-
19
- ```bash
20
- git checkout master
21
- git pull upstream master
22
- ```
23
-
24
- 3. Create a new topic branch (off of `master`) to contain your feature, change,
25
- or fix.
26
-
27
- **IMPORTANT**: Making changes in `master` is discouraged. You should always
28
- keep your local `master` in sync with upstream `master` and make your
29
- changes in topic branches.
30
-
31
- ```sh
32
- git checkout -b <topic-branch-name>
33
- ```
34
-
35
- 4. Commit your changes in logical chunks. Keep your commit messages organized,
36
- with a short description in the first line and more detailed information on
37
- the following lines. Feel free to use Git's
38
- [interactive rebase](https://help.github.com/articles/about-git-rebase/)
39
- feature to tidy up your commits before making them public.
40
-
41
- 5. Make sure all the tests are still passing.
42
-
43
- ```sh
44
- rake
45
- ```
46
-
47
- 6. Push your topic branch up to your fork:
48
-
49
- ```sh
50
- git push origin <topic-branch-name>
51
- ```
52
-
53
- 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
54
- with a clear title and description.
55
-
56
- 8. If you haven't updated your pull request for a while, you should consider
57
- rebasing on master and resolving any conflicts.
58
-
59
- **IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You
60
- should always `git rebase` on `master` to bring your changes up to date when
61
- necessary.
62
-
63
- ```sh
64
- git checkout master
65
- git pull upstream master
66
- git checkout <your-topic-branch>
67
- git rebase master
68
- ```
69
-
1
+ # Contributing
2
+
3
+ Bug reports and pull requests are welcome on GitHub at https://github.com/Hawatel/hawatel_search_jobs. This project is intended to be a safe, welcoming space for collaboration, and contributors.
4
+
5
+ 1. [Fork](https://help.github.com/articles/fork-a-repo/) the project, clone your fork,
6
+ and configure the remotes:
7
+
8
+ ```sh
9
+ # Clone your fork of the repo into the current directory
10
+ git clone https://github.com/<your-username>/hawatel_search_jobs
11
+ # Navigate to the newly cloned directory
12
+ cd hawatel_search_jobs
13
+ # Assign the original repo to a remote called "upstream"
14
+ git remote add upstream https://github.com/Hawatel/hawatel_search_jobs
15
+ ```
16
+
17
+ 2. If you cloned a while ago, get the latest changes from upstream:
18
+
19
+ ```bash
20
+ git checkout master
21
+ git pull upstream master
22
+ ```
23
+
24
+ 3. Create a new topic branch (off of `master`) to contain your feature, change,
25
+ or fix.
26
+
27
+ **IMPORTANT**: Making changes in `master` is discouraged. You should always
28
+ keep your local `master` in sync with upstream `master` and make your
29
+ changes in topic branches.
30
+
31
+ ```sh
32
+ git checkout -b <topic-branch-name>
33
+ ```
34
+
35
+ 4. Commit your changes in logical chunks. Keep your commit messages organized,
36
+ with a short description in the first line and more detailed information on
37
+ the following lines. Feel free to use Git's
38
+ [interactive rebase](https://help.github.com/articles/about-git-rebase/)
39
+ feature to tidy up your commits before making them public.
40
+
41
+ 5. Make sure all the tests are still passing.
42
+
43
+ ```sh
44
+ rake
45
+ ```
46
+
47
+ 6. Push your topic branch up to your fork:
48
+
49
+ ```sh
50
+ git push origin <topic-branch-name>
51
+ ```
52
+
53
+ 7. [Open a Pull Request](https://help.github.com/articles/using-pull-requests/)
54
+ with a clear title and description.
55
+
56
+ 8. If you haven't updated your pull request for a while, you should consider
57
+ rebasing on master and resolving any conflicts.
58
+
59
+ **IMPORTANT**: _Never ever_ merge upstream `master` into your branches. You
60
+ should always `git rebase` on `master` to bring your changes up to date when
61
+ necessary.
62
+
63
+ ```sh
64
+ git checkout master
65
+ git pull upstream master
66
+ git checkout <your-topic-branch>
67
+ git rebase master
68
+ ```
69
+
70
70
  Thank you for your contributions!
data/Gemfile CHANGED
@@ -1,4 +1,4 @@
1
- source 'https://rubygems.org'
2
-
3
- # Specify your gem's dependencies in hawatel_search_jobs.gemspec
4
- gemspec
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in hawatel_search_jobs.gemspec
4
+ gemspec
@@ -1,21 +1,21 @@
1
- The MIT License (MIT)
2
-
3
- Copyright (c) 2016 Daniel Iwaniuk
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in
13
- all copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
- THE SOFTWARE.
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2016 Daniel Iwaniuk
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in
13
+ all copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
21
+ THE SOFTWARE.
data/README.md CHANGED
@@ -6,7 +6,7 @@
6
6
 
7
7
  # Hawatel Search Jobs
8
8
 
9
- Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites to get current job offers. At this moment, supported backends are indeed.com, careerjet.com, xing.com, careerbuilder.com and reed.co.uk.
9
+ Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites to get current job offers. At this moment, supported backends are indeed.com, careerjet.com, xing.com, careerbuilder.com, reed.co.uk, and upwork.com.
10
10
 
11
11
  Before you can start using the gem, you need have an accounts/tokens for each portal where is required by API.
12
12
 
@@ -59,6 +59,13 @@ HawatelSearchJobs.configure do |config|
59
59
  config.careerjet[:activated] = true
60
60
  config.careerjet[:api] = 'public.api.careerjet.net'
61
61
  config.careerjet[:page_size] = 25 # allowed range <1,99>
62
+
63
+ config.upwork[:activated] = true
64
+ config.upwork[:consumer_key] = 'secret-key'
65
+ config.upwork[:consumer_secret] = 'secret-key'
66
+ config.upwork[:oauth_token] = 'secret-key'
67
+ config.upwork[:oauth_token_secret] = 'secret-key'
68
+ config.upwork[:page_size] = 25 # allowed range <1,100>
62
69
  end
63
70
  ```
64
71
 
@@ -68,6 +75,7 @@ end
68
75
  3. Reed: https://www.reed.co.uk/developers/jobseeker
69
76
  4. Careerbuilder: http://developer.careerbuilder.com
70
77
  5. Careerjet: secret-key is no needed (http://www.careerjet.com/partners/api/)
78
+ 6. Upwork: https://developers.upwork.com
71
79
 
72
80
  #### Get first page of job offers
73
81
  There are two ways to read the returned job offers.
@@ -81,6 +89,7 @@ There are two ways to read the returned job offers.
81
89
  p result[:reed]
82
90
  p result[:careerbuilder]
83
91
  p result[:careerjet]
92
+ p result[:upwork]
84
93
  ```
85
94
 
86
95
  + Access to the instance variable jobs_table.
data/Rakefile CHANGED
@@ -1,6 +1,6 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
3
-
4
- RSpec::Core::RakeTask.new(:spec)
5
-
6
- task :default => :spec
1
+ require "bundler/gem_tasks"
2
+ require "rspec/core/rake_task"
3
+
4
+ RSpec::Core::RakeTask.new(:spec)
5
+
6
+ task :default => :spec
@@ -1,32 +1,33 @@
1
- # coding: utf-8
2
- lib = File.expand_path('../lib', __FILE__)
3
- $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'hawatel_search_jobs/version'
5
-
6
- Gem::Specification.new do |spec|
7
- spec.name = "hawatel_search_jobs"
8
- spec.version = HawatelSearchJobs::VERSION
9
- spec.authors = ['Przemyslaw Mantaj','Daniel Iwaniuk']
10
- spec.email = ['przemyslaw.mantaj@hawatel.com', 'daniel.iwaniuk@hawatel.com']
11
-
12
- spec.summary = %q{Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites to get current job offers.}
13
- spec.description = %q{Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites
14
- to get current job offers. At this moment, supported backends are indeed.com, careerjet.com,
15
- xing.com, careerbuilder.com and reed.co.uk.}
16
- spec.homepage = "http://github.com/Hawatel/hawatel_search_jobs"
17
- spec.license = "MIT"
18
-
19
- spec.files = `git ls-files`.split($/)
20
- spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
- spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
- spec.require_paths = ["lib"]
23
-
24
- spec.required_ruby_version = '>= 2.0.0'
25
-
26
- spec.add_runtime_dependency 'xing_api'
27
- spec.add_runtime_dependency 'activesupport'
28
-
29
- spec.add_development_dependency "bundler", "~> 1.10"
30
- spec.add_development_dependency "rake", "~> 10.0"
31
- spec.add_development_dependency "rspec"
32
- end
1
+ # coding: utf-8
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'hawatel_search_jobs/version'
5
+
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "hawatel_search_jobs"
8
+ spec.version = HawatelSearchJobs::VERSION
9
+ spec.authors = ['Przemyslaw Mantaj','Daniel Iwaniuk']
10
+ spec.email = ['przemyslaw.mantaj@hawatel.com', 'daniel.iwaniuk@hawatel.com']
11
+
12
+ spec.summary = %q{Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites to get current job offers.}
13
+ spec.description = %q{Hawatel_search_jobs, it is gem which provides ease access to API from popular job websites
14
+ to get current job offers. At this moment, supported backends are indeed.com, careerjet.com,
15
+ xing.com, careerbuilder.com, reed.co.uk, and upwork.com.}
16
+ spec.homepage = "http://github.com/Hawatel/hawatel_search_jobs"
17
+ spec.license = "MIT"
18
+
19
+ spec.files = `git ls-files`.split($/)
20
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
+ spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
22
+ spec.require_paths = ["lib"]
23
+
24
+ spec.required_ruby_version = '>= 2.2.2'
25
+
26
+ spec.add_runtime_dependency 'xing_api'
27
+ spec.add_runtime_dependency 'upwork-api'
28
+ spec.add_runtime_dependency 'activesupport'
29
+
30
+ spec.add_development_dependency "bundler", "~> 1.10"
31
+ spec.add_development_dependency "rake", "~> 10.0"
32
+ spec.add_development_dependency "rspec"
33
+ end
@@ -7,7 +7,7 @@ module HawatelSearchJobs
7
7
  require 'hawatel_search_jobs/client'
8
8
 
9
9
  class << self
10
- attr_accessor :indeed, :xing, :reed, :careerbuilder, :careerjet
10
+ attr_accessor :indeed, :xing, :reed, :careerbuilder, :careerjet, :upwork
11
11
 
12
12
  ##
13
13
  # How to configure APIs go to example {HawatelSearchJobs::Client#search_jobs}
@@ -17,6 +17,7 @@ module HawatelSearchJobs
17
17
  @reed = default_reed(Hash.new)
18
18
  @careerbuilder = default_careerbuilder(Hash.new)
19
19
  @careerjet = default_careerjet(Hash.new)
20
+ @upwork = default_upwork(Hash.new)
20
21
  yield self if block_given?
21
22
  true
22
23
  end
@@ -59,6 +60,16 @@ module HawatelSearchJobs
59
60
  settings[:version] = 'v2'
60
61
  return settings
61
62
  end
63
+
64
+ def default_upwork(settings)
65
+ settings[:activated] = false
66
+ settings[:consumer_key] = ''
67
+ settings[:consumer_secret] = ''
68
+ settings[:oauth_token] = ''
69
+ settings[:oauth_token_secret] = ''
70
+ return settings
71
+ end
72
+
62
73
  end
63
74
 
64
75
  end
@@ -1,9 +1,10 @@
1
- module HawatelSearchJobs
2
- module Api
3
- require 'hawatel_search_jobs/api/indeed'
4
- require 'hawatel_search_jobs/api/reed'
5
- require 'hawatel_search_jobs/api/xing'
6
- require 'hawatel_search_jobs/api/careerbuilder'
7
- require 'hawatel_search_jobs/api/careerjet'
8
- end
9
- end
1
+ module HawatelSearchJobs
2
+ module Api
3
+ require 'hawatel_search_jobs/api/indeed'
4
+ require 'hawatel_search_jobs/api/reed'
5
+ require 'hawatel_search_jobs/api/xing'
6
+ require 'hawatel_search_jobs/api/careerbuilder'
7
+ require 'hawatel_search_jobs/api/careerjet'
8
+ require 'hawatel_search_jobs/api/upwork'
9
+ end
10
+ end
@@ -0,0 +1,150 @@
1
+ require 'upwork/api'
2
+ require 'upwork/api/routers/jobs/search'
3
+
4
+ module HawatelSearchJobs::Api
5
+ module Upwork
6
+ class << self
7
+ include HawatelSearchJobs::Helpers::Base
8
+
9
+ DEFAULT = {
10
+ :keywords => '',
11
+ :location => '',
12
+ :company => ''
13
+ }
14
+
15
+ RESULT_LIMIT = 25
16
+
17
+ # @see https://github.com/upwork/ruby-upwork
18
+ # Search jobs based on specified keywords
19
+ #
20
+ # @param args [Hash]
21
+ # @option args :query [Hash] search criteria
22
+ # - *:keywords* (String )
23
+ # @option args :setting [Hash] @see https://developers.upwork.com/?lang=python#authentication_oauth-10
24
+ # - *:consumer_key* (String) - consumer key, required for authentication
25
+ # - *:consumer_secret* (String) - consumer secret, required for authentication
26
+ #
27
+ # @example
28
+ # search(:settings => HawatelSearchJobs.upwork,:query => {:keywords => 'ruby'})
29
+ #
30
+ # @return [Hash<OpenStruct>]
31
+ def search(args)
32
+ args[:query] = DEFAULT.merge(args[:query]) if args[:query]
33
+ keywords = args[:query][:keywords]
34
+ page_size = args[:settings][:page_size].to_s.empty? ? RESULT_LIMIT : args[:settings][:page_size].to_i
35
+ page_size = RESULT_LIMIT if page_size <= 0 || page_size > 100
36
+
37
+ result = send_request({:keywords => keywords, :offset => 0, :settings => args[:settings], :page_size => page_size})
38
+
39
+ if result['error']
40
+ error_handling(result)
41
+ else
42
+ set_attributes({:result => result, :page => 0, :keywords => keywords, :page_size => page_size})
43
+ end
44
+ end
45
+
46
+ # Show next page of results
47
+ #
48
+ # @param args [Hash]
49
+ # @option page [Integer] page numer (default 0)
50
+ # @option query_key [String] keywords from last query
51
+ #
52
+ # @example
53
+ # page({:query_key => result.key, :page => 2}
54
+ #
55
+ # @return [Hash<OpenStruct>]
56
+ def page(args)
57
+ args[:page] = 0 if args[:page].nil?
58
+ page_size = args[:settings][:page_size].to_s.empty? ? RESULT_LIMIT : args[:settings][:page_size].to_i
59
+ page_size = RESULT_LIMIT if page_size <= 0 || page_size > 100
60
+
61
+ result = send_request({:keywords => args[:query_key], :offset => args[:page]*page_size, :settings => args[:settings], :page_size => page_size})
62
+
63
+ if result['error']
64
+ error_handling(result)
65
+ else
66
+ set_attributes({:result => result, :page => args[:page], :keywords => args[:query_key], :page_size => page_size})
67
+ end
68
+ end
69
+
70
+ private
71
+ # Call Upwork client request
72
+ #
73
+ # @param args [Hash]
74
+ # @option settings [Hash] authentication attributes
75
+ # @option keywords [String] keywords for query
76
+ #
77
+ # @return [Hash<OpenStruct>]
78
+ def send_request(args)
79
+ @client = ::Upwork::Api::Client.new(set_settings(args[:settings])) if @client.nil?
80
+ @jobs_client = ::Upwork::Api::Routers::Jobs::Search.new(@client) if @jobs_client.nil?
81
+
82
+ @jobs_client.find({'q' => args[:keywords], 'sort' => 'create_time desc', 'paging' => "#{args[:offset]};#{args[:page_size]}"})
83
+ rescue => e
84
+ {:code => "500", :msg => "Internal error #{e}" }
85
+ end
86
+
87
+ # Build final result - set required attributes and return openstruct object
88
+ #
89
+ def set_attributes(args)
90
+ total = args[:result]['paging']['total'] ? args[:result]['paging']['total'].to_i : 0
91
+ # "paging"=>{"offset"=>0, "count"=>100, "total"=>886}
92
+ attributes = Hash.new
93
+ attributes[:totalResults] = total
94
+ attributes[:code] = '200'
95
+ attributes[:msg] = "OK"
96
+ attributes[:page] = args[:page]
97
+ attributes[:last] = total / args[:page_size]
98
+ attributes[:key] = args[:keywords]
99
+ attributes[:jobs] = parse_raw_data(args[:result])
100
+ OpenStruct.new(attributes)
101
+ end
102
+
103
+ # Build jobs array with specified attributes
104
+ # @note Format of response:
105
+ # {"server_time"=>1468313522, "auth_user"=>{"first_name"=>"xyz", "last_name"=>"xyz", "timezone"=>"Europe/Prague", "timezone_offset"=>"7200"},
106
+ # "profile_access"=>"public,odesk", "jobs"=>[{"id"=>"~01dde83fce38b65f90", "title"=>"Node.js & Ruby on Rails developer needed", "snippet"=>"The app is build in RoR,
107
+ # for chat we use Node.js and WebRTC for video\n\n1. Deploy to Digital Ocean with SSL", "category2"=>"Web, Mobile & Software Dev", "subcategory2"=>"Web Development",
108
+ # "skills"=>["node.js", "redis", "ruby-on-rails"], "job_type"=>"Hourly", "budget"=>0, "duration"=>"Less than 1 week", "workload"=>"10-30 hrs/week",
109
+ # "job_status"=>"Open", "date_created"=>"2016-06-30T15:14:03+0000", "url"=>"http://www.upwork.com/jobs/~01dde83fce38b65f90", "client"=>{"country"=>"Ireland", "feedback"=>5,
110
+ # "reviews_count"=>16, "jobs_posted"=>62, "past_hires"=>53, "payment_verification_status"=>"VERIFIED"}}], paging"=>{"offset"=>0, "count"=>100, "total"=>886}
111
+ # @return [Array<OpenStruct>]
112
+ def parse_raw_data(result)
113
+ jobs = Array.new
114
+ return jobs if result['jobs'].to_s.empty?
115
+ result['jobs'].each do |offer|
116
+ job = Hash.new
117
+ job[:jobtitle] = offer['title']
118
+ job[:location] = (offer['client'] && offer['client']['country']) ? offer['client']['country'] : nil
119
+ job[:company] = 'Upwork'
120
+ job[:date] = convert_date_to_format(offer['date_created'], '%d/%m/%y')
121
+ job[:url] = offer['url']
122
+ job = convert_empty_to_nil(job)
123
+ jobs << OpenStruct.new(job)
124
+ end
125
+ return jobs
126
+ end
127
+
128
+ # Set settings for UpworkApi client
129
+ #
130
+ # @param args [Hash]
131
+ def set_settings(args)
132
+ ::Upwork::Api::Config.new({
133
+ 'consumer_key' => args[:consumer_key],
134
+ 'consumer_secret' => args[:consumer_secret],
135
+ 'access_token' => args[:oauth_token],
136
+ 'access_secret' => args[:oauth_token_secret]
137
+ })
138
+ end
139
+
140
+ def error_handling(result)
141
+ if result['error']['status'] && result['error']['message']
142
+ OpenStruct.new({:code => result['error']['status'].to_i, :msg => result['error']['message']})
143
+ else
144
+ OpenStruct.new({:code => 501, :msg => 'incorrect settings'})
145
+ end
146
+ end
147
+
148
+ end
149
+ end
150
+ end