smarthr 0.0.1
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 +7 -0
- data/.gitignore +11 -0
- data/CHANGELOG.md +6 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +21 -0
- data/README.md +48 -0
- data/lib/smarthr.rb +39 -0
- data/lib/smarthr/client.rb +89 -0
- data/lib/smarthr/client/bank_account_setting_methods.rb +21 -0
- data/lib/smarthr/client/biz_establishment_methods.rb +27 -0
- data/lib/smarthr/client/crew_custom_field_template_group_methods.rb +83 -0
- data/lib/smarthr/client/crew_custom_field_template_methods.rb +83 -0
- data/lib/smarthr/client/crew_input_form_method.rb +39 -0
- data/lib/smarthr/client/crew_methods.rb +132 -0
- data/lib/smarthr/client/department_methods.rb +84 -0
- data/lib/smarthr/client/dependent_methods.rb +85 -0
- data/lib/smarthr/client/dependent_relation_methods.rb +23 -0
- data/lib/smarthr/client/employment_type_methods.rb +80 -0
- data/lib/smarthr/client/job_title_methods.rb +80 -0
- data/lib/smarthr/client/mail_format_methods.rb +39 -0
- data/lib/smarthr/client/payment_period_methods.rb +36 -0
- data/lib/smarthr/client/user_methods.rb +39 -0
- data/lib/smarthr/client/webhook_methods.rb +80 -0
- data/lib/smarthr/converter.rb +7 -0
- data/lib/smarthr/version.rb +3 -0
- data/smarthr.gemspec +31 -0
- metadata +113 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 863f1a89c94dfde946b0fcf6c7dbdabd92ea0169bf3185c9ec8c3999606a50e9
|
4
|
+
data.tar.gz: 261cf19e10e729459df13d497c266e8ea58659c14fab1422dd21ae5f7b7d3215
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 890a06f5acb6ca5ba072a43017aeffaa398ca2f71cf664afbe5b7219c85c84749462f336a19863ffdb9e101c94140e4b9c8322a8b5bdbfa158713183f03e3d9f
|
7
|
+
data.tar.gz: 3a123c367118fb0626b75bc225f21cb5ff1c43ccfce1b5512982981fe1b21d48049da182b65adc3af87cdaf5f4664696e965b5c87de03dc7e2e35d622848758b
|
data/.gitignore
ADDED
data/CHANGELOG.md
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Proxyworks, Inc.
|
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,48 @@
|
|
1
|
+
# SmartHR
|
2
|
+
|
3
|
+
Ruby bindings of SmartHR API
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
```ruby
|
8
|
+
gem 'smarthr'
|
9
|
+
```
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle install
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install smarthr
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
client = SmartHR::Client.new(tenant_id: "XXX", access_token: "XXX")
|
23
|
+
# for Sandbox
|
24
|
+
client = SmartHR::Client.new(tenant_id: "XXX", access_token: "XXX", sandbox: true)
|
25
|
+
```
|
26
|
+
|
27
|
+
Then call instance methods.
|
28
|
+
|
29
|
+
e.g. find crew.
|
30
|
+
|
31
|
+
```
|
32
|
+
client.find_crew(id: '906494aa-11bf-4324-91ea-6a07aad172d0')
|
33
|
+
#=> #<Hashie::Mash id="906494aa-11bf-4324-91ea-6a07aad172d0">
|
34
|
+
```
|
35
|
+
|
36
|
+
|
37
|
+
## Contributing
|
38
|
+
|
39
|
+
1. Fork it
|
40
|
+
1. Create your feature branch (`git checkout -b my-new-feature`)
|
41
|
+
1. Commit your changes (`git commit -am 'Add some feature'`)
|
42
|
+
1. Push to the branch (`git push origin my-new-feature`)
|
43
|
+
1. Create new Pull Request
|
44
|
+
|
45
|
+
|
46
|
+
## License
|
47
|
+
|
48
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/lib/smarthr.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require "smarthr/version"
|
2
|
+
|
3
|
+
module SmartHR
|
4
|
+
autoload :Client, "smarthr/client"
|
5
|
+
autoload :Converter, "smarthr/converter"
|
6
|
+
|
7
|
+
class Error < StandardError
|
8
|
+
def self.from_response(status, body)
|
9
|
+
APIConnectionError.new("Invalid response #{body.to_hash} (status: #{status})")
|
10
|
+
end
|
11
|
+
|
12
|
+
attr_reader :status
|
13
|
+
attr_reader :error_response
|
14
|
+
|
15
|
+
def initialize(message, status = nil, error_response = nil)
|
16
|
+
@status = status
|
17
|
+
@error_response = error_response
|
18
|
+
super(message)
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
class APIConnectionError < SmartHR::Error
|
23
|
+
def self.faraday_error(e)
|
24
|
+
new("Connection with SmartHR API server failed. #{e.message}", e)
|
25
|
+
end
|
26
|
+
|
27
|
+
attr_reader :original_error
|
28
|
+
|
29
|
+
def initialize(message, original_error = nil)
|
30
|
+
@original_error = original_error
|
31
|
+
|
32
|
+
if original_error && original_error.response.is_a?(Hash)
|
33
|
+
super(message, original_error.response[:status], original_error.response[:body])
|
34
|
+
else
|
35
|
+
super(message)
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,89 @@
|
|
1
|
+
require "faraday"
|
2
|
+
require "faraday_middleware"
|
3
|
+
|
4
|
+
module SmartHR
|
5
|
+
class Client
|
6
|
+
require "smarthr/client/bank_account_setting_methods"
|
7
|
+
require "smarthr/client/biz_establishment_methods"
|
8
|
+
require "smarthr/client/crew_custom_field_template_group_methods"
|
9
|
+
require "smarthr/client/crew_custom_field_template_methods"
|
10
|
+
require "smarthr/client/crew_input_form_method"
|
11
|
+
require "smarthr/client/crew_methods"
|
12
|
+
require "smarthr/client/department_methods"
|
13
|
+
require "smarthr/client/dependent_methods"
|
14
|
+
require "smarthr/client/dependent_relation_methods"
|
15
|
+
require "smarthr/client/employment_type_methods"
|
16
|
+
require "smarthr/client/job_title_methods"
|
17
|
+
require "smarthr/client/mail_format_methods"
|
18
|
+
require "smarthr/client/payment_period_methods"
|
19
|
+
require "smarthr/client/user_methods"
|
20
|
+
require "smarthr/client/webhook_methods"
|
21
|
+
|
22
|
+
include Converter
|
23
|
+
include BankAccountSettingMethods
|
24
|
+
include BizEstablishmentMethods
|
25
|
+
include CrewCustomFieldTemplateGroupMethods
|
26
|
+
include CrewCustomFieldTemplateMethods
|
27
|
+
include CrewInputFormMethods
|
28
|
+
include CrewMethods
|
29
|
+
include DepartmentMethods
|
30
|
+
include DependentMethods
|
31
|
+
include DependentRelationMethods
|
32
|
+
include EmploymentTypeMethods
|
33
|
+
include JobTitleMethods
|
34
|
+
include MailFormatMethods
|
35
|
+
include PaymentPeriodMethods
|
36
|
+
include UserMethods
|
37
|
+
include WebhookMethods
|
38
|
+
|
39
|
+
def initialize(tenant_id: nil, access_token: nil, sandbox: false, header: {}, api_version: 'v1')
|
40
|
+
raise unless tenant_id
|
41
|
+
raise unless access_token
|
42
|
+
|
43
|
+
url = sprintf(sandbox ? "https://%s.daruma.space/api/" : "https://%s.smarthr.jp/api/", tenant_id)
|
44
|
+
header.merge!({
|
45
|
+
"User-Agent" => "SmartHR/#{api_version} RubyBinding/#{SmartHR::VERSION}",
|
46
|
+
"Authorization" => "Bearer #{access_token}"
|
47
|
+
})
|
48
|
+
|
49
|
+
@conn = Faraday.new(url, headers: header) do |builder|
|
50
|
+
builder.request :url_encoded
|
51
|
+
builder.response :mashify
|
52
|
+
builder.response :json
|
53
|
+
builder.adapter Faraday.default_adapter
|
54
|
+
end
|
55
|
+
@api_version = api_version
|
56
|
+
end
|
57
|
+
|
58
|
+
def handle_response(response)
|
59
|
+
case response.status
|
60
|
+
when 200..299
|
61
|
+
response.body
|
62
|
+
else
|
63
|
+
puts response.status
|
64
|
+
puts response.body
|
65
|
+
raise SmartHR::Error.from_response(response.status, response.body)
|
66
|
+
end
|
67
|
+
end
|
68
|
+
|
69
|
+
Faraday::Connection::METHODS.each do |method|
|
70
|
+
define_method(method) do |url, args = {}, &block|
|
71
|
+
faraday_errors =
|
72
|
+
if Gem::Version.create(Faraday::VERSION) >= Gem::Version.create("1.0.0")
|
73
|
+
[Faraday::ClientError, Faraday::ServerError]
|
74
|
+
else
|
75
|
+
[Faraday::Error::ClientError]
|
76
|
+
end
|
77
|
+
|
78
|
+
begin
|
79
|
+
response = @conn.__send__(method, @api_version + url, hash_compact(args))
|
80
|
+
rescue *faraday_errors => e
|
81
|
+
raise SmartHR::APIConnectionError.faraday_error(e)
|
82
|
+
end
|
83
|
+
payload = handle_response(response)
|
84
|
+
block.call(payload, response.headers) if block
|
85
|
+
payload
|
86
|
+
end
|
87
|
+
end
|
88
|
+
end
|
89
|
+
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
module SmartHR::Client::BankAccountSettingMethods
|
2
|
+
# Get the list of bank account settings
|
3
|
+
#
|
4
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%8F%A3%E5%BA%A7%E6%83%85%E5%A0%B1/getV1BankAccountSettings
|
5
|
+
#
|
6
|
+
# @param page [Integer]
|
7
|
+
# @param per_page [Integer]
|
8
|
+
#
|
9
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
10
|
+
# @yieldparam response_body [Array<Hashie::Mash>] response body
|
11
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
12
|
+
#
|
13
|
+
# @return [Array<Hashie::Mash>]
|
14
|
+
def get_bank_account_settings(page: 1, per_page: 10, &block)
|
15
|
+
get("/bank_account_settings",
|
16
|
+
page: page,
|
17
|
+
per_page: per_page,
|
18
|
+
&block
|
19
|
+
)
|
20
|
+
end
|
21
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module SmartHR::Client::BizEstablishmentMethods
|
2
|
+
# Get the list of business establishments
|
3
|
+
#
|
4
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E4%BA%8B%E6%A5%AD%E6%89%80/getV1BizEstablishments
|
5
|
+
#
|
6
|
+
# @param page [Integer]
|
7
|
+
# @param per_page [Integer]
|
8
|
+
# @param embed_soc_ins_owner [Boolean] Whether or not to embed social insurance owner
|
9
|
+
# @param embed_lab_ins_owner [Boolean] Whether or not to embed labor insurance owner
|
10
|
+
#
|
11
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
12
|
+
# @yieldparam response_body [Array<Hashie::Mash>] response body
|
13
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
14
|
+
#
|
15
|
+
# @return [Array<Hashie::Mash>]
|
16
|
+
def get_biz_establishments(page: 1, per_page: 10, embed_soc_ins_owner: false, embed_lab_ins_owner: false, &block)
|
17
|
+
embed = embed_soc_ins_owner ? 'soc_ins_owner' : nil
|
18
|
+
embed = embed_lab_ins_owner ? 'lab_ins_owner' : nil
|
19
|
+
|
20
|
+
get("/biz_establishments",
|
21
|
+
page: page,
|
22
|
+
per_page: per_page,
|
23
|
+
embed: embed,
|
24
|
+
&block
|
25
|
+
)
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module SmartHR::Client::CrewCustomFieldTemplateGroupMethods
|
2
|
+
# Delete the crew custom field template group
|
3
|
+
#
|
4
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97/deleteV1CrewCustomFieldTemplateGroupsId
|
5
|
+
#
|
6
|
+
# @param id [String]
|
7
|
+
#
|
8
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
9
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
10
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
11
|
+
def destroy_crew_custom_field_template_group(id:, &block)
|
12
|
+
delete("/crew_custom_field_template_groups/#{id}", &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get the crew custom field template group
|
16
|
+
#
|
17
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97/getV1CrewCustomFieldTemplateGroupsId
|
18
|
+
#
|
19
|
+
# @param id [String]
|
20
|
+
# @param embed_templates [Boolean] Whether or not to embed templates
|
21
|
+
#
|
22
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
23
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
24
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
25
|
+
#
|
26
|
+
# @return [Hashie::Mash]
|
27
|
+
def find_crew_custom_field_template_group(id:, embed_templates: false, &block)
|
28
|
+
get("/crew_custom_field_template_groups/#{id}", embed: embed_templates ? 'templates' : nil, &block)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Change the data of the specified group
|
32
|
+
#
|
33
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97/getV1CrewCustomFieldTemplateGroupsId
|
34
|
+
#
|
35
|
+
# @param id [String]
|
36
|
+
# @param body [Hash]
|
37
|
+
#
|
38
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
39
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
40
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
41
|
+
#
|
42
|
+
# @return [Hashie::Mash]
|
43
|
+
def update_crew_custom_field_template_group(id:, body:, &block)
|
44
|
+
patch("/crew_custom_field_template_groups/#{id}", body, &block)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get the list of crew custom field template groups
|
48
|
+
#
|
49
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97/getV1CrewCustomFieldTemplateGroups
|
50
|
+
#
|
51
|
+
# @param page [Integer]
|
52
|
+
# @param per_page [Integer]
|
53
|
+
# @param embed_templates [Boolean] Whether or not to embed templates
|
54
|
+
#
|
55
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
56
|
+
# @yieldparam response_body [Array<Hashie::Mash>] response body
|
57
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
58
|
+
#
|
59
|
+
# @return [Array<Hashie::Mash>]
|
60
|
+
def get_crew_custom_field_template_groups(page: 1, per_page: 10, embed_templates: false, &block)
|
61
|
+
get("/crew_custom_field_template_groups",
|
62
|
+
page: page,
|
63
|
+
per_page: per_page,
|
64
|
+
embed: embed_templates ? 'templates' : nil,
|
65
|
+
&block
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Create a new crew custom field template group
|
70
|
+
#
|
71
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%82%B0%E3%83%AB%E3%83%BC%E3%83%97/postV1CrewCustomFieldTemplateGroups
|
72
|
+
#
|
73
|
+
# @param body [Hash]
|
74
|
+
#
|
75
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
76
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
77
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
78
|
+
#
|
79
|
+
# @return [Hashie::Mash]
|
80
|
+
def create_crew_custom_field_template_group(body:, &block)
|
81
|
+
post("/crew_custom_field_template_groups", body, &block)
|
82
|
+
end
|
83
|
+
end
|
@@ -0,0 +1,83 @@
|
|
1
|
+
module SmartHR::Client::CrewCustomFieldTemplateMethods
|
2
|
+
# Delete the crew custom field template
|
3
|
+
#
|
4
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88/deleteV1CrewCustomFieldTemplatesId
|
5
|
+
#
|
6
|
+
# @param id [String]
|
7
|
+
#
|
8
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
9
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
10
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
11
|
+
def destroy_crew_custom_field_template(id:, &block)
|
12
|
+
delete("/crew_custom_field_templates/#{id}", &block)
|
13
|
+
end
|
14
|
+
|
15
|
+
# Get the crew custom field template
|
16
|
+
#
|
17
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88/getV1CrewCustomFieldTemplatesId
|
18
|
+
#
|
19
|
+
# @param id [String]
|
20
|
+
# @param embed_group [Boolean] Whether or not to embed group
|
21
|
+
#
|
22
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
23
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
24
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
25
|
+
#
|
26
|
+
# @return [Hashie::Mash]
|
27
|
+
def find_crew_custom_field_template(id:, embed_group: false, &block)
|
28
|
+
get("/crew_custom_field_templates/#{id}", embed: embed_group ? 'group' : nil, &block)
|
29
|
+
end
|
30
|
+
|
31
|
+
# Change the data of the specified template
|
32
|
+
#
|
33
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88/patchV1CrewCustomFieldTemplatesId
|
34
|
+
#
|
35
|
+
# @param id [String]
|
36
|
+
# @param body [Hash]
|
37
|
+
#
|
38
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
39
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
40
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
41
|
+
#
|
42
|
+
# @return [Hashie::Mash]
|
43
|
+
def update_crew_custom_field_template(id:, body:, &block)
|
44
|
+
patch("/crew_custom_field_templates/#{id}", body, &block)
|
45
|
+
end
|
46
|
+
|
47
|
+
# Get the list of crew custom field templates
|
48
|
+
#
|
49
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88/getV1CrewCustomFieldTemplates
|
50
|
+
#
|
51
|
+
# @param page [Integer]
|
52
|
+
# @param per_page [Integer]
|
53
|
+
# @param embed_group [Boolean] Whether or not to embed group
|
54
|
+
#
|
55
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
56
|
+
# @yieldparam response_body [Array<Hashie::Mash>] response body
|
57
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
58
|
+
#
|
59
|
+
# @return [Array<Hashie::Mash>]
|
60
|
+
def get_crew_custom_field_templates(page: 1, per_page: 10, embed_group: false, &block)
|
61
|
+
get("/crew_custom_field_templates",
|
62
|
+
page: page,
|
63
|
+
per_page: per_page,
|
64
|
+
embed: embed_group ? 'group' : nil,
|
65
|
+
&block
|
66
|
+
)
|
67
|
+
end
|
68
|
+
|
69
|
+
# Create a new crew custom field template
|
70
|
+
#
|
71
|
+
# @see https://developer.smarthr.jp/api/index.html#!/%E5%BE%93%E6%A5%AD%E5%93%A1%E3%82%AB%E3%82%B9%E3%82%BF%E3%83%A0%E9%A0%85%E7%9B%AE%E3%83%86%E3%83%B3%E3%83%97%E3%83%AC%E3%83%BC%E3%83%88/postV1CrewCustomFieldTemplates
|
72
|
+
#
|
73
|
+
# @param body [Hash]
|
74
|
+
#
|
75
|
+
# @yield [response_body, response_header] if block was given, return response body and response header through block arguments
|
76
|
+
# @yieldparam response_body [Hashie::Mash] response body
|
77
|
+
# @yieldparam response_header [Hash<String, String>] response header (e.g. X-Rate-Limit-Limit, X-Rate-Limit-Reset, X-Rate-Limit-Remaining)
|
78
|
+
#
|
79
|
+
# @return [Hashie::Mash]
|
80
|
+
def create_crew_custom_field_template(body:, &block)
|
81
|
+
post("/crew_custom_field_templates", body, &block)
|
82
|
+
end
|
83
|
+
end
|