taleo 0.1.1 → 0.6.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3505c96292845b1dda78301ca8e18e574e9d9266e05847e8ecf74cbf2e9c55ca
4
- data.tar.gz: 5b8c227d7172c084593b88c8786967227ebccbb0f25aab94d077a530904a0072
3
+ metadata.gz: a6324fb24d7887a2ce1b64e78be566b5166a0176351a4eb06fcbe9204f5c9bed
4
+ data.tar.gz: e817de316ddfa86c845c3cc7bb3ce5634851d2beadf541d717554941bb31f5a9
5
5
  SHA512:
6
- metadata.gz: 8ca8e8a4c7469efe647c30aa99510c50f673f59f950562756ec234752ad3fa59ec0b78f3089963300c136c2382ba8d2b5845289935adca5b7003df2131383de3
7
- data.tar.gz: 86d0bad4f16219e2c2c1d969eb6690523f8784d6a771833d2b5e002aac83a36e03148e40fea052c685b4599df97bdf6be4bf92b3c3cbda5d63d6e1ee9c39b113
6
+ metadata.gz: 14b52d69ffe8a05775e360aa975c3876bcce1176fae2ff3442c9b5c71c8c1be81dd735d092772aa26d4deab2c3bc5ade0b626afb3f7da429cc297712f8421126
7
+ data.tar.gz: 7dc5324f2c20119468ccbae40962d72ec753ab88dced758e7572ad056f79727789789c6e3485fba0b3bbba61d4ccf650a2a54ff4926765e8cc7dad94ffdf19a3
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- taleo (0.1.1)
4
+ taleo (0.6.0)
5
5
  faraday (~> 1.0)
6
6
 
7
7
  GEM
@@ -14,8 +14,9 @@ GEM
14
14
  safe_yaml (~> 1.0.0)
15
15
  diff-lcs (1.4.4)
16
16
  docile (1.3.2)
17
- faraday (1.0.1)
17
+ faraday (1.1.0)
18
18
  multipart-post (>= 1.2, < 3)
19
+ ruby2_keywords
19
20
  hashdiff (1.0.0)
20
21
  json (2.3.1)
21
22
  multi_json (1.15.0)
@@ -39,6 +40,7 @@ GEM
39
40
  diff-lcs (>= 1.2.0, < 2.0)
40
41
  rspec-support (~> 3.9.0)
41
42
  rspec-support (3.9.3)
43
+ ruby2_keywords (0.0.2)
42
44
  safe_yaml (1.0.5)
43
45
  simplecov (0.17.1)
44
46
  docile (~> 1.1)
@@ -72,7 +74,7 @@ DEPENDENCIES
72
74
  rspec (~> 3.0)
73
75
  simplecov (~> 0.17.1)
74
76
  sinatra (~> 2.0)
75
- sinatra-contrib
77
+ sinatra-contrib (~> 2.0)
76
78
  taleo!
77
79
  webmock (~> 3.6)
78
80
  yard
data/README.md CHANGED
@@ -1,9 +1,17 @@
1
1
  # Taleo
2
2
 
3
- [![Maintainability](https://api.codeclimate.com/v1/badges/18630172a2dc24e7ace1/maintainability)](https://codeclimate.com/github/paulholden2/taleo/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/18630172a2dc24e7ace1/test_coverage)](https://codeclimate.com/github/paulholden2/taleo/test_coverage)
3
+ [![Gem Version](https://badge.fury.io/rb/taleo.svg)](https://badge.fury.io/rb/taleo) [![Build Status](https://travis-ci.org/paulholden2/taleo.svg?branch=master)](https://travis-ci.org/paulholden2/taleo) [![Inline docs](http://inch-ci.org/github/paulholden2/taleo.svg?branch=master)](http://inch-ci.org/github/paulholden2/taleo) [![Maintainability](https://api.codeclimate.com/v1/badges/18630172a2dc24e7ace1/maintainability)](https://codeclimate.com/github/paulholden2/taleo/maintainability) [![Test Coverage](https://api.codeclimate.com/v1/badges/18630172a2dc24e7ace1/test_coverage)](https://codeclimate.com/github/paulholden2/taleo/test_coverage)
4
4
 
5
5
  A library for using the Taleo REST API.
6
6
 
7
+ **Note**: A Nov 2020 change to the Taleo API requires at least one search
8
+ criteria be passed to employee searches (performed by `client#employees` to
9
+ retrieve paged results). Versions prior to 0.6 do not support passing search
10
+ parameters, and as such you should not use them if you need to utilize
11
+ employee searches. See the Taleo REST API guide
12
+ [here](https://www.oracle.com/technical-resources/documentation/taleobusiness.html)
13
+ for more information.
14
+
7
15
  ## Installation
8
16
 
9
17
  Add this line to your application's Gemfile:
@@ -9,7 +9,7 @@ require 'taleo/employee'
9
9
  module Taleo
10
10
  # Base object for executing queries and wrapping HTTP requests.
11
11
  class Client
12
- attr_reader :org_code, :username, :password, :service_url
12
+ attr_reader :org_code, :username, :password, :service_url, :auth_token
13
13
 
14
14
  def initialize(org_code, username, password, service_url)
15
15
  @org_code = org_code
@@ -34,14 +34,16 @@ module Taleo
34
34
  Activity.new(show('activity', id), self)
35
35
  end
36
36
 
37
- def employees
38
- cursor('employee', Employee)
37
+ def employees(start = 1, limit = 10, params: {})
38
+ raise ArgumentError, "At least one query parameter is required " \
39
+ "for employee search" if params.keys.size.zero?
40
+ cursor('employee', Employee, start, limit, params: params)
39
41
  end
40
42
 
41
- def cursor(resource, klass, start = 1, limit = 10)
43
+ def cursor(resource, klass, start = 1, limit = 10, params: {})
42
44
  res = connection.get do |req|
43
45
  req.url "object/#{resource}/search"
44
- req.params.merge!({
46
+ req.params.merge!(params).merge!({
45
47
  'start' => start,
46
48
  'limit' => limit
47
49
  })
@@ -49,7 +51,8 @@ module Taleo
49
51
  data = JSON.parse(res.body)
50
52
  pagination = data.dig('response', 'pagination')
51
53
  results = data.dig('response', 'searchResults')
52
- Cursor.new(pagination, results, resource, klass, self)
54
+ cursor = Cursor.new(pagination, results, resource, klass, self)
55
+ cursor.self_page
53
56
  end
54
57
 
55
58
  def show(resource, id)
@@ -120,11 +123,5 @@ module Taleo
120
123
  @api_url = data.dig('response', 'URL')
121
124
  @api_url
122
125
  end
123
-
124
- private
125
-
126
- def auth_token
127
- @auth_token
128
- end
129
126
  end
130
127
  end
@@ -27,6 +27,18 @@ module Taleo
27
27
  pagination.key?('previous')
28
28
  end
29
29
 
30
+ def has_self?
31
+ pagination.key?('self')
32
+ end
33
+
34
+ def self_page
35
+ res = client.connection.get do |req|
36
+ req.url pagination.fetch('self')
37
+ end
38
+
39
+ new_cursor(res)
40
+ end
41
+
30
42
  def next_page
31
43
  raise Taleo::Error.new('No further results') unless has_next?
32
44
 
@@ -3,6 +3,7 @@
3
3
  require 'taleo/resource'
4
4
  require 'taleo/candidate'
5
5
  require 'taleo/packet'
6
+ require 'taleo/location'
6
7
 
7
8
  module Taleo
8
9
  # Stub for Packet resource class
@@ -13,7 +14,40 @@ module Taleo
13
14
  data.fetch('employeeId')
14
15
  end
15
16
 
17
+ def first_name
18
+ data.fetch('firstName')
19
+ end
20
+
21
+ def last_name
22
+ data.fetch('lastName')
23
+ end
24
+
25
+ def location_id
26
+ data.fetch('location')
27
+ end
28
+
29
+ def ssn
30
+ data.fetch('ssn')
31
+ end
32
+
16
33
  has_one :candidate, Candidate
34
+ has_one :location, Location
17
35
  has_many :packets, Packet, singular: 'packet', plural: 'activityPackets'
36
+ has_many :attachments, Attachment, singular: 'attachment', through: 'attachment'
37
+
38
+ # Override since employee relationship URLs will not include an
39
+ # attachments URL
40
+ def has_attachments?
41
+ true
42
+ end
43
+
44
+ # Annoying hack since the employee resource relationship URLs hash
45
+ # doesn't include an attachments link, even if there are attachments.
46
+ def relationship_urls
47
+ urls = super
48
+ urls.merge({
49
+ 'attachment' => urls.fetch('historylog').gsub(/historylog$/, 'attachment')
50
+ })
51
+ end
18
52
  end
19
53
  end
@@ -0,0 +1,13 @@
1
+ require 'taleo/resource'
2
+
3
+ module Taleo
4
+ class Location < Resource
5
+ def id
6
+ data.fetch('id')
7
+ end
8
+
9
+ def name
10
+ data.fetch('locationName')
11
+ end
12
+ end
13
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Taleo
4
- VERSION = '0.1.1'
4
+ VERSION = '0.6.0'
5
5
  end
@@ -34,7 +34,7 @@ Gem::Specification.new do |spec|
34
34
  spec.add_dependency 'faraday', '~> 1.0'
35
35
 
36
36
  spec.add_development_dependency 'sinatra', '~> 2.0'
37
- spec.add_development_dependency 'sinatra-contrib'
37
+ spec.add_development_dependency 'sinatra-contrib', '~> 2.0'
38
38
  spec.add_development_dependency 'webmock', '~> 3.6'
39
39
  spec.add_development_dependency 'yard'
40
40
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: taleo
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Holden
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-22 00:00:00.000000000 Z
11
+ date: 2020-11-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -42,16 +42,16 @@ dependencies:
42
42
  name: sinatra-contrib
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - ">="
45
+ - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '0'
47
+ version: '2.0'
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - ">="
52
+ - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '0'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: webmock
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -105,6 +105,7 @@ files:
105
105
  - lib/taleo/client.rb
106
106
  - lib/taleo/cursor.rb
107
107
  - lib/taleo/employee.rb
108
+ - lib/taleo/location.rb
108
109
  - lib/taleo/packet.rb
109
110
  - lib/taleo/resource.rb
110
111
  - lib/taleo/version.rb