ashby 0.1.3

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 ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 0e855315529a1db2046338905389213fd31d25a5b06cd108da13dcaf21d1ffda
4
+ data.tar.gz: 21cef7834c42bda68bd5403003c631ccf5f6ba78d8ff6481390bd550ba0cf757
5
+ SHA512:
6
+ metadata.gz: 256f5a827351f307416f34df1c49968459bcfa6a892d739155521784d78a75ad1dacb300de062d588143ac5ffac6347fe29b516168bf0434ca145528886b48c0
7
+ data.tar.gz: e1eedbdf08c2fcc648c448a4e54e00374953d7c1c0bd36d41960f7d0d8fcdf84c780a470fff5287d23bd79095d89ffdbefaff520050db2e30e90be2ed5325854
data/.idea/.gitignore ADDED
@@ -0,0 +1,8 @@
1
+ # Default ignored files
2
+ /shelf/
3
+ /workspace.xml
4
+ # Editor-based HTTP Client requests
5
+ /httpRequests/
6
+ # Datasource local storage ignored files
7
+ /dataSources/
8
+ /dataSources.local.xml
data/.idea/ashby.iml ADDED
@@ -0,0 +1,97 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <module type="RUBY_MODULE" version="4">
3
+ <component name="ModuleRunConfigurationManager">
4
+ <shared />
5
+ </component>
6
+ <component name="NewModuleRootManager">
7
+ <content url="file://$MODULE_DIR$">
8
+ <sourceFolder url="file://$MODULE_DIR$/features" isTestSource="true" />
9
+ <sourceFolder url="file://$MODULE_DIR$/spec" isTestSource="true" />
10
+ <sourceFolder url="file://$MODULE_DIR$/test" isTestSource="true" />
11
+ </content>
12
+ <orderEntry type="inheritedJdk" />
13
+ <orderEntry type="sourceFolder" forTests="false" />
14
+ <orderEntry type="library" scope="PROVIDED" name="ast (v2.4.3, rbenv: 3.2.3) [gem]" level="application" />
15
+ <orderEntry type="library" scope="PROVIDED" name="bundler (v2.6.8, rbenv: 3.2.3) [gem]" level="application" />
16
+ <orderEntry type="library" scope="PROVIDED" name="date (v3.4.1, rbenv: 3.2.3) [gem]" level="application" />
17
+ <orderEntry type="library" scope="PROVIDED" name="diff-lcs (v1.6.2, rbenv: 3.2.3) [gem]" level="application" />
18
+ <orderEntry type="library" scope="PROVIDED" name="domain_name (v0.6.20240107, rbenv: 3.2.3) [gem]" level="application" />
19
+ <orderEntry type="library" scope="PROVIDED" name="erb (v5.0.1, rbenv: 3.2.3) [gem]" level="application" />
20
+ <orderEntry type="library" scope="PROVIDED" name="http-accept (v1.7.0, rbenv: 3.2.3) [gem]" level="application" />
21
+ <orderEntry type="library" scope="PROVIDED" name="http-cookie (v1.0.8, rbenv: 3.2.3) [gem]" level="application" />
22
+ <orderEntry type="library" scope="PROVIDED" name="io-console (v0.8.0, rbenv: 3.2.3) [gem]" level="application" />
23
+ <orderEntry type="library" scope="PROVIDED" name="irb (v1.15.2, rbenv: 3.2.3) [gem]" level="application" />
24
+ <orderEntry type="library" scope="PROVIDED" name="json (v2.12.2, rbenv: 3.2.3) [gem]" level="application" />
25
+ <orderEntry type="library" scope="PROVIDED" name="language_server-protocol (v3.17.0.5, rbenv: 3.2.3) [gem]" level="application" />
26
+ <orderEntry type="library" scope="PROVIDED" name="lint_roller (v1.1.0, rbenv: 3.2.3) [gem]" level="application" />
27
+ <orderEntry type="library" scope="PROVIDED" name="logger (v1.7.0, rbenv: 3.2.3) [gem]" level="application" />
28
+ <orderEntry type="library" scope="PROVIDED" name="mime-types (v3.7.0, rbenv: 3.2.3) [gem]" level="application" />
29
+ <orderEntry type="library" scope="PROVIDED" name="mime-types-data (v3.2025.0527, rbenv: 3.2.3) [gem]" level="application" />
30
+ <orderEntry type="library" scope="PROVIDED" name="netrc (v0.11.0, rbenv: 3.2.3) [gem]" level="application" />
31
+ <orderEntry type="library" scope="PROVIDED" name="parallel (v1.27.0, rbenv: 3.2.3) [gem]" level="application" />
32
+ <orderEntry type="library" scope="PROVIDED" name="parser (v3.3.8.0, rbenv: 3.2.3) [gem]" level="application" />
33
+ <orderEntry type="library" scope="PROVIDED" name="pp (v0.6.2, rbenv: 3.2.3) [gem]" level="application" />
34
+ <orderEntry type="library" scope="PROVIDED" name="prettyprint (v0.2.0, rbenv: 3.2.3) [gem]" level="application" />
35
+ <orderEntry type="library" scope="PROVIDED" name="prism (v1.4.0, rbenv: 3.2.3) [gem]" level="application" />
36
+ <orderEntry type="library" scope="PROVIDED" name="psych (v5.2.6, rbenv: 3.2.3) [gem]" level="application" />
37
+ <orderEntry type="library" scope="PROVIDED" name="racc (v1.8.1, rbenv: 3.2.3) [gem]" level="application" />
38
+ <orderEntry type="library" scope="PROVIDED" name="rainbow (v3.1.1, rbenv: 3.2.3) [gem]" level="application" />
39
+ <orderEntry type="library" scope="PROVIDED" name="rake (v13.3.0, rbenv: 3.2.3) [gem]" level="application" />
40
+ <orderEntry type="library" scope="PROVIDED" name="rdoc (v6.14.0, rbenv: 3.2.3) [gem]" level="application" />
41
+ <orderEntry type="library" scope="PROVIDED" name="regexp_parser (v2.10.0, rbenv: 3.2.3) [gem]" level="application" />
42
+ <orderEntry type="library" scope="PROVIDED" name="reline (v0.6.1, rbenv: 3.2.3) [gem]" level="application" />
43
+ <orderEntry type="library" scope="PROVIDED" name="rest-client (v2.1.0, rbenv: 3.2.3) [gem]" level="application" />
44
+ <orderEntry type="library" scope="PROVIDED" name="rspec (v3.13.1, rbenv: 3.2.3) [gem]" level="application" />
45
+ <orderEntry type="library" scope="PROVIDED" name="rspec-core (v3.13.4, rbenv: 3.2.3) [gem]" level="application" />
46
+ <orderEntry type="library" scope="PROVIDED" name="rspec-expectations (v3.13.5, rbenv: 3.2.3) [gem]" level="application" />
47
+ <orderEntry type="library" scope="PROVIDED" name="rspec-mocks (v3.13.5, rbenv: 3.2.3) [gem]" level="application" />
48
+ <orderEntry type="library" scope="PROVIDED" name="rspec-support (v3.13.4, rbenv: 3.2.3) [gem]" level="application" />
49
+ <orderEntry type="library" scope="PROVIDED" name="rubocop (v1.75.8, rbenv: 3.2.3) [gem]" level="application" />
50
+ <orderEntry type="library" scope="PROVIDED" name="rubocop-ast (v1.44.1, rbenv: 3.2.3) [gem]" level="application" />
51
+ <orderEntry type="library" scope="PROVIDED" name="ruby-progressbar (v1.13.0, rbenv: 3.2.3) [gem]" level="application" />
52
+ <orderEntry type="library" scope="PROVIDED" name="stringio (v3.1.7, rbenv: 3.2.3) [gem]" level="application" />
53
+ <orderEntry type="library" scope="PROVIDED" name="unicode-display_width (v3.1.4, rbenv: 3.2.3) [gem]" level="application" />
54
+ <orderEntry type="library" scope="PROVIDED" name="unicode-emoji (v4.0.4, rbenv: 3.2.3) [gem]" level="application" />
55
+ </component>
56
+ <component name="RakeTasksCache-v2">
57
+ <option name="myRootTask">
58
+ <RakeTaskImpl id="rake">
59
+ <subtasks>
60
+ <RakeTaskImpl description="Build ashby-0.1.1.gem into the pkg directory" fullCommand="build" id="build" />
61
+ <RakeTaskImpl id="build">
62
+ <subtasks>
63
+ <RakeTaskImpl description="Generate SHA512 checksum of ashby-0.1.1.gem into the checksums directory" fullCommand="build:checksum" id="checksum" />
64
+ </subtasks>
65
+ </RakeTaskImpl>
66
+ <RakeTaskImpl description="Remove any temporary products" fullCommand="clean" id="clean" />
67
+ <RakeTaskImpl description="Remove any generated files" fullCommand="clobber" id="clobber" />
68
+ <RakeTaskImpl description="Build and install ashby-0.1.1.gem into system gems" fullCommand="install" id="install" />
69
+ <RakeTaskImpl id="install">
70
+ <subtasks>
71
+ <RakeTaskImpl description="Build and install ashby-0.1.1.gem into system gems without network access" fullCommand="install:local" id="local" />
72
+ </subtasks>
73
+ </RakeTaskImpl>
74
+ <RakeTaskImpl description="Create tag v0.1.1 and build and push ashby-0.1.1.gem to TODO: Set to your gem server 'https://example.com'" fullCommand="release[remote]" id="release[remote]" />
75
+ <RakeTaskImpl description="Run RuboCop" fullCommand="rubocop" id="rubocop" />
76
+ <RakeTaskImpl id="rubocop">
77
+ <subtasks>
78
+ <RakeTaskImpl description="Autocorrect RuboCop offenses (only when it's safe)" fullCommand="rubocop:autocorrect" id="autocorrect" />
79
+ <RakeTaskImpl description="Autocorrect RuboCop offenses (safe and unsafe)" fullCommand="rubocop:autocorrect_all" id="autocorrect_all" />
80
+ <RakeTaskImpl description="" fullCommand="rubocop:auto_correct" id="auto_correct" />
81
+ </subtasks>
82
+ </RakeTaskImpl>
83
+ <RakeTaskImpl description="Run RSpec code examples" fullCommand="spec" id="spec" />
84
+ <RakeTaskImpl description="" fullCommand="default" id="default" />
85
+ <RakeTaskImpl description="" fullCommand="release" id="release" />
86
+ <RakeTaskImpl id="release">
87
+ <subtasks>
88
+ <RakeTaskImpl description="" fullCommand="release:guard_clean" id="guard_clean" />
89
+ <RakeTaskImpl description="" fullCommand="release:rubygem_push" id="rubygem_push" />
90
+ <RakeTaskImpl description="" fullCommand="release:source_control_push" id="source_control_push" />
91
+ </subtasks>
92
+ </RakeTaskImpl>
93
+ </subtasks>
94
+ </RakeTaskImpl>
95
+ </option>
96
+ </component>
97
+ </module>
data/.idea/misc.xml ADDED
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectRootManager" version="2" project-jdk-name="rbenv: 3.2.3" project-jdk-type="RUBY_SDK" />
4
+ </project>
data/.idea/modules.xml ADDED
@@ -0,0 +1,8 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="ProjectModuleManager">
4
+ <modules>
5
+ <module fileurl="file://$PROJECT_DIR$/.idea/ashby.iml" filepath="$PROJECT_DIR$/.idea/ashby.iml" />
6
+ </modules>
7
+ </component>
8
+ </project>
data/.idea/vcs.xml ADDED
@@ -0,0 +1,6 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <project version="4">
3
+ <component name="VcsDirectoryMappings">
4
+ <mapping directory="" vcs="Git" />
5
+ </component>
6
+ </project>
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,8 @@
1
+ inherit_from: .rubocop_todo.yml
2
+
3
+ AllCops:
4
+ NewCops: enable
5
+
6
+ plugins:
7
+ - rubocop-rake
8
+ - rubocop-rspec
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,27 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2025-09-08 15:31:51 UTC using RuboCop version 1.75.8.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ # Configuration parameters: CountComments, CountAsOne, AllowedMethods, AllowedPatterns.
11
+ Metrics/MethodLength:
12
+ Max: 11
13
+
14
+ # Offense count: 1
15
+ # Configuration parameters: AllowedConstants.
16
+ Style/Documentation:
17
+ Exclude:
18
+ - 'spec/**/*'
19
+ - 'test/**/*'
20
+ - 'lib/ashby/job_boards.rb'
21
+
22
+ # Offense count: 1
23
+ # This cop supports safe autocorrection (--autocorrect).
24
+ # Configuration parameters: AllowHeredoc, AllowURI, URISchemes, IgnoreCopDirectives, AllowedPatterns, SplitStrings.
25
+ # URISchemes: http, https
26
+ Layout/LineLength:
27
+ Max: 121
@@ -0,0 +1 @@
1
+ {}
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ ## [Unreleased]
2
+
3
+ ## [0.1.0] - 2025-05-30
4
+
5
+ - Initial release
@@ -0,0 +1,132 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ We as members, contributors, and leaders pledge to make participation in our
6
+ community a harassment-free experience for everyone, regardless of age, body
7
+ size, visible or invisible disability, ethnicity, sex characteristics, gender
8
+ identity and expression, level of experience, education, socio-economic status,
9
+ nationality, personal appearance, race, caste, color, religion, or sexual
10
+ identity and orientation.
11
+
12
+ We pledge to act and interact in ways that contribute to an open, welcoming,
13
+ diverse, inclusive, and healthy community.
14
+
15
+ ## Our Standards
16
+
17
+ Examples of behavior that contributes to a positive environment for our
18
+ community include:
19
+
20
+ * Demonstrating empathy and kindness toward other people
21
+ * Being respectful of differing opinions, viewpoints, and experiences
22
+ * Giving and gracefully accepting constructive feedback
23
+ * Accepting responsibility and apologizing to those affected by our mistakes,
24
+ and learning from the experience
25
+ * Focusing on what is best not just for us as individuals, but for the overall
26
+ community
27
+
28
+ Examples of unacceptable behavior include:
29
+
30
+ * The use of sexualized language or imagery, and sexual attention or advances of
31
+ any kind
32
+ * Trolling, insulting or derogatory comments, and personal or political attacks
33
+ * Public or private harassment
34
+ * Publishing others' private information, such as a physical or email address,
35
+ without their explicit permission
36
+ * Other conduct which could reasonably be considered inappropriate in a
37
+ professional setting
38
+
39
+ ## Enforcement Responsibilities
40
+
41
+ Community leaders are responsible for clarifying and enforcing our standards of
42
+ acceptable behavior and will take appropriate and fair corrective action in
43
+ response to any behavior that they deem inappropriate, threatening, offensive,
44
+ or harmful.
45
+
46
+ Community leaders have the right and responsibility to remove, edit, or reject
47
+ comments, commits, code, wiki edits, issues, and other contributions that are
48
+ not aligned to this Code of Conduct, and will communicate reasons for moderation
49
+ decisions when appropriate.
50
+
51
+ ## Scope
52
+
53
+ This Code of Conduct applies within all community spaces, and also applies when
54
+ an individual is officially representing the community in public spaces.
55
+ Examples of representing our community include using an official email address,
56
+ posting via an official social media account, or acting as an appointed
57
+ representative at an online or offline event.
58
+
59
+ ## Enforcement
60
+
61
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
62
+ reported to the community leaders responsible for enforcement at
63
+ [INSERT CONTACT METHOD].
64
+ All complaints will be reviewed and investigated promptly and fairly.
65
+
66
+ All community leaders are obligated to respect the privacy and security of the
67
+ reporter of any incident.
68
+
69
+ ## Enforcement Guidelines
70
+
71
+ Community leaders will follow these Community Impact Guidelines in determining
72
+ the consequences for any action they deem in violation of this Code of Conduct:
73
+
74
+ ### 1. Correction
75
+
76
+ **Community Impact**: Use of inappropriate language or other behavior deemed
77
+ unprofessional or unwelcome in the community.
78
+
79
+ **Consequence**: A private, written warning from community leaders, providing
80
+ clarity around the nature of the violation and an explanation of why the
81
+ behavior was inappropriate. A public apology may be requested.
82
+
83
+ ### 2. Warning
84
+
85
+ **Community Impact**: A violation through a single incident or series of
86
+ actions.
87
+
88
+ **Consequence**: A warning with consequences for continued behavior. No
89
+ interaction with the people involved, including unsolicited interaction with
90
+ those enforcing the Code of Conduct, for a specified period of time. This
91
+ includes avoiding interactions in community spaces as well as external channels
92
+ like social media. Violating these terms may lead to a temporary or permanent
93
+ ban.
94
+
95
+ ### 3. Temporary Ban
96
+
97
+ **Community Impact**: A serious violation of community standards, including
98
+ sustained inappropriate behavior.
99
+
100
+ **Consequence**: A temporary ban from any sort of interaction or public
101
+ communication with the community for a specified period of time. No public or
102
+ private interaction with the people involved, including unsolicited interaction
103
+ with those enforcing the Code of Conduct, is allowed during this period.
104
+ Violating these terms may lead to a permanent ban.
105
+
106
+ ### 4. Permanent Ban
107
+
108
+ **Community Impact**: Demonstrating a pattern of violation of community
109
+ standards, including sustained inappropriate behavior, harassment of an
110
+ individual, or aggression toward or disparagement of classes of individuals.
111
+
112
+ **Consequence**: A permanent ban from any sort of public interaction within the
113
+ community.
114
+
115
+ ## Attribution
116
+
117
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage],
118
+ version 2.1, available at
119
+ [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1].
120
+
121
+ Community Impact Guidelines were inspired by
122
+ [Mozilla's code of conduct enforcement ladder][Mozilla CoC].
123
+
124
+ For answers to common questions about this code of conduct, see the FAQ at
125
+ [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at
126
+ [https://www.contributor-covenant.org/translations][translations].
127
+
128
+ [homepage]: https://www.contributor-covenant.org
129
+ [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html
130
+ [Mozilla CoC]: https://github.com/mozilla/diversity
131
+ [FAQ]: https://www.contributor-covenant.org/faq
132
+ [translations]: https://www.contributor-covenant.org/translations
data/LICENSE.txt ADDED
@@ -0,0 +1,21 @@
1
+ The MIT License (MIT)
2
+
3
+ Copyright (c) 2025 Lien Van Den Steen
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 ADDED
@@ -0,0 +1,50 @@
1
+ # Ashby
2
+
3
+ ## Installation
4
+
5
+ Install the gem and add to the application's Gemfile by executing:
6
+
7
+ ```bash
8
+ bundle add ashby
9
+ ```
10
+
11
+ If bundler is not being used to manage dependencies, install the gem by executing:
12
+
13
+ ```bash
14
+ gem install ashby
15
+ ```
16
+
17
+ ## Usage
18
+
19
+ First you will have to confige the gem. You need to setup an API token on Ashby. Once you've retrieved that, you are ready:
20
+
21
+ ```ruby
22
+ Ashby.configure do |config|
23
+ config.api_token = ENV.fetch('ASHBY_API_TOKEN', nil)
24
+ end
25
+ ```
26
+
27
+ Then once you have the client setup, you can call the API. Some examples:
28
+
29
+ ```ruby
30
+ Ashby::JobBoards.all
31
+ Ashby::Applications.find_by_id(application_id)
32
+ ```
33
+
34
+ ## Development
35
+
36
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
37
+
38
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
39
+
40
+ ## Contributing
41
+
42
+ Bug reports and pull requests are welcome on GitHub at https://github.com/lienvdsteen/ashby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/lienvdsteen/ashby/blob/main/CODE_OF_CONDUCT.md).
43
+
44
+ ## License
45
+
46
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
47
+
48
+ ## Code of Conduct
49
+
50
+ Everyone interacting in the Ashby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/lienvdsteen/ashby/blob/main/CODE_OF_CONDUCT.md).
data/Rakefile ADDED
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ require 'rubocop/rake_task'
9
+
10
+ RuboCop::RakeTask.new
11
+
12
+ task default: %i[spec rubocop]
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ashby
4
+ # Ashby::Applications provides access to job application-related operations via the Ashby API.
5
+ #
6
+ # Supported functionality includes:
7
+ # - Retrieving a paginated list of all applications
8
+ # - Fetching a specific application by its ID
9
+ #
10
+ # Example usage:
11
+ # Ashby::Applications.all
12
+ # Ashby::Applications.find_by_id(id: 'app_abc123')
13
+ #
14
+ class Applications < Client
15
+ # Fetches all openings with pagination support
16
+ def self.all(payload = {})
17
+ paginated_post('application.list', payload)
18
+ end
19
+
20
+ # Finds an opening by its Ashby ID
21
+ def self.find_by_id(id: nil, expand: '')
22
+ raise ArgumentError, 'Application ID is required' if id.to_s.strip.empty?
23
+
24
+ payload = {
25
+ applicationId: id,
26
+ expand: expand.strip.empty? ? [] : [expand]
27
+ }
28
+ response = post('application.info', payload)
29
+ response['results']
30
+ end
31
+ end
32
+ end
@@ -0,0 +1,63 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ashby
4
+ # Ashby::Candidates provides access to candidate-related functionality in the Ashby API.
5
+ #
6
+ # Includes support for:
7
+ # - Fetching all candidates (with pagination)
8
+ # - Searching by email or name
9
+ # - Looking up by ID
10
+ # - Adding notes to candidate profiles in plain text or HTML
11
+ #
12
+ # Example:
13
+ # Ashby::Candidates.all
14
+ # Ashby::Candidates.find(email: 'jane@company.com')
15
+ # Ashby::Candidates.find_by_id(id: 'cand_abc123')
16
+ #
17
+ # client = Ashby::Candidates.new
18
+ # client.create_candidate_note('cand_abc123', 'Reached out via email.')
19
+ # client.create_formatted_candidate_note('cand_abc123', title: 'Initial Contact',
20
+ # content: 'Spoke with Jane over Zoom.')
21
+ #
22
+ class Candidates < Client
23
+ # Fetches all candidates with pagination support
24
+ def self.all
25
+ paginated_post('candidate.list')
26
+ end
27
+
28
+ # Finds a candidate by their email or name
29
+ def self.find(email: nil, name: nil)
30
+ payload = {}
31
+ payload[:email] = email if email
32
+ payload[:name] = name if name
33
+
34
+ raise ArgumentError, 'You must provide at least an email or a name' if payload.empty?
35
+
36
+ response = post('candidate.search', payload)
37
+ response['results']
38
+ end
39
+
40
+ # Finds a candidate by their Ashby ID
41
+ def self.find_by_id(id: nil)
42
+ raise ArgumentError, 'Candidate ID is required' if id.to_s.strip.empty?
43
+
44
+ payload = { id: id }
45
+ response = post('candidate.info', payload)
46
+ response['results']
47
+ end
48
+
49
+ # Creates a note on a candidates profile
50
+ def self.create_candidate_note(candidate_id, note_content, send_notifications: false)
51
+ payload = {
52
+ candidateId: candidate_id,
53
+ note: note_content,
54
+ sendNotifications: send_notifications
55
+ }
56
+
57
+ response = post('candidate.createNote', payload)
58
+ raise "Failed to create note: #{response['error']}" unless response['success']
59
+
60
+ response['results']
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,75 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'rest-client'
4
+ require 'json'
5
+
6
+ module Ashby
7
+ # Ashby::Client is a low-level internal class that provides HTTP communication
8
+ # with the Ashby API.
9
+ #
10
+ # It defines base `post` and `paginated_post` methods for making JSON API calls,
11
+ # managing authentication, and handling paginated responses.
12
+ #
13
+ # This class is extended by endpoint-specific service classes (e.g., Jobs, Offers).
14
+ #
15
+ # Example usage:
16
+ # Ashby::Client.post('job.info', { id: 'job_abc123' })
17
+ # Ashby::Client.paginated_post('job.list')
18
+ #
19
+ # Note:
20
+ # Ensure `Ashby.api_token` is set before making requests.
21
+ #
22
+ # TODO:
23
+ # Consider implementing syncToken support for incremental pagination.
24
+ #
25
+ class Client
26
+ API_URL = 'https://api.ashbyhq.com'
27
+
28
+ def self.post(path, payload = {})
29
+ url = build_url(path, {})
30
+ response = RestClient.post(url, payload.to_json, headers.merge({ content_type: :json }))
31
+ JSON.parse(response.body)
32
+ end
33
+
34
+ def self.paginated_post(path, payload = {}, limit: 100) # rubocop:disable Metrics/MethodLength
35
+ all_results = []
36
+ cursor = nil
37
+
38
+ loop do
39
+ paginated_payload = payload.dup
40
+ paginated_payload[:limit] = limit
41
+ paginated_payload[:cursor] = cursor if cursor
42
+
43
+ response = post(path, paginated_payload)
44
+
45
+ page_results = response['data'] || response['results'] || response
46
+
47
+ if page_results.is_a?(Array)
48
+ all_results.concat(page_results)
49
+ else
50
+ all_results << page_results
51
+ end
52
+
53
+ break unless response['moreDataAvailable'] && response['nextCursor']
54
+
55
+ cursor = response['nextCursor']
56
+ end
57
+
58
+ all_results
59
+ end
60
+
61
+ def self.build_url(path, params)
62
+ url = "#{API_URL}/#{path}"
63
+ url += "?#{URI.encode_www_form(params)}" unless params.empty?
64
+ url
65
+ end
66
+
67
+ def self.headers
68
+ token = "#{Ashby.api_token}:"
69
+ {
70
+ Accept: 'application/json',
71
+ Authorization: "Basic #{Base64.strict_encode64(token)}"
72
+ }
73
+ end
74
+ end
75
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ashby
4
+ # Ashby::CloseReasons provides access to close reason related functionality in the Ashby API.
5
+ #
6
+ # Includes support for:
7
+ # - Fetching all close reasons (with pagination)
8
+ #
9
+ # Example:
10
+ # Ashby::CloseReasons.all
11
+ #
12
+ class CloseReasons < Client
13
+ # Fetches all openings with pagination support
14
+ def self.all
15
+ response = post('closeReason.list')
16
+ response['results']
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,42 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Ashby
4
+ # Ashby::Configuration manages global settings for the Ashby API client.
5
+ #
6
+ # This module is intended to be extended by a class or module that needs
7
+ # to hold configuration settings such as the API token.
8
+ #
9
+ # Example:
10
+ # Ashby::Configuration.configure do |config|
11
+ # config.api_token = 'your-token'
12
+ # end
13
+ #
14
+ # Ashby::Configuration.config
15
+ # # => { api_token: 'your-token' }
16
+ #
17
+ module Configuration
18
+ VALID_OPTIONS_KEYS = %i[api_token].freeze
19
+ attr_accessor(*VALID_OPTIONS_KEYS)
20
+
21
+ # Sets all configuration options to their default values
22
+ # when this module is extended.
23
+ def self.extended(base)
24
+ base.reset
25
+ end
26
+
27
+ def configure
28
+ yield self
29
+ end
30
+
31
+ def config
32
+ VALID_OPTIONS_KEYS.inject({}) do |option, key|
33
+ option.merge!(key => send(key))
34
+ end
35
+ end
36
+
37
+ # Resets all configuration options to the defaults.
38
+ def reset
39
+ self.api_token = nil
40
+ end
41
+ end
42
+ end