greenhouse_io-gitlab 2.5.3 → 2.5.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 51f9bbfcc363d99b8b8f920ff67c4141eb410e66809cd76ee1238e595ef7da02
4
- data.tar.gz: 6a715a12268273408527ed832fe17e4327407ae9042a02d815aae449d46ff178
3
+ metadata.gz: f4cee1c60062e097d4341709d9ac0e2319fa0379145763644fef1ef494cb0335
4
+ data.tar.gz: f94340381b6a5b5bd7a7d6e1876216108d804317059dca47fdbeedf20a375151
5
5
  SHA512:
6
- metadata.gz: 2a379e7d14cd34c4f48064197c54d35ef581ba578553108e4a1ce739b72f4bbde670133846b6f38c49e0fa3a299385add1ed75ac092e601a312b8d47428e2343
7
- data.tar.gz: adc5a9436b3becd331dfac6ba3cf1506dc82c7d67fd69ab3a9efaef8b2ec9f384d17e7cf85c93e0def5129c8fec1e2876861d75ec87a7bd7c44133b9fb887332
6
+ metadata.gz: 837c2ed56a22ef864d446cf86ec088ef5a037ee980e421a09172c4540ed2c0c848cf55327246b1ebe5cfd8c48e16c513dfa17383988af22ca992485ef8cf6ddc
7
+ data.tar.gz: 4398e0c7ef082537a8f374c3a884bf5046c4b6095dff04b0568fa28d17cb1af4a865f3e2a94e5c90da9df651d3ff3dcdfd75372b69128eafceb0ff4ed6560659
data/Gemfile CHANGED
@@ -1,5 +1,7 @@
1
1
  source 'https://rubygems.org'
2
2
 
3
+ gem 'byebug'
4
+
3
5
  group :development do
4
6
  gem 'pry'
5
7
  end
@@ -18,10 +18,9 @@ Gem::Specification.new do |spec|
18
18
  spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
19
19
  spec.require_paths = ["lib"]
20
20
 
21
- spec.add_dependency('httmultiparty', '~> 0.3.16')
21
+ spec.add_runtime_dependency 'rest-client', '~> 2.0'
22
22
  spec.required_ruby_version = '>= 1.9.3'
23
23
 
24
- spec.add_development_dependency "bundler", "~> 1.3"
25
24
  spec.add_development_dependency "rake"
26
25
  spec.add_development_dependency "rspec", "~> 3.4.0"
27
26
  spec.add_development_dependency "webmock", "~> 1.22.6"
data/lib/greenhouse_io.rb CHANGED
@@ -1,4 +1,3 @@
1
- require 'httmultiparty'
2
1
  require 'json'
3
2
 
4
3
  require "greenhouse_io/version"
@@ -1,19 +1,23 @@
1
+ require 'rest-client'
2
+ require 'byebug'
3
+
1
4
  module GreenhouseIo
2
5
  module API
3
6
  def get_response(url, options)
4
- self.class.get(url, options)
7
+ credential = Base64.strict_encode64(self.api_token + ':')
8
+ headers = { "Authorization" => "Basic " + credential }
9
+ headers.merge!({ params: options })
10
+ RestClient.get(url, headers)
5
11
  end
6
12
 
7
- def post_response(url, options)
8
- self.class.post(url, options)
13
+ def post_response(url, payload, headers)
14
+ credential = Base64.strict_encode64(self.api_token + ':')
15
+ headers.merge!({ "Authorization" => "Basic " + credential })
16
+ RestClient.post(url, payload[:body], headers)
9
17
  end
10
18
 
11
19
  def parse_json(response)
12
20
  JSON.parse(response.body, symbolize_names: GreenhouseIo.configuration.symbolize_keys)
13
21
  end
14
-
15
- def basic_auth
16
- { :username => self.api_token }
17
- end
18
22
  end
19
23
  end
@@ -1,6 +1,5 @@
1
1
  module GreenhouseIo
2
2
  class Client
3
- include HTTMultiParty
4
3
  include GreenhouseIo::API
5
4
 
6
5
  PERMITTED_OPTIONS = [:page, :per_page, :job_id]
@@ -10,82 +9,82 @@ module GreenhouseIo
10
9
  }
11
10
 
12
11
  attr_accessor :api_token, :rate_limit, :rate_limit_remaining, :link
13
- base_uri 'https://harvest.greenhouse.io/v1'
12
+ BASE_URL = 'https://harvest.greenhouse.io/v1'
14
13
 
15
14
  def initialize(api_token = nil)
16
15
  @api_token = api_token || GreenhouseIo.configuration.api_token
17
16
  end
18
17
 
19
18
  def offices(id = nil, options = {})
20
- get_from_harvest_api "/offices#{path_id(id)}", options
19
+ get_from_harvest_api "#{BASE_URL}/offices#{path_id(id)}", options
21
20
  end
22
21
 
23
22
  def offers(id = nil, options = {})
24
- get_from_harvest_api "/offers#{path_id(id)}", options, "offers"
23
+ get_from_harvest_api "#{BASE_URL}/offers#{path_id(id)}", options, "offers"
25
24
  end
26
25
 
27
26
  def departments(id = nil, options = {})
28
- get_from_harvest_api "/departments#{path_id(id)}", options
27
+ get_from_harvest_api "#{BASE_URL}/departments#{path_id(id)}", options
29
28
  end
30
29
 
31
30
  def candidates(id = nil, options = {})
32
- get_from_harvest_api "/candidates#{path_id(id)}", options, "candidates"
31
+ get_from_harvest_api "#{BASE_URL}/candidates#{path_id(id)}", options, "candidates"
33
32
  end
34
33
 
35
34
  def activity_feed(id, options = {})
36
- get_from_harvest_api "/candidates/#{id}/activity_feed", options
35
+ get_from_harvest_api "#{BASE_URL}/candidates/#{id}/activity_feed", options
37
36
  end
38
37
 
39
38
  def create_candidate_note(candidate_id, note_hash, on_behalf_of)
40
39
  post_to_harvest_api(
41
- "/candidates/#{candidate_id}/activity_feed/notes",
40
+ "#{BASE_URL}/candidates/#{candidate_id}/activity_feed/notes",
42
41
  note_hash,
43
42
  { 'On-Behalf-Of' => on_behalf_of.to_s }
44
43
  )
45
44
  end
46
45
 
47
46
  def applications(id = nil, options = {})
48
- get_from_harvest_api "/applications#{path_id(id)}", options
47
+ get_from_harvest_api "#{BASE_URL}/applications#{path_id(id)}", options
49
48
  end
50
49
 
51
50
  def offers_for_application(id, options = {})
52
- get_from_harvest_api "/applications/#{id}/offers", options
51
+ get_from_harvest_api "#{BASE_URL}/applications/#{id}/offers", options
53
52
  end
54
53
 
55
54
  def current_offer_for_application(id, options = {})
56
- get_from_harvest_api "/applications/#{id}/offers/current_offer", options
55
+ get_from_harvest_api "#{BASE_URL}/applications/#{id}/offers/current_offer", options
57
56
  end
58
57
 
59
58
  def scorecards(id, options = {})
60
- get_from_harvest_api "/applications/#{id}/scorecards", options
59
+ get_from_harvest_api "#{BASE_URL}/applications/#{id}/scorecards", options
61
60
  end
62
61
 
63
62
  def all_scorecards(id = nil, options = {})
64
- get_from_harvest_api "/scorecards/#{id}", options
63
+ get_from_harvest_api "#{BASE_URL}/scorecards/#{id}", options
65
64
  end
66
65
 
67
66
  def scheduled_interviews(id, options = {})
68
- get_from_harvest_api "/applications/#{id}/scheduled_interviews", options
67
+ get_from_harvest_api "#{BASE_URL}/applications/#{id}/scheduled_interviews", options
69
68
  end
70
69
 
71
70
  def jobs(id = nil, options = {})
72
- get_from_harvest_api "/jobs#{path_id(id)}", options
71
+ get_from_harvest_api "#{BASE_URL}/jobs#{path_id(id)}", options
73
72
  end
74
73
 
75
74
  def stages(id, options = {})
76
- get_from_harvest_api "/jobs/#{id}/stages", options
75
+ get_from_harvest_api "#{BASE_URL}/jobs/#{id}/stages", options
77
76
  end
78
77
 
79
78
  def job_post(id, options = {})
80
- get_from_harvest_api "/jobs/#{id}/job_post", options
79
+ get_from_harvest_api "#{BASE_URL}/jobs/#{id}/job_post", options
81
80
  end
82
81
 
83
82
  def users(id = nil, options = {})
84
- get_from_harvest_api "/users#{path_id(id)}", options
83
+ get_from_harvest_api "#{BASE_URL}/users#{path_id(id)}", options
85
84
  end
86
85
 
87
86
  def sources(id = nil, options = {})
88
- get_from_harvest_api "/sources#{path_id(id)}", options
87
+ get_from_harvest_api "#{BASE_URL}/sources#{path_id(id)}", options
89
88
  end
90
89
 
91
90
  private
@@ -106,12 +105,7 @@ module GreenhouseIo
106
105
  all_permitted_options = permitted_options(options)
107
106
  all_permitted_options.merge!(permitted_options_for_endpoint(options, endpoint)) if endpoint
108
107
 
109
- response = get_response(url, {
110
- :query => all_permitted_options,
111
- :basic_auth => basic_auth
112
- })
113
-
114
- set_headers_info(response.headers)
108
+ response = get_response(url, all_permitted_options)
115
109
 
116
110
  if response.code == 200
117
111
  parse_json(response)
@@ -121,13 +115,7 @@ module GreenhouseIo
121
115
  end
122
116
 
123
117
  def post_to_harvest_api(url, body, headers)
124
- response = post_response(url, {
125
- :body => JSON.dump(body),
126
- :basic_auth => basic_auth,
127
- :headers => headers
128
- })
129
-
130
- set_headers_info(response.headers)
118
+ response = post_response(url, {:body => JSON.dump(body)}, headers)
131
119
 
132
120
  if response.code == 200
133
121
  parse_json(response)
@@ -135,11 +123,5 @@ module GreenhouseIo
135
123
  raise GreenhouseIo::Error.new(response.code)
136
124
  end
137
125
  end
138
-
139
- def set_headers_info(headers)
140
- self.rate_limit = headers['x-ratelimit-limit'].to_i
141
- self.rate_limit_remaining = headers['x-ratelimit-remaining'].to_i
142
- self.link = headers['link'].to_s
143
- end
144
126
  end
145
127
  end
@@ -1,9 +1,8 @@
1
1
  module GreenhouseIo
2
2
  class JobBoard
3
- include HTTMultiParty
4
3
  include GreenhouseIo::API
5
4
  attr_accessor :api_token, :organization
6
- base_uri 'https://api.greenhouse.io/v1'
5
+ BASE_URL = 'https://api.greenhouse.io/v1'
7
6
 
8
7
  def initialize(api_token = nil, default_options = {})
9
8
  @api_token = api_token || GreenhouseIo.configuration.api_token
@@ -1,3 +1,3 @@
1
1
  module GreenhouseIo
2
- VERSION = "2.5.3"
2
+ VERSION = "2.5.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: greenhouse_io-gitlab
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.5.3
4
+ version: 2.5.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Greenhouse Software
@@ -9,36 +9,22 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2021-02-02 00:00:00.000000000 Z
12
+ date: 2021-03-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
- name: httmultiparty
15
+ name: rest-client
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
18
  - - "~>"
19
19
  - !ruby/object:Gem::Version
20
- version: 0.3.16
20
+ version: '2.0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - "~>"
26
26
  - !ruby/object:Gem::Version
27
- version: 0.3.16
28
- - !ruby/object:Gem::Dependency
29
- name: bundler
30
- requirement: !ruby/object:Gem::Requirement
31
- requirements:
32
- - - "~>"
33
- - !ruby/object:Gem::Version
34
- version: '1.3'
35
- type: :development
36
- prerelease: false
37
- version_requirements: !ruby/object:Gem::Requirement
38
- requirements:
39
- - - "~>"
40
- - !ruby/object:Gem::Version
41
- version: '1.3'
27
+ version: '2.0'
42
28
  - !ruby/object:Gem::Dependency
43
29
  name: rake
44
30
  requirement: !ruby/object:Gem::Requirement