Skip to content

Commit 6878100

Browse files
authored
Merge pull request #19 from merge-api/fern/010
Bump SDK to match Merge API, April 2024
2 parents ea2d96e + cbb832e commit 6878100

File tree

1,393 files changed

+101464
-65031
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,393 files changed

+101464
-65031
lines changed

Gemfile.lock

Lines changed: 101 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
PATH
2+
remote: .
3+
specs:
4+
merge_ruby_client (0.1.0)
5+
async-http-faraday (>= 0.0, < 1.0)
6+
faraday (>= 1.10, < 3.0)
7+
faraday-multipart (>= 0.0, < 2.0)
8+
faraday-net_http (>= 1.0, < 4.0)
9+
faraday-retry (>= 1.0, < 3.0)
10+
mini_mime
11+
12+
GEM
13+
remote: https://rubygems.org/
14+
specs:
15+
ast (2.4.2)
16+
async (1.32.1)
17+
console (~> 1.10)
18+
nio4r (~> 2.3)
19+
timers (~> 4.1)
20+
async-http (0.60.2)
21+
async (>= 1.25)
22+
async-io (>= 1.28)
23+
async-pool (>= 0.2)
24+
protocol-http (~> 0.24.0)
25+
protocol-http1 (~> 0.15.0)
26+
protocol-http2 (~> 0.15.0)
27+
traces (>= 0.10.0)
28+
async-http-faraday (0.12.0)
29+
async-http (~> 0.42)
30+
faraday
31+
async-io (1.43.2)
32+
async
33+
async-pool (0.4.0)
34+
async (>= 1.25)
35+
base64 (0.2.0)
36+
console (1.19.0)
37+
fiber-annotation
38+
fiber-local
39+
faraday (2.8.1)
40+
base64
41+
faraday-net_http (>= 2.0, < 3.1)
42+
ruby2_keywords (>= 0.0.4)
43+
faraday-multipart (1.0.4)
44+
multipart-post (~> 2)
45+
faraday-net_http (3.0.2)
46+
faraday-retry (2.2.1)
47+
faraday (~> 2.0)
48+
fiber-annotation (0.2.0)
49+
fiber-local (1.0.0)
50+
json (2.7.1)
51+
language_server-protocol (3.17.0.3)
52+
mini_mime (1.1.5)
53+
minitest (5.22.2)
54+
multipart-post (2.4.0)
55+
nio4r (2.7.1)
56+
parallel (1.24.0)
57+
parser (3.3.0.5)
58+
ast (~> 2.4.1)
59+
racc
60+
protocol-hpack (1.4.2)
61+
protocol-http (0.24.7)
62+
protocol-http1 (0.15.1)
63+
protocol-http (~> 0.22)
64+
protocol-http2 (0.15.1)
65+
protocol-hpack (~> 1.4)
66+
protocol-http (~> 0.18)
67+
racc (1.7.3)
68+
rainbow (3.1.1)
69+
rake (13.1.0)
70+
regexp_parser (2.9.0)
71+
rexml (3.2.6)
72+
rubocop (1.60.2)
73+
json (~> 2.3)
74+
language_server-protocol (>= 3.17.0)
75+
parallel (~> 1.10)
76+
parser (>= 3.3.0.2)
77+
rainbow (>= 2.2.2, < 4.0)
78+
regexp_parser (>= 1.8, < 3.0)
79+
rexml (>= 3.2.5, < 4.0)
80+
rubocop-ast (>= 1.30.0, < 2.0)
81+
ruby-progressbar (~> 1.7)
82+
unicode-display_width (>= 2.4.0, < 3.0)
83+
rubocop-ast (1.30.0)
84+
parser (>= 3.2.1.0)
85+
ruby-progressbar (1.13.0)
86+
ruby2_keywords (0.0.5)
87+
timers (4.3.5)
88+
traces (0.11.1)
89+
unicode-display_width (2.5.0)
90+
91+
PLATFORMS
92+
ruby
93+
94+
DEPENDENCIES
95+
merge_ruby_client!
96+
minitest (~> 5.0)
97+
rake (~> 13.0)
98+
rubocop (~> 1.21)
99+
100+
BUNDLED WITH
101+
2.1.4

lib/merge_ruby_client.rb

Lines changed: 63 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -5,53 +5,89 @@
55
require_relative "requests"
66
require_relative "merge_ruby_client/ats/client"
77
require_relative "merge_ruby_client/crm/client"
8+
require_relative "merge_ruby_client/ticketing/client"
89
require_relative "merge_ruby_client/filestorage/client"
910
require_relative "merge_ruby_client/hris/client"
10-
require_relative "merge_ruby_client/ticketing/client"
1111
require_relative "merge_ruby_client/accounting/client"
1212

1313
module Merge
1414
class Client
15-
attr_reader :ats, :crm, :filestorage, :hris, :ticketing, :accounting
15+
# @return [Merge::Ats::Client]
16+
attr_reader :ats
17+
# @return [Merge::Crm::Client]
18+
attr_reader :crm
19+
# @return [Merge::Ticketing::Client]
20+
attr_reader :ticketing
21+
# @return [Merge::Filestorage::Client]
22+
attr_reader :filestorage
23+
# @return [Merge::Hris::Client]
24+
attr_reader :hris
25+
# @return [Merge::Accounting::Client]
26+
attr_reader :accounting
1627

17-
# @param environment [Environment]
28+
# @param environment [Merge::Environment]
29+
# @param base_url [String]
1830
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
1931
# @param timeout_in_seconds [Long]
2032
# @param api_key [String]
2133
# @param account_token [String] Token identifying the end user.
22-
# @return [Client]
23-
def initialize(api_key:, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil,
24-
account_token: nil)
25-
@request_client = RequestClient.new(environment: environment, max_retries: max_retries,
26-
timeout_in_seconds: timeout_in_seconds, api_key: api_key, account_token: account_token)
27-
@ats = Ats::Client.new(request_client: @request_client)
28-
@crm = Crm::Client.new(request_client: @request_client)
29-
@filestorage = Filestorage::Client.new(request_client: @request_client)
30-
@hris = Hris::Client.new(request_client: @request_client)
31-
@ticketing = Ticketing::Client.new(request_client: @request_client)
32-
@accounting = Accounting::Client.new(request_client: @request_client)
34+
# @return [Merge::Client]
35+
def initialize(api_key:, environment: Environment::PRODUCTION, base_url: nil, max_retries: nil,
36+
timeout_in_seconds: nil, account_token: nil)
37+
@request_client = Merge::RequestClient.new(
38+
environment: environment,
39+
base_url: base_url,
40+
max_retries: max_retries,
41+
timeout_in_seconds: timeout_in_seconds,
42+
api_key: api_key,
43+
account_token: account_token
44+
)
45+
@ats = Merge::Ats::Client.new(request_client: @request_client)
46+
@crm = Merge::Crm::Client.new(request_client: @request_client)
47+
@ticketing = Merge::Ticketing::Client.new(request_client: @request_client)
48+
@filestorage = Merge::Filestorage::Client.new(request_client: @request_client)
49+
@hris = Merge::Hris::Client.new(request_client: @request_client)
50+
@accounting = Merge::Accounting::Client.new(request_client: @request_client)
3351
end
3452
end
3553

3654
class AsyncClient
37-
attr_reader :ats, :crm, :filestorage, :hris, :ticketing, :accounting
55+
# @return [Merge::Ats::AsyncClient]
56+
attr_reader :ats
57+
# @return [Merge::Crm::AsyncClient]
58+
attr_reader :crm
59+
# @return [Merge::Ticketing::AsyncClient]
60+
attr_reader :ticketing
61+
# @return [Merge::Filestorage::AsyncClient]
62+
attr_reader :filestorage
63+
# @return [Merge::Hris::AsyncClient]
64+
attr_reader :hris
65+
# @return [Merge::Accounting::AsyncClient]
66+
attr_reader :accounting
3867

39-
# @param environment [Environment]
68+
# @param environment [Merge::Environment]
69+
# @param base_url [String]
4070
# @param max_retries [Long] The number of times to retry a failed request, defaults to 2.
4171
# @param timeout_in_seconds [Long]
4272
# @param api_key [String]
4373
# @param account_token [String] Token identifying the end user.
44-
# @return [AsyncClient]
45-
def initialize(api_key:, environment: Environment::PRODUCTION, max_retries: nil, timeout_in_seconds: nil,
46-
account_token: nil)
47-
@async_request_client = AsyncRequestClient.new(environment: environment, max_retries: max_retries,
48-
timeout_in_seconds: timeout_in_seconds, api_key: api_key, account_token: account_token)
49-
@ats = Ats::AsyncClient.new(request_client: @async_request_client)
50-
@crm = Crm::AsyncClient.new(request_client: @async_request_client)
51-
@filestorage = Filestorage::AsyncClient.new(request_client: @async_request_client)
52-
@hris = Hris::AsyncClient.new(request_client: @async_request_client)
53-
@ticketing = Ticketing::AsyncClient.new(request_client: @async_request_client)
54-
@accounting = Accounting::AsyncClient.new(request_client: @async_request_client)
74+
# @return [Merge::AsyncClient]
75+
def initialize(api_key:, environment: Environment::PRODUCTION, base_url: nil, max_retries: nil,
76+
timeout_in_seconds: nil, account_token: nil)
77+
@async_request_client = Merge::AsyncRequestClient.new(
78+
environment: environment,
79+
base_url: base_url,
80+
max_retries: max_retries,
81+
timeout_in_seconds: timeout_in_seconds,
82+
api_key: api_key,
83+
account_token: account_token
84+
)
85+
@ats = Merge::Ats::AsyncClient.new(request_client: @async_request_client)
86+
@crm = Merge::Crm::AsyncClient.new(request_client: @async_request_client)
87+
@ticketing = Merge::Ticketing::AsyncClient.new(request_client: @async_request_client)
88+
@filestorage = Merge::Filestorage::AsyncClient.new(request_client: @async_request_client)
89+
@hris = Merge::Hris::AsyncClient.new(request_client: @async_request_client)
90+
@accounting = Merge::Accounting::AsyncClient.new(request_client: @async_request_client)
5591
end
5692
end
5793
end

lib/merge_ruby_client/accounting/account_details/client.rb

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,53 +7,69 @@
77
module Merge
88
module Accounting
99
class AccountDetailsClient
10+
# @return [Merge::RequestClient]
1011
attr_reader :request_client
1112

12-
# @param request_client [RequestClient]
13-
# @return [Accounting::AccountDetailsClient]
13+
# @param request_client [Merge::RequestClient]
14+
# @return [Merge::Accounting::AccountDetailsClient]
1415
def initialize(request_client:)
15-
# @type [RequestClient]
1616
@request_client = request_client
1717
end
1818

1919
# Get details for a linked account.
2020
#
21-
# @param request_options [RequestOptions]
22-
# @return [Accounting::AccountDetails]
21+
# @param request_options [Merge::RequestOptions]
22+
# @return [Merge::Accounting::AccountDetails]
23+
# @example
24+
# api = Merge::Client.new(
25+
# environment: Environment::PRODUCTION,
26+
# base_url: "https://api.example.com",
27+
# api_key: "YOUR_AUTH_TOKEN"
28+
# )
29+
# api.accounting.retrieve
2330
def retrieve(request_options: nil)
24-
response = @request_client.conn.get("/api/accounting/v1/account-details") do |req|
31+
response = @request_client.conn.get do |req|
2532
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
2633
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
2734
req.headers["X-Account-Token"] = request_options.account_token unless request_options&.account_token.nil?
2835
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
36+
req.url "#{@request_client.get_url(request_options: request_options)}/accounting/v1/account-details"
2937
end
30-
Accounting::AccountDetails.from_json(json_object: response.body)
38+
Merge::Accounting::AccountDetails.from_json(json_object: response.body)
3139
end
3240
end
3341

3442
class AsyncAccountDetailsClient
43+
# @return [Merge::AsyncRequestClient]
3544
attr_reader :request_client
3645

37-
# @param request_client [AsyncRequestClient]
38-
# @return [Accounting::AsyncAccountDetailsClient]
46+
# @param request_client [Merge::AsyncRequestClient]
47+
# @return [Merge::Accounting::AsyncAccountDetailsClient]
3948
def initialize(request_client:)
40-
# @type [AsyncRequestClient]
4149
@request_client = request_client
4250
end
4351

4452
# Get details for a linked account.
4553
#
46-
# @param request_options [RequestOptions]
47-
# @return [Accounting::AccountDetails]
54+
# @param request_options [Merge::RequestOptions]
55+
# @return [Merge::Accounting::AccountDetails]
56+
# @example
57+
# api = Merge::Client.new(
58+
# environment: Environment::PRODUCTION,
59+
# base_url: "https://api.example.com",
60+
# api_key: "YOUR_AUTH_TOKEN"
61+
# )
62+
# api.accounting.retrieve
4863
def retrieve(request_options: nil)
4964
Async do
50-
response = @request_client.conn.get("/api/accounting/v1/account-details") do |req|
65+
response = @request_client.conn.get do |req|
5166
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
5267
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
5368
req.headers["X-Account-Token"] = request_options.account_token unless request_options&.account_token.nil?
5469
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
70+
req.url "#{@request_client.get_url(request_options: request_options)}/accounting/v1/account-details"
5571
end
56-
Accounting::AccountDetails.from_json(json_object: response.body)
72+
Merge::Accounting::AccountDetails.from_json(json_object: response.body)
5773
end
5874
end
5975
end

lib/merge_ruby_client/accounting/account_token/client.rb

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,71 @@
77
module Merge
88
module Accounting
99
class AccountTokenClient
10+
# @return [Merge::RequestClient]
1011
attr_reader :request_client
1112

12-
# @param request_client [RequestClient]
13-
# @return [Accounting::AccountTokenClient]
13+
# @param request_client [Merge::RequestClient]
14+
# @return [Merge::Accounting::AccountTokenClient]
1415
def initialize(request_client:)
15-
# @type [RequestClient]
1616
@request_client = request_client
1717
end
1818

1919
# Returns the account token for the end user with the provided public token.
2020
#
2121
# @param public_token [String]
22-
# @param request_options [RequestOptions]
23-
# @return [Accounting::AccountToken]
22+
# @param request_options [Merge::RequestOptions]
23+
# @return [Merge::Accounting::AccountToken]
24+
# @example
25+
# api = Merge::Client.new(
26+
# environment: Environment::PRODUCTION,
27+
# base_url: "https://api.example.com",
28+
# api_key: "YOUR_AUTH_TOKEN"
29+
# )
30+
# api.accounting.retrieve(public_token: "public_token")
2431
def retrieve(public_token:, request_options: nil)
25-
response = @request_client.conn.get("/api/accounting/v1/account-token/#{public_token}") do |req|
32+
response = @request_client.conn.get do |req|
2633
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
2734
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
2835
req.headers["X-Account-Token"] = request_options.account_token unless request_options&.account_token.nil?
2936
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
37+
req.url "#{@request_client.get_url(request_options: request_options)}/accounting/v1/account-token/#{public_token}"
3038
end
31-
Accounting::AccountToken.from_json(json_object: response.body)
39+
Merge::Accounting::AccountToken.from_json(json_object: response.body)
3240
end
3341
end
3442

3543
class AsyncAccountTokenClient
44+
# @return [Merge::AsyncRequestClient]
3645
attr_reader :request_client
3746

38-
# @param request_client [AsyncRequestClient]
39-
# @return [Accounting::AsyncAccountTokenClient]
47+
# @param request_client [Merge::AsyncRequestClient]
48+
# @return [Merge::Accounting::AsyncAccountTokenClient]
4049
def initialize(request_client:)
41-
# @type [AsyncRequestClient]
4250
@request_client = request_client
4351
end
4452

4553
# Returns the account token for the end user with the provided public token.
4654
#
4755
# @param public_token [String]
48-
# @param request_options [RequestOptions]
49-
# @return [Accounting::AccountToken]
56+
# @param request_options [Merge::RequestOptions]
57+
# @return [Merge::Accounting::AccountToken]
58+
# @example
59+
# api = Merge::Client.new(
60+
# environment: Environment::PRODUCTION,
61+
# base_url: "https://api.example.com",
62+
# api_key: "YOUR_AUTH_TOKEN"
63+
# )
64+
# api.accounting.retrieve(public_token: "public_token")
5065
def retrieve(public_token:, request_options: nil)
5166
Async do
52-
response = @request_client.conn.get("/api/accounting/v1/account-token/#{public_token}") do |req|
67+
response = @request_client.conn.get do |req|
5368
req.options.timeout = request_options.timeout_in_seconds unless request_options&.timeout_in_seconds.nil?
5469
req.headers["Authorization"] = request_options.api_key unless request_options&.api_key.nil?
5570
req.headers["X-Account-Token"] = request_options.account_token unless request_options&.account_token.nil?
5671
req.headers = { **req.headers, **(request_options&.additional_headers || {}) }.compact
72+
req.url "#{@request_client.get_url(request_options: request_options)}/accounting/v1/account-token/#{public_token}"
5773
end
58-
Accounting::AccountToken.from_json(json_object: response.body)
74+
Merge::Accounting::AccountToken.from_json(json_object: response.body)
5975
end
6076
end
6177
end

0 commit comments

Comments
 (0)