The Merge Ruby library provides access to the Merge API from Ruby.
API reference documentation is available here.
Install the gem and add to the application's Gemfile by executing:
bundle add merge_ruby_clientIf bundler is not being used to manage dependencies, install the gem by executing:
gem install merge_ruby_clientrequire "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY',
account_token: 'YOUR_ACCOUNT_TOKEN'
)This SDK contains the ATS, HRIS, CRM, Ticketing, Accounting, and File Storage categories. Even if you do not plan on using more than one Merge API category right now, the SDK provides upgrade-flexibility in case you find new Merge API categories useful in the future.
Each category is namespaced:
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY',
account_token: 'YOUR_ACCOUNT_TOKEN'
)
merge.ats. # APIs specific to the ATS Category
merge.hris. # APIs specific to the HRIS CategoryBelow are code snippets of how you can use the Ruby SDK.
require "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY'
)
link_token_response = merge.ats.link_token.create(
end_user_email_address: "[email protected]",
end_user_organization_name: "acme",
end_user_origin_id: "1234",
categories: [Merge::Ats::CATEGORIES_ENUM[:ats]],
link_expiry_mins: 30,
)
puts link_token_response.link_tokenrequire "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY'
)
account_token_response = merge.ats.account_token.retrieve(public_token: PUBLIC_TOKEN)
puts account_token_response.account_tokenrequire "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY',
account_token: 'YOUR_ACCOUNT_TOKEN'
)
employee = merge.hris.employees.retrieve(id: EMPLOYEE_ID)require "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY',
account_token: 'YOUR_ACCOUNT_TOKEN'
)
candidate = merge.ats.candidates.retrieve(id: CANDIDATE_ID)require "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY',
account_token: 'YOUR_ACCOUNT_TOKEN'
)
candidates_response = merge.ats.candidates.list(created_after: "2030-01-01")
puts candidates_response.resultsrequire "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY',
account_token: 'YOUR_ACCOUNT_TOKEN'
)
merge.accounting.contacts.retrieve(id: CONTACT_ID)require "merge_ruby_client"
merge = Merge::Client.new(
api_key: 'YOUR_API_KEY',
account_token: 'YOUR_ACCOUNT_TOKEN'
)
merge.ticketing.tickets.create(
model: {
name: "Please add more integrations",
assignees: ["17a54124-287f-494d-965e-3c5b330c9a68"],
creator: "3fa85f64-5717-4562-b3fc-2c963f66afa6",
due_date: "2022-10-11T00:00:00Z",
status: Merge::Ticketing::TICKET_STATUS_ENUM[:open]
},
)While we value open-source contributions to this SDK, this library is generated programmatically. Additions made directly to this library would have to be moved over to our generation code, otherwise they would be overwritten upon the next generated release. Feel free to open a PR as a proof of concept, but know that we will not be able to merge it as-is. We suggest opening an issue first to discuss with us!
On the other hand, contributions to the README are always very welcome!