karaden-prg-ruby 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.devcontainer/devcontainer.json +45 -0
- data/.devcontainer/docker/ruby/Dockerfile +30 -0
- data/.devcontainer/docker-compose.yml +16 -0
- data/.rspec +3 -0
- data/.rubocop.yml +29 -0
- data/.vscode/launch.json +32 -0
- data/Gemfile +6 -0
- data/LICENSE +21 -0
- data/README.md +44 -0
- data/Rakefile +8 -0
- data/lib/karaden/config.rb +78 -0
- data/lib/karaden/exception/bad_request_exception.rb +10 -0
- data/lib/karaden/exception/forbidden_exception.rb +10 -0
- data/lib/karaden/exception/invalid_params_exception.rb +9 -0
- data/lib/karaden/exception/invalid_request_options_exception.rb +9 -0
- data/lib/karaden/exception/karaden_exception.rb +15 -0
- data/lib/karaden/exception/not_found_exception.rb +10 -0
- data/lib/karaden/exception/too_many_requests_exception.rb +10 -0
- data/lib/karaden/exception/unauthorized_exception.rb +10 -0
- data/lib/karaden/exception/unexpected_value_exception.rb +9 -0
- data/lib/karaden/exception/unknown_error_exception.rb +9 -0
- data/lib/karaden/exception/unprocessable_entity_exception.rb +10 -0
- data/lib/karaden/model/collection.rb +15 -0
- data/lib/karaden/model/error.rb +19 -0
- data/lib/karaden/model/karaden_object.rb +31 -0
- data/lib/karaden/model/message.rb +130 -0
- data/lib/karaden/model/requestable.rb +22 -0
- data/lib/karaden/net/requestor.rb +55 -0
- data/lib/karaden/net/requestor_interface.rb +9 -0
- data/lib/karaden/net/response.rb +71 -0
- data/lib/karaden/net/response_interface.rb +17 -0
- data/lib/karaden/param/message/message_cancel_params.rb +70 -0
- data/lib/karaden/param/message/message_create_params.rb +152 -0
- data/lib/karaden/param/message/message_detail_params.rb +70 -0
- data/lib/karaden/param/message/message_list_params.rb +106 -0
- data/lib/karaden/param/message/message_params.rb +12 -0
- data/lib/karaden/request_options.rb +153 -0
- data/lib/karaden/utility.rb +35 -0
- data/lib/karaden.rb +36 -0
- data/mock/2023-01-01.yaml +776 -0
- data/mock/latest +1 -0
- data/package-lock.json +3474 -0
- data/package.json +21 -0
- data/sig/karaden.rbs +0 -0
- metadata +178 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: d01480f01a3a32c963b785e91ca2dbf1006e9dcf49236b7dfdf33be218f6055a
|
4
|
+
data.tar.gz: f2e3b9a107ba053c3b391ce3ff8fe5f293df3e64787782e132f3e8a571dea731
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 13aaef2a09da0451eac30a1e85a07d29189ae8a89e90b86aba81b5269ff532b7f9c7962403123651392ed9c553fe6a3f064e7360fe0d2090d41a3779e23e2b0f
|
7
|
+
data.tar.gz: 72719971714d91c5fa20f7a23ff3804d399acea35a7c9eacb37a0550969853f2b968a7336b3762868212e8038ad7ddcb4863428997fe346dbd9d4c9595259658
|
@@ -0,0 +1,45 @@
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
3
|
+
{
|
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
|
+
"workspaceFolder": "/var/task",
|
11
|
+
"settings": {
|
12
|
+
"editor.detectIndentation": false,
|
13
|
+
"editor.tabSize": 2,
|
14
|
+
"ruby.lint": {
|
15
|
+
"rubocop": true
|
16
|
+
},
|
17
|
+
"ruby.useLanguageServer": true,
|
18
|
+
"ruby.intellisense": "rubyLocate"
|
19
|
+
},
|
20
|
+
"extensions": [
|
21
|
+
"misogi.ruby-rubocop",
|
22
|
+
"humao.rest-client",
|
23
|
+
"koichisasada.vscode-rdbg",
|
24
|
+
"rebornix.ruby"
|
25
|
+
],
|
26
|
+
// "name": "Ruby",
|
27
|
+
// // Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
28
|
+
// "image": "mcr.microsoft.com/devcontainers/ruby:0-3-bullseye",
|
29
|
+
"features": {
|
30
|
+
"ghcr.io/devcontainers/features/ruby:1": {
|
31
|
+
//"version": "latest",
|
32
|
+
"version": "3.0"
|
33
|
+
}
|
34
|
+
}
|
35
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
36
|
+
// "features": {},
|
37
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
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"
|
45
|
+
}
|
@@ -0,0 +1,30 @@
|
|
1
|
+
FROM mcr.microsoft.com/devcontainers/ruby:0-3-bullseye
|
2
|
+
|
3
|
+
ARG USERNAME=${USERNAME}
|
4
|
+
ARG USER_UID=${USER_UID}
|
5
|
+
ARG USER_GID=${USER_GID}
|
6
|
+
ARG TIME_ZONE=${TIME_ZONE}
|
7
|
+
ARG LOCALE=${LOCALE}
|
8
|
+
|
9
|
+
ENV LANG=${LOCALE}
|
10
|
+
ENV LANGUAGE=${LANGUAGE}
|
11
|
+
ENV TZ=${TIME_ZONE}
|
12
|
+
|
13
|
+
RUN apt-get update \
|
14
|
+
&& apt-get install -y locales \
|
15
|
+
&& locale-gen ja_JP.UTF-8 \
|
16
|
+
&& localedef -f UTF-8 -i ja_JP ja_JP.UTF-8 \
|
17
|
+
&& update-locale LANG=ja_JP.UTF-8
|
18
|
+
|
19
|
+
RUN ln -snf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \
|
20
|
+
&& echo ${TIME_ZONE} > /etc/timezone
|
21
|
+
|
22
|
+
USER ${USER_UID}
|
23
|
+
|
24
|
+
RUN curl https://get.volta.sh | bash
|
25
|
+
|
26
|
+
RUN echo -n "\n\
|
27
|
+
LANG="${LANG}"\n\
|
28
|
+
LANGUAGE="${LANGUAGE}"\n\
|
29
|
+
LC_ALL="${LOCALE}"\n\
|
30
|
+
" >> ~/.bashrc
|
@@ -0,0 +1,16 @@
|
|
1
|
+
version: "3.5"
|
2
|
+
|
3
|
+
services:
|
4
|
+
ruby:
|
5
|
+
build:
|
6
|
+
context: ./docker/ruby
|
7
|
+
args:
|
8
|
+
USERNAME: ${USERNAME-vscode}
|
9
|
+
USER_UID: ${USER_UID-1000}
|
10
|
+
USER_GID: ${USER_GID-1000}
|
11
|
+
TIME_ZONE: ${TIME_ZONE-UTC}
|
12
|
+
LOCALE: ${LOCALE-C}
|
13
|
+
tty: true
|
14
|
+
volumes:
|
15
|
+
- ../:/var/task
|
16
|
+
working_dir: /var/task
|
data/.rspec
ADDED
data/.rubocop.yml
ADDED
@@ -0,0 +1,29 @@
|
|
1
|
+
Style/FrozenStringLiteralComment:
|
2
|
+
Enabled: false
|
3
|
+
Style/Documentation:
|
4
|
+
Enabled: false
|
5
|
+
Style/DefWithParentheses:
|
6
|
+
Enabled: false
|
7
|
+
Style/ClassVars:
|
8
|
+
Enabled: false
|
9
|
+
Style/TrivialAccessors:
|
10
|
+
Enabled: false
|
11
|
+
Metrics/ParameterLists:
|
12
|
+
Enabled: false
|
13
|
+
Metrics/ClassLength:
|
14
|
+
Max: 150
|
15
|
+
Layout/IndentationWidth:
|
16
|
+
Width: 2
|
17
|
+
Layout/LineLength:
|
18
|
+
Max: 200
|
19
|
+
Layout/MultilineMethodCallIndentation:
|
20
|
+
Enabled: false
|
21
|
+
Metrics/BlockLength:
|
22
|
+
Exclude:
|
23
|
+
- 'spec/**/*'
|
24
|
+
Metrics/AbcSize:
|
25
|
+
Max: 30
|
26
|
+
Metrics/MethodLength:
|
27
|
+
Max: 30
|
28
|
+
RaiseArgs:
|
29
|
+
EnforcedStyle: compact
|
data/.vscode/launch.json
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
{
|
2
|
+
// Use IntelliSense to learn about possible attributes.
|
3
|
+
// Hover to view descriptions of existing attributes.
|
4
|
+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
|
5
|
+
"version": "0.2.0",
|
6
|
+
"configurations": [
|
7
|
+
{
|
8
|
+
"type": "rdbg",
|
9
|
+
"name": "Debug current file with rdbg",
|
10
|
+
"request": "launch",
|
11
|
+
"script": "${file}",
|
12
|
+
"args": [],
|
13
|
+
"askParameters": true,
|
14
|
+
"cwd": "${workspaceFolder}"
|
15
|
+
},
|
16
|
+
{
|
17
|
+
"type": "rdbg",
|
18
|
+
"name": "Debug current test with rdbg",
|
19
|
+
"request": "launch",
|
20
|
+
"command": "rspec",
|
21
|
+
"script": "${file}",
|
22
|
+
"args": [],
|
23
|
+
"askParameters": false,
|
24
|
+
"cwd": "${workspaceFolder}"
|
25
|
+
},
|
26
|
+
{
|
27
|
+
"type": "rdbg",
|
28
|
+
"name": "Attach with rdbg",
|
29
|
+
"request": "attach"
|
30
|
+
}
|
31
|
+
]
|
32
|
+
}
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2023 NTTCom Online Marketing Solutions Corporation
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,44 @@
|
|
1
|
+
# Karaden Rubyライブラリ
|
2
|
+
Karaden Rubyライブラリは、Rubyで書かれたアプリケーションからKaraden APIへ簡単にアクセスするための手段を提供します。<br />
|
3
|
+
それにはAPIレスポンスから動的に初期化するAPIリソースの一連のクラス定義が含まれているため、Karaden APIの幅広いバージョンと互換性があります。
|
4
|
+
## インストール方法
|
5
|
+
パッケージを変更しないならば、このソースコードは必要ありません。
|
6
|
+
### Gemfile
|
7
|
+
Gemfileに下記の依存を追加します。
|
8
|
+
```ruby
|
9
|
+
gem 'karaden-prg-ruby'
|
10
|
+
```
|
11
|
+
|
12
|
+
## 使い方
|
13
|
+
このライブラリを使用するには、Karadenでテナントを作成し、プロジェクト毎に発行できるトークンを発行する必要があります。<br />
|
14
|
+
作成したテナントID(テナントIDはテナント選択画面で表示されています)は、`Karaden::Config.tenant_id`に、発行したトークンは`Karaden::Config.api_key`にそれぞれ設定します。
|
15
|
+
```ruby
|
16
|
+
require 'karaden'
|
17
|
+
|
18
|
+
Karaden::Config.api_key = '<トークン>'
|
19
|
+
Karaden::Config.tenant_id = '<テナントID>'
|
20
|
+
|
21
|
+
params = Karaden::Param::Message::MessageCreateParams.new_builder
|
22
|
+
.with_service_id(1)
|
23
|
+
.with_to('09012345678')
|
24
|
+
.with_body('本文')
|
25
|
+
.build
|
26
|
+
|
27
|
+
Karaden::Model::Message.create(params)
|
28
|
+
```
|
29
|
+
### リクエスト毎の設定
|
30
|
+
同一のプロセスで複数のキーを使用する必要がある場合、リクエスト毎にキーやテナントIDを設定することができます。
|
31
|
+
```ruby
|
32
|
+
require 'karaden'
|
33
|
+
|
34
|
+
params = Karaden::Param::Message::MessageDetailParams.new_builder
|
35
|
+
.with_id('<メッセージID>')
|
36
|
+
.build
|
37
|
+
|
38
|
+
request_options = Karaden::RequestOptions.new_builder
|
39
|
+
.with_api_key('<トークン>')
|
40
|
+
.with_tenant_id('<テナントID>')
|
41
|
+
.build
|
42
|
+
|
43
|
+
Karaden::Model::Message.detail(params, request_options);
|
44
|
+
```
|
data/Rakefile
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
module Karaden
|
2
|
+
class Config
|
3
|
+
VERSION = '1.0.0'.freeze
|
4
|
+
DEFAULT_API_BASE = 'https://prg.karaden.jp/api'.freeze
|
5
|
+
DEFALUT_API_VERSION = '2023-01-01'.freeze
|
6
|
+
|
7
|
+
@@http_client = nil
|
8
|
+
@@logger = nil
|
9
|
+
@@formatter = nil
|
10
|
+
@@api_version = DEFALUT_API_VERSION
|
11
|
+
@@api_key = nil
|
12
|
+
@@tenant_id = nil
|
13
|
+
@@user_agent = nil
|
14
|
+
@@api_base = DEFAULT_API_BASE
|
15
|
+
|
16
|
+
def self.api_base
|
17
|
+
@@api_base
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.api_base=(val)
|
21
|
+
@@api_base = val
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.api_key
|
25
|
+
@@api_key
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.api_key=(val)
|
29
|
+
@@api_key = val
|
30
|
+
end
|
31
|
+
|
32
|
+
def self.api_version
|
33
|
+
@@api_version
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.api_version=(val)
|
37
|
+
@@api_version = val
|
38
|
+
end
|
39
|
+
|
40
|
+
def self.tenant_id
|
41
|
+
@@tenant_id
|
42
|
+
end
|
43
|
+
|
44
|
+
def self.tenant_id=(val)
|
45
|
+
@@tenant_id = val
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.user_agent
|
49
|
+
@@user_agent
|
50
|
+
end
|
51
|
+
|
52
|
+
def self.user_agent=(val)
|
53
|
+
@@user_agent = val
|
54
|
+
end
|
55
|
+
|
56
|
+
def self.reset
|
57
|
+
@@api_base = DEFAULT_API_BASE
|
58
|
+
@@api_key = nil
|
59
|
+
@@api_version = DEFALUT_API_VERSION
|
60
|
+
@@tenant_id = nil
|
61
|
+
@@user_agent = nil
|
62
|
+
@@http_client = nil
|
63
|
+
@@logger = nil
|
64
|
+
@@formatter = nil
|
65
|
+
end
|
66
|
+
|
67
|
+
def self.as_request_options
|
68
|
+
RequestOptions
|
69
|
+
.new_builder
|
70
|
+
.with_api_version(@@api_version)
|
71
|
+
.with_api_key(@@api_key)
|
72
|
+
.with_tenant_id(@@tenant_id)
|
73
|
+
.with_user_agent(@@user_agent)
|
74
|
+
.with_api_base(@@api_base)
|
75
|
+
.build
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Karaden
|
2
|
+
module Exception
|
3
|
+
class KaradenException < StandardError
|
4
|
+
attr_accessor :code, :headers, :body, :error
|
5
|
+
|
6
|
+
def initialize(message = nil)
|
7
|
+
@code = nil
|
8
|
+
@headers = {}
|
9
|
+
@body = ''
|
10
|
+
@error = nil
|
11
|
+
super(message)
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
module Karaden
|
2
|
+
module Model
|
3
|
+
class Error < KaradenObject
|
4
|
+
OBJECT_NAME = 'error'.freeze
|
5
|
+
|
6
|
+
def code()
|
7
|
+
property('code')
|
8
|
+
end
|
9
|
+
|
10
|
+
def message()
|
11
|
+
property('message')
|
12
|
+
end
|
13
|
+
|
14
|
+
def errors()
|
15
|
+
property('errors')
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
module Karaden
|
2
|
+
module Model
|
3
|
+
class KaradenObject
|
4
|
+
def initialize(id = nil, request_options = nil)
|
5
|
+
@properties = {}
|
6
|
+
@request_options = request_options
|
7
|
+
set_property('id', id)
|
8
|
+
end
|
9
|
+
|
10
|
+
def id()
|
11
|
+
property('id')
|
12
|
+
end
|
13
|
+
|
14
|
+
def object()
|
15
|
+
property('object')
|
16
|
+
end
|
17
|
+
|
18
|
+
def set_property(key, value)
|
19
|
+
@properties[key] = value
|
20
|
+
end
|
21
|
+
|
22
|
+
def property_keys()
|
23
|
+
@properties.keys
|
24
|
+
end
|
25
|
+
|
26
|
+
def property(key)
|
27
|
+
@properties[key]
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,130 @@
|
|
1
|
+
module Karaden
|
2
|
+
module Model
|
3
|
+
class Message < Requestable
|
4
|
+
OBJECT_NAME = 'message'.freeze
|
5
|
+
|
6
|
+
def service_id()
|
7
|
+
property('service_id')
|
8
|
+
end
|
9
|
+
|
10
|
+
def billing_address_id()
|
11
|
+
property('billing_address_id')
|
12
|
+
end
|
13
|
+
|
14
|
+
def to()
|
15
|
+
property('to')
|
16
|
+
end
|
17
|
+
|
18
|
+
def body()
|
19
|
+
property('body')
|
20
|
+
end
|
21
|
+
|
22
|
+
def tags()
|
23
|
+
property('tags')
|
24
|
+
end
|
25
|
+
|
26
|
+
def shorten?()
|
27
|
+
property('is_shorten')
|
28
|
+
end
|
29
|
+
|
30
|
+
def result()
|
31
|
+
property('result')
|
32
|
+
end
|
33
|
+
|
34
|
+
def status()
|
35
|
+
property('status')
|
36
|
+
end
|
37
|
+
|
38
|
+
def sent_result()
|
39
|
+
property('sent_result')
|
40
|
+
end
|
41
|
+
|
42
|
+
def carrier()
|
43
|
+
property('carrier')
|
44
|
+
end
|
45
|
+
|
46
|
+
def scheduled_at()
|
47
|
+
scheduled_at = property('scheduled_at')
|
48
|
+
begin
|
49
|
+
Time.parse(scheduled_at)
|
50
|
+
rescue StandardError
|
51
|
+
nil
|
52
|
+
end
|
53
|
+
end
|
54
|
+
|
55
|
+
def limited_at()
|
56
|
+
limited_at = property('limited_at')
|
57
|
+
begin
|
58
|
+
Time.parse(limited_at)
|
59
|
+
rescue StandardError
|
60
|
+
nil
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def sent_at()
|
65
|
+
sent_at = property('sent_at')
|
66
|
+
begin
|
67
|
+
Time.parse(sent_at)
|
68
|
+
rescue StandardError
|
69
|
+
nil
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def received_at()
|
74
|
+
received_at = property('received_at')
|
75
|
+
begin
|
76
|
+
Time.parse(received_at)
|
77
|
+
rescue StandardError
|
78
|
+
nil
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
def charged_at()
|
83
|
+
charged_at = property('charged_at')
|
84
|
+
begin
|
85
|
+
Time.parse(charged_at)
|
86
|
+
rescue StandardError
|
87
|
+
nil
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
def created_at()
|
92
|
+
created_at = property('created_at')
|
93
|
+
begin
|
94
|
+
Time.parse(created_at)
|
95
|
+
rescue StandardError
|
96
|
+
nil
|
97
|
+
end
|
98
|
+
end
|
99
|
+
|
100
|
+
def updated_at()
|
101
|
+
updated_at = property('updated_at')
|
102
|
+
begin
|
103
|
+
Time.parse(updated_at)
|
104
|
+
rescue StandardError
|
105
|
+
nil
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
def self.create(params, request_options = nil)
|
110
|
+
params.validate
|
111
|
+
request('POST', params.to_path, 'application/x-www-form-urlencoded', nil, params.to_data, request_options)
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.list(params, request_options = nil)
|
115
|
+
params.validate
|
116
|
+
request('GET', params.to_path, nil, params.to_params, nil, request_options)
|
117
|
+
end
|
118
|
+
|
119
|
+
def self.detail(params, request_options = nil)
|
120
|
+
params.validate
|
121
|
+
request('GET', params.to_path, nil, nil, nil, request_options)
|
122
|
+
end
|
123
|
+
|
124
|
+
def self.cancel(params, request_options = nil)
|
125
|
+
params.validate
|
126
|
+
request('POST', params.to_path, nil, nil, nil, request_options)
|
127
|
+
end
|
128
|
+
end
|
129
|
+
end
|
130
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
module Karaden
|
2
|
+
module Model
|
3
|
+
class Requestable < KaradenObject
|
4
|
+
def self.requestor
|
5
|
+
@@requestor
|
6
|
+
end
|
7
|
+
|
8
|
+
def self.requestor=(val)
|
9
|
+
@@requestor = val
|
10
|
+
end
|
11
|
+
|
12
|
+
def self.request(method, path, content_type = nil, params = nil, data = nil, request_options = nil)
|
13
|
+
response = @@requestor.send(method, path, content_type, params, data, request_options)
|
14
|
+
raise response.error if response.error?
|
15
|
+
|
16
|
+
response.object
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
Karaden::Model::Requestable.requestor = Karaden::Net::Requestor.new
|