karaden-prg-ruby 1.1.0 → 1.2.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 +4 -4
- data/.devcontainer/devcontainer.json +33 -40
- data/.devcontainer/docker/ruby/Dockerfile +21 -12
- data/.devcontainer/docker-compose.yml +3 -2
- data/.devcontainer/lifecycle/initialize-command.sh +6 -0
- data/.rubocop.yml +5 -0
- data/LICENSE +1 -1
- data/README.md +14 -1
- data/lib/karaden/config.rb +2 -2
- data/lib/karaden/exception/bulk_message_create_failed_exception.rb +9 -0
- data/lib/karaden/exception/bulk_message_list_message_retry_limit_exceed_exception.rb +9 -0
- data/lib/karaden/exception/bulk_message_show_retry_limit_exceed_exception.rb +9 -0
- data/lib/karaden/exception/file_download_failed_exception.rb +9 -0
- data/lib/karaden/exception/file_not_found_exception.rb +9 -0
- data/lib/karaden/exception/file_upload_failed_exception.rb +9 -0
- data/lib/karaden/model/bulk_file.rb +34 -0
- data/lib/karaden/model/bulk_message.rb +53 -0
- data/lib/karaden/model/requestable.rb +7 -0
- data/lib/karaden/net/no_contents_response.rb +80 -0
- data/lib/karaden/net/requestor.rb +3 -3
- data/lib/karaden/net/requestor_interface.rb +1 -1
- data/lib/karaden/net/response.rb +8 -0
- data/lib/karaden/net/response_interface.rb +8 -0
- data/lib/karaden/param/message/bulk/bulk_message_create_params.rb +78 -0
- data/lib/karaden/param/message/bulk/bulk_message_download_params.rb +126 -0
- data/lib/karaden/param/message/bulk/bulk_message_list_message_params.rb +72 -0
- data/lib/karaden/param/message/bulk/bulk_message_params.rb +15 -0
- data/lib/karaden/param/message/bulk/bulk_message_show_params.rb +72 -0
- data/lib/karaden/request_options.rb +7 -18
- data/lib/karaden/service/bulk_message_service.rb +90 -0
- data/lib/karaden/utility.rb +31 -1
- data/lib/karaden.rb +15 -0
- data/mock/2024-03-01.yaml +1061 -0
- data/mock/latest +1 -1
- metadata +23 -6
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 7b6eadc4a71ffb028555269758d495cbbd55d64acbf1dd56c866b6d526bad89d
|
|
4
|
+
data.tar.gz: c792f6b657fd7df4debafc7d100f55078c10f93a5886f56f03e843611e244343
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: ffa33a4af4af490f9a9f29d5020f1fe22dcd4cff19a469b07303e18ec7fa6d879f7e0ce17a4b8bfb4510adf2823c704962460506c08d2bee63ec609f3bb481ee
|
|
7
|
+
data.tar.gz: 248a813af69630da1243dc2b11989ecce62eff9cdbf5c1ead7552f23cce911fbd5f4eb4d26282f226298643c503e6d5f30d99e91c1e97a3027cd93db8afd5bdd
|
|
@@ -1,45 +1,38 @@
|
|
|
1
1
|
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
|
2
2
|
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
|
3
3
|
{
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
4
|
+
"name": "ruby-sdk",
|
|
5
|
+
// Sets the run context to one level up instead of the .devcontainer folder.
|
|
6
|
+
"dockerComposeFile": [
|
|
7
|
+
"docker-compose.yml"
|
|
8
|
+
],
|
|
9
|
+
"service": "ruby",
|
|
10
10
|
"workspaceFolder": "/var/task",
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
// "forwardPorts": [],
|
|
39
|
-
// Use 'postCreateCommand' to run commands after the container is created.
|
|
40
|
-
// "postCreateCommand": "ruby --version",
|
|
41
|
-
// Configure tool-specific properties.
|
|
42
|
-
// "customizations": {},
|
|
43
|
-
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
44
|
-
// "remoteUser": "root"
|
|
11
|
+
"customizations": {
|
|
12
|
+
"vscode": {
|
|
13
|
+
"settings": {
|
|
14
|
+
"[ruby]": {
|
|
15
|
+
"editor.defaultFormatter": "Shopify.ruby-lsp",
|
|
16
|
+
"editor.formatOnSave": true,
|
|
17
|
+
"editor.tabSize": 2,
|
|
18
|
+
"editor.insertSpaces": true,
|
|
19
|
+
"editor.semanticHighlighting.enabled": true,
|
|
20
|
+
"editor.formatOnType": true
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"extensions": [
|
|
24
|
+
"Shopify.ruby-extensions-pack",
|
|
25
|
+
"humao.rest-client"
|
|
26
|
+
]
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
|
30
|
+
//"forwardPorts": [8080]
|
|
31
|
+
|
|
32
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
|
33
|
+
// "postCreateCommand": "sudo chmod a+x \"$(pwd)\" && sudo rm -rf /var/www/html && sudo ln -s \"$(pwd)\" /var/www/html"
|
|
34
|
+
"initializeCommand": "cd .devcontainer && sh lifecycle/initialize-command.sh",
|
|
35
|
+
|
|
36
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
|
37
|
+
"remoteUser": "nttcoms"
|
|
45
38
|
}
|
|
@@ -1,17 +1,19 @@
|
|
|
1
|
-
FROM
|
|
1
|
+
FROM ruby:3.0.6
|
|
2
2
|
|
|
3
|
-
ARG USERNAME
|
|
4
|
-
ARG USER_UID
|
|
5
|
-
ARG USER_GID
|
|
6
|
-
ARG TIME_ZONE
|
|
7
|
-
ARG LOCALE
|
|
3
|
+
ARG USERNAME
|
|
4
|
+
ARG USER_UID
|
|
5
|
+
ARG USER_GID
|
|
6
|
+
ARG TIME_ZONE
|
|
7
|
+
ARG LOCALE
|
|
8
|
+
ARG WORKING_DIR
|
|
8
9
|
|
|
9
10
|
ENV LANG=${LOCALE}
|
|
10
|
-
ENV LANGUAGE=${LANGUAGE}
|
|
11
11
|
ENV TZ=${TIME_ZONE}
|
|
12
12
|
|
|
13
13
|
RUN apt-get update \
|
|
14
|
-
&& apt-get install -y
|
|
14
|
+
&& apt-get install -y sudo git
|
|
15
|
+
|
|
16
|
+
RUN apt-get install -y locales \
|
|
15
17
|
&& locale-gen ja_JP.UTF-8 \
|
|
16
18
|
&& localedef -f UTF-8 -i ja_JP ja_JP.UTF-8 \
|
|
17
19
|
&& update-locale LANG=ja_JP.UTF-8
|
|
@@ -19,12 +21,19 @@ RUN apt-get update \
|
|
|
19
21
|
RUN ln -snf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \
|
|
20
22
|
&& echo ${TIME_ZONE} > /etc/timezone
|
|
21
23
|
|
|
24
|
+
RUN /usr/sbin/groupadd --gid ${USER_GID} ${USERNAME} \
|
|
25
|
+
&& /usr/sbin/useradd -s /bin/bash --uid ${USER_UID} --gid ${USER_GID} -m ${USERNAME} \
|
|
26
|
+
&& echo ${USERNAME} ALL=\(root\) NOPASSWD:ALL > /etc/sudoers.d/${USERNAME} \
|
|
27
|
+
&& chmod 0440 /etc/sudoers.d/${USERNAME}
|
|
28
|
+
|
|
22
29
|
USER ${USER_UID}
|
|
23
30
|
|
|
24
31
|
RUN curl https://get.volta.sh | bash
|
|
25
32
|
|
|
26
|
-
RUN echo -
|
|
27
|
-
LANG
|
|
28
|
-
|
|
29
|
-
LC_ALL="${LOCALE}"\n\
|
|
33
|
+
RUN /bin/echo -e "\n\
|
|
34
|
+
LANG=\"${LANG}\"\n\
|
|
35
|
+
LC_ALL=\"${LOCALE}\"\n\
|
|
30
36
|
" >> ~/.bashrc
|
|
37
|
+
|
|
38
|
+
RUN sudo rm -rf /var/task \
|
|
39
|
+
&& sudo ln -s ${WORKING_DIR} /var/task
|
data/.rubocop.yml
CHANGED
data/LICENSE
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c)
|
|
3
|
+
Copyright (c) NTT DOCOMO BUSINESS X, Inc.
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
data/README.md
CHANGED
|
@@ -40,5 +40,18 @@ request_options = Karaden::RequestOptions.new_builder
|
|
|
40
40
|
.with_tenant_id('<テナントID>')
|
|
41
41
|
.build
|
|
42
42
|
|
|
43
|
-
Karaden::Model::Message.detail(params, request_options)
|
|
43
|
+
Karaden::Model::Message.detail(params, request_options)
|
|
44
|
+
```
|
|
45
|
+
### タイムアウトについて
|
|
46
|
+
通信をするファイルサイズや実行環境の通信速度によってはHTTP通信時にタイムアウトが発生する可能性があります。<br />
|
|
47
|
+
何度も同じような現象が起こる際は、ファイルサイズの調整もしくは`RequestOptions`からタイムアウトの時間を増やして、再度実行してください。<br />
|
|
48
|
+
```ruby
|
|
49
|
+
request_options = Karaden::RequestOptions.new_builder
|
|
50
|
+
.with_api_key('<トークン>')
|
|
51
|
+
.with_tenant_id('<テナントID>')
|
|
52
|
+
.with_connection_timeout(<秒>)
|
|
53
|
+
.with_read_timeout(<秒>)
|
|
54
|
+
.build
|
|
55
|
+
|
|
56
|
+
bulk_message = Karaden::Service::BulkMessageService.create('<ファイルパス>', request_options)
|
|
44
57
|
```
|
data/lib/karaden/config.rb
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
module Karaden
|
|
2
2
|
class Config
|
|
3
|
-
VERSION = '1.1
|
|
3
|
+
VERSION = '1.2.1'.freeze
|
|
4
4
|
DEFAULT_API_BASE = 'https://prg.karaden.jp/api'.freeze
|
|
5
|
-
DEFALUT_API_VERSION = '
|
|
5
|
+
DEFALUT_API_VERSION = '2024-03-01'.freeze
|
|
6
6
|
|
|
7
7
|
@@http_client = nil
|
|
8
8
|
@@logger = nil
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
module Karaden
|
|
2
|
+
module Model
|
|
3
|
+
class BulkFile < Requestable
|
|
4
|
+
OBJECT_NAME = 'bulk_file'.freeze
|
|
5
|
+
|
|
6
|
+
def url()
|
|
7
|
+
property('url')
|
|
8
|
+
end
|
|
9
|
+
|
|
10
|
+
def created_at()
|
|
11
|
+
created_at = property('created_at')
|
|
12
|
+
begin
|
|
13
|
+
Time.parse(created_at)
|
|
14
|
+
rescue StandardError
|
|
15
|
+
nil
|
|
16
|
+
end
|
|
17
|
+
end
|
|
18
|
+
|
|
19
|
+
def expires_at()
|
|
20
|
+
expires_at = property('expires_at')
|
|
21
|
+
begin
|
|
22
|
+
Time.parse(expires_at)
|
|
23
|
+
rescue StandardError
|
|
24
|
+
nil
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
def self.create(request_options = nil)
|
|
29
|
+
path = "#{Karaden::Param::Message::Bulk::BulkMessageParams::CONTEXT_PATH}/files"
|
|
30
|
+
request('POST', path, nil, nil, nil, request_options)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
end
|
|
34
|
+
end
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
module Karaden
|
|
2
|
+
module Model
|
|
3
|
+
class BulkMessage < Requestable
|
|
4
|
+
OBJECT_NAME = 'bulk_message'.freeze
|
|
5
|
+
STATUS_DONE = 'done'.freeze
|
|
6
|
+
STATUS_WAITING = 'waiting'.freeze
|
|
7
|
+
STATUS_PROCESSING = 'processing'.freeze
|
|
8
|
+
STATUS_ERROR = 'error'.freeze
|
|
9
|
+
|
|
10
|
+
def status()
|
|
11
|
+
property('status')
|
|
12
|
+
end
|
|
13
|
+
|
|
14
|
+
def error()
|
|
15
|
+
property('error')
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
def created_at()
|
|
19
|
+
created_at = property('created_at')
|
|
20
|
+
begin
|
|
21
|
+
Time.parse(created_at)
|
|
22
|
+
rescue StandardError
|
|
23
|
+
nil
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
def updated_at()
|
|
28
|
+
updated_at = property('updated_at')
|
|
29
|
+
begin
|
|
30
|
+
Time.parse(updated_at)
|
|
31
|
+
rescue StandardError
|
|
32
|
+
nil
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def self.create(params, request_options = nil)
|
|
37
|
+
params.validate
|
|
38
|
+
request('POST', params.to_path, 'application/x-www-form-urlencoded', nil, params.to_data, request_options)
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
def self.show(params, request_options = nil)
|
|
42
|
+
params.validate
|
|
43
|
+
request('GET', params.to_path, nil, nil, nil, request_options)
|
|
44
|
+
end
|
|
45
|
+
|
|
46
|
+
def self.list_message(params, request_options = nil)
|
|
47
|
+
params.validate
|
|
48
|
+
response = request_and_return_response_interface('GET', params.to_path, nil, nil, nil, request_options)
|
|
49
|
+
response.status_code == 302 ? response.headers['location'] : nil
|
|
50
|
+
end
|
|
51
|
+
end
|
|
52
|
+
end
|
|
53
|
+
end
|
|
@@ -15,6 +15,13 @@ module Karaden
|
|
|
15
15
|
|
|
16
16
|
response.object
|
|
17
17
|
end
|
|
18
|
+
|
|
19
|
+
def self.request_and_return_response_interface(method, path, content_type = nil, params = nil, data = nil, request_options = nil)
|
|
20
|
+
response = @@requestor.send(method, path, content_type, params, data, request_options, true)
|
|
21
|
+
raise response.error if response.error?
|
|
22
|
+
|
|
23
|
+
response
|
|
24
|
+
end
|
|
18
25
|
end
|
|
19
26
|
end
|
|
20
27
|
end
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
module Karaden
|
|
2
|
+
module Net
|
|
3
|
+
class NoContentsResponse < ResponseInterface
|
|
4
|
+
ERRORS = {
|
|
5
|
+
Karaden::Exception::BadRequestException::STATUS_CODE => Karaden::Exception::BadRequestException,
|
|
6
|
+
Karaden::Exception::UnauthorizedException::STATUS_CODE => Karaden::Exception::UnauthorizedException,
|
|
7
|
+
Karaden::Exception::NotFoundException::STATUS_CODE => Karaden::Exception::NotFoundException,
|
|
8
|
+
Karaden::Exception::ForbiddenException::STATUS_CODE => Karaden::Exception::ForbiddenException,
|
|
9
|
+
Karaden::Exception::UnprocessableEntityException::STATUS_CODE => Karaden::Exception::UnprocessableEntityException,
|
|
10
|
+
Karaden::Exception::TooManyRequestsException::STATUS_CODE => Karaden::Exception::TooManyRequestsException
|
|
11
|
+
}.freeze
|
|
12
|
+
|
|
13
|
+
def initialize(response, request_options)
|
|
14
|
+
@error = nil
|
|
15
|
+
@status_code = nil
|
|
16
|
+
@headers = nil
|
|
17
|
+
super()
|
|
18
|
+
interpret(response, request_options)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def error()
|
|
22
|
+
@error
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
def object()
|
|
26
|
+
raise NotImplementedError
|
|
27
|
+
end
|
|
28
|
+
|
|
29
|
+
def status_code()
|
|
30
|
+
@status_code
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
def headers()
|
|
34
|
+
@headers
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
def error?()
|
|
38
|
+
!@error.nil?
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
protected
|
|
42
|
+
|
|
43
|
+
def handle_error(code, headers, body, error)
|
|
44
|
+
clazz = ERRORS[code]
|
|
45
|
+
object = if clazz
|
|
46
|
+
clazz.new
|
|
47
|
+
else
|
|
48
|
+
UnknownErrorException.new
|
|
49
|
+
end
|
|
50
|
+
object.headers = headers
|
|
51
|
+
object.body = body
|
|
52
|
+
object.error = error
|
|
53
|
+
object
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
def interpret(response, request_options)
|
|
57
|
+
@status_code = response.code.to_i
|
|
58
|
+
@headers = response.response.response.each_header.to_h
|
|
59
|
+
if @status_code >= 400
|
|
60
|
+
body = response.body
|
|
61
|
+
contents = JSON.parse(response.body)
|
|
62
|
+
object = Karaden::Utility.convert_to_karaden_object(contents, request_options)
|
|
63
|
+
@error = if object.is_a?(Karaden::Model::Error)
|
|
64
|
+
handle_error(code, @headers, body, object)
|
|
65
|
+
else
|
|
66
|
+
Karaden::Exception::UnexpectedValueException.new
|
|
67
|
+
end
|
|
68
|
+
@error.code = @status_code
|
|
69
|
+
@error.headers = @headers
|
|
70
|
+
@error.body = body
|
|
71
|
+
end
|
|
72
|
+
rescue StandardError => _e
|
|
73
|
+
@error = Karaden::Exception::UnexpectedValueException.new
|
|
74
|
+
@error.code = @status_code
|
|
75
|
+
@error.headers = @headers
|
|
76
|
+
@error.body = body
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
end
|
|
80
|
+
end
|
|
@@ -3,7 +3,7 @@ module Karaden
|
|
|
3
3
|
class Requestor < RequestorInterface
|
|
4
4
|
DEFAULT_USER_AGENT = 'Karaden/Ruby/'.freeze
|
|
5
5
|
|
|
6
|
-
def send(method, path, content_type = nil, params = nil, data = nil, request_options = nil)
|
|
6
|
+
def send(method, path, content_type = nil, params = nil, data = nil, request_options = nil, is_no_contents: false)
|
|
7
7
|
request_options = Karaden::RequestOptions.new if request_options.nil?
|
|
8
8
|
options = Karaden::Config.as_request_options.merge(request_options).validate
|
|
9
9
|
headers = {
|
|
@@ -11,7 +11,7 @@ module Karaden
|
|
|
11
11
|
'Karaden-Client-User-Agent': build_client_user_agent,
|
|
12
12
|
'Karaden-Version' => options.api_version,
|
|
13
13
|
'Content-Type': content_type,
|
|
14
|
-
'Authorization': build_authorization(options)
|
|
14
|
+
'Authorization': build_authorization(options)
|
|
15
15
|
}
|
|
16
16
|
|
|
17
17
|
uri = URI.parse(build_http_url(path, params, options))
|
|
@@ -23,7 +23,7 @@ module Karaden
|
|
|
23
23
|
data = URI.encode_www_form(data) unless data.nil?
|
|
24
24
|
response = http.send_request(method, uri.request_uri, data, headers)
|
|
25
25
|
|
|
26
|
-
Karaden::Net::Response.new(response, options)
|
|
26
|
+
!is_no_contents ? Karaden::Net::Response.new(response, options) : Karaden::Net::NoContentsResponse.new(response, options)
|
|
27
27
|
end
|
|
28
28
|
|
|
29
29
|
protected
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
module Karaden
|
|
2
2
|
module Net
|
|
3
3
|
class RequestorInterface
|
|
4
|
-
def send(method, path, content_type = nil, params = nil, data = nil, request_options = nil)
|
|
4
|
+
def send(method, path, content_type = nil, params = nil, data = nil, request_options = nil, is_no_contents: false)
|
|
5
5
|
raise NotImplementedError
|
|
6
6
|
end
|
|
7
7
|
end
|
data/lib/karaden/net/response.rb
CHANGED
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
module Karaden
|
|
2
|
+
module Param
|
|
3
|
+
module Message
|
|
4
|
+
module Bulk
|
|
5
|
+
class BulkMessageCreateParams < BulkMessageParams
|
|
6
|
+
attr_accessor :bulk_file_id
|
|
7
|
+
|
|
8
|
+
def initialize()
|
|
9
|
+
@bulk_file_id = nil
|
|
10
|
+
super
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
def to_path
|
|
14
|
+
CONTEXT_PATH
|
|
15
|
+
end
|
|
16
|
+
|
|
17
|
+
def to_data
|
|
18
|
+
{
|
|
19
|
+
bulk_file_id: @bulk_file_id
|
|
20
|
+
}.reject { |_, value| value.nil? }
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def validate
|
|
24
|
+
errors = Karaden::Model::KaradenObject.new
|
|
25
|
+
has_error = false
|
|
26
|
+
|
|
27
|
+
messages = validate_bulk_file_id
|
|
28
|
+
unless messages.empty?
|
|
29
|
+
errors.set_property('bulk_file_id', messages)
|
|
30
|
+
has_error = true
|
|
31
|
+
end
|
|
32
|
+
|
|
33
|
+
if has_error
|
|
34
|
+
e = Karaden::Exception::InvalidParamsException.new
|
|
35
|
+
error = Karaden::Model::Error.new
|
|
36
|
+
error.set_property('object', Karaden::Model::Error::OBJECT_NAME)
|
|
37
|
+
error.set_property('errors', errors)
|
|
38
|
+
e.error = error
|
|
39
|
+
raise e
|
|
40
|
+
end
|
|
41
|
+
|
|
42
|
+
self
|
|
43
|
+
end
|
|
44
|
+
|
|
45
|
+
def self.new_builder
|
|
46
|
+
BulkMessageCreateParamsBuilder.new
|
|
47
|
+
end
|
|
48
|
+
|
|
49
|
+
protected
|
|
50
|
+
|
|
51
|
+
def validate_bulk_file_id
|
|
52
|
+
messages = []
|
|
53
|
+
if @bulk_file_id.nil? || @bulk_file_id == ''
|
|
54
|
+
messages << 'bulk_file_idは必須です。'
|
|
55
|
+
messages << '文字列(UUID)を入力してください。'
|
|
56
|
+
end
|
|
57
|
+
messages
|
|
58
|
+
end
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
class BulkMessageCreateParamsBuilder
|
|
62
|
+
def initialize
|
|
63
|
+
@params = BulkMessageCreateParams.new
|
|
64
|
+
end
|
|
65
|
+
|
|
66
|
+
def with_bulk_file_id(bulk_file_id)
|
|
67
|
+
@params.bulk_file_id = bulk_file_id
|
|
68
|
+
self
|
|
69
|
+
end
|
|
70
|
+
|
|
71
|
+
def build
|
|
72
|
+
@params.clone
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
end
|
|
77
|
+
end
|
|
78
|
+
end
|