cpaas_test_ruby 0.1.0

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.
Files changed (64) hide show
  1. checksums.yaml +7 -0
  2. data/.devcontainer/devcontainer.json +38 -0
  3. data/.devcontainer/docker/ruby/Dockerfile +39 -0
  4. data/.devcontainer/docker-compose.yml +17 -0
  5. data/.devcontainer/lifecycle/initialize-command.sh +6 -0
  6. data/.rspec +3 -0
  7. data/.rubocop.yml +34 -0
  8. data/.vscode/launch.json +32 -0
  9. data/Gemfile +6 -0
  10. data/LICENSE +21 -0
  11. data/README.md +2 -0
  12. data/Rakefile +8 -0
  13. data/lib/cpaas_test_ruby/config.rb +78 -0
  14. data/lib/cpaas_test_ruby/exception/bad_request_exception.rb +10 -0
  15. data/lib/cpaas_test_ruby/exception/bulk_message_create_failed_exception.rb +9 -0
  16. data/lib/cpaas_test_ruby/exception/bulk_message_list_message_retry_limit_exceed_exception.rb +9 -0
  17. data/lib/cpaas_test_ruby/exception/bulk_message_show_retry_limit_exceed_exception.rb +9 -0
  18. data/lib/cpaas_test_ruby/exception/file_download_failed_exception.rb +9 -0
  19. data/lib/cpaas_test_ruby/exception/file_not_found_exception.rb +9 -0
  20. data/lib/cpaas_test_ruby/exception/file_upload_failed_exception.rb +9 -0
  21. data/lib/cpaas_test_ruby/exception/forbidden_exception.rb +10 -0
  22. data/lib/cpaas_test_ruby/exception/invalid_params_exception.rb +9 -0
  23. data/lib/cpaas_test_ruby/exception/invalid_request_options_exception.rb +9 -0
  24. data/lib/cpaas_test_ruby/exception/karaden_exception.rb +15 -0
  25. data/lib/cpaas_test_ruby/exception/not_found_exception.rb +10 -0
  26. data/lib/cpaas_test_ruby/exception/too_many_requests_exception.rb +10 -0
  27. data/lib/cpaas_test_ruby/exception/unauthorized_exception.rb +10 -0
  28. data/lib/cpaas_test_ruby/exception/unexpected_value_exception.rb +9 -0
  29. data/lib/cpaas_test_ruby/exception/unknown_error_exception.rb +9 -0
  30. data/lib/cpaas_test_ruby/exception/unprocessable_entity_exception.rb +10 -0
  31. data/lib/cpaas_test_ruby/model/bulk_file.rb +34 -0
  32. data/lib/cpaas_test_ruby/model/bulk_message.rb +53 -0
  33. data/lib/cpaas_test_ruby/model/collection.rb +15 -0
  34. data/lib/cpaas_test_ruby/model/error.rb +19 -0
  35. data/lib/cpaas_test_ruby/model/karaden_object.rb +31 -0
  36. data/lib/cpaas_test_ruby/model/message.rb +134 -0
  37. data/lib/cpaas_test_ruby/model/requestable.rb +29 -0
  38. data/lib/cpaas_test_ruby/net/no_contents_response.rb +80 -0
  39. data/lib/cpaas_test_ruby/net/requestor.rb +55 -0
  40. data/lib/cpaas_test_ruby/net/requestor_interface.rb +9 -0
  41. data/lib/cpaas_test_ruby/net/response.rb +79 -0
  42. data/lib/cpaas_test_ruby/net/response_interface.rb +25 -0
  43. data/lib/cpaas_test_ruby/param/message/bulk/bulk_message_create_params.rb +78 -0
  44. data/lib/cpaas_test_ruby/param/message/bulk/bulk_message_download_params.rb +126 -0
  45. data/lib/cpaas_test_ruby/param/message/bulk/bulk_message_list_message_params.rb +72 -0
  46. data/lib/cpaas_test_ruby/param/message/bulk/bulk_message_params.rb +15 -0
  47. data/lib/cpaas_test_ruby/param/message/bulk/bulk_message_show_params.rb +72 -0
  48. data/lib/cpaas_test_ruby/param/message/message_cancel_params.rb +70 -0
  49. data/lib/cpaas_test_ruby/param/message/message_create_params.rb +152 -0
  50. data/lib/cpaas_test_ruby/param/message/message_detail_params.rb +70 -0
  51. data/lib/cpaas_test_ruby/param/message/message_list_params.rb +106 -0
  52. data/lib/cpaas_test_ruby/param/message/message_params.rb +12 -0
  53. data/lib/cpaas_test_ruby/request_options.rb +142 -0
  54. data/lib/cpaas_test_ruby/service/bulk_message_service.rb +90 -0
  55. data/lib/cpaas_test_ruby/utility.rb +65 -0
  56. data/lib/cpaas_test_ruby.rb +51 -0
  57. data/mock/2023-01-01.yaml +776 -0
  58. data/mock/2023-12-01.yaml +783 -0
  59. data/mock/2024-03-01.yaml +1061 -0
  60. data/mock/latest +1 -0
  61. data/package-lock.json +3474 -0
  62. data/package.json +21 -0
  63. data/sig/karaden.rbs +0 -0
  64. metadata +197 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 7268929d40991614512c08ca32e7176e468e8511ad52c32faa9766c1d5ea8805
4
+ data.tar.gz: 32da56d3c823b0540cdf3f62ae6a320ae76a968d43da0f562846415936f6c5b6
5
+ SHA512:
6
+ metadata.gz: b241666961095086a07249f469de609b5e78717eecd2ed826e5bcbd009b384a43b73979441292309a920aaca7403fd08fb1a3b14ca628e64468ebea4f07ab4f7
7
+ data.tar.gz: 55434e9ec7a6f56b09cd35e90722aae9ac4c3e05cb2b089e4dd7a161c0310d49a0885f2712bbb4241c58a195b9e46001dfe6dd9211cc8f0e586dfebfd3ca17be
@@ -0,0 +1,38 @@
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
+ "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"
38
+ }
@@ -0,0 +1,39 @@
1
+ FROM ruby:3.0.6
2
+
3
+ ARG USERNAME
4
+ ARG USER_UID
5
+ ARG USER_GID
6
+ ARG TIME_ZONE
7
+ ARG LOCALE
8
+ ARG WORKING_DIR
9
+
10
+ ENV LANG=${LOCALE}
11
+ ENV TZ=${TIME_ZONE}
12
+
13
+ RUN apt-get update \
14
+ && apt-get install -y sudo git
15
+
16
+ RUN apt-get install -y locales \
17
+ && locale-gen ja_JP.UTF-8 \
18
+ && localedef -f UTF-8 -i ja_JP ja_JP.UTF-8 \
19
+ && update-locale LANG=ja_JP.UTF-8
20
+
21
+ RUN ln -snf /usr/share/zoneinfo/${TIME_ZONE} /etc/localtime \
22
+ && echo ${TIME_ZONE} > /etc/timezone
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
+
29
+ USER ${USER_UID}
30
+
31
+ RUN curl https://get.volta.sh | bash
32
+
33
+ RUN /bin/echo -e "\n\
34
+ LANG=\"${LANG}\"\n\
35
+ LC_ALL=\"${LOCALE}\"\n\
36
+ " >> ~/.bashrc
37
+
38
+ RUN sudo rm -rf /var/task \
39
+ && sudo ln -s ${WORKING_DIR} /var/task
@@ -0,0 +1,17 @@
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
+ WORKING_DIR: ${WORKING_DIR}
14
+ tty: true
15
+ volumes:
16
+ - ../:${WORKING_DIR}
17
+ working_dir: ${WORKING_DIR}
@@ -0,0 +1,6 @@
1
+ #!/bin/bash -eu
2
+
3
+ echo "USERNAME=${USER}\n\
4
+ LOCALE=ja_JP.UTF-8\n\
5
+ TIME_ZONE=Asia/Tokyo\n\
6
+ WORKING_DIR=$(realpath `pwd`/..)" > .env
data/.rspec ADDED
@@ -0,0 +1,3 @@
1
+ --format documentation
2
+ --color
3
+ --require spec_helper
data/.rubocop.yml ADDED
@@ -0,0 +1,34 @@
1
+ AllCops:
2
+ TargetRubyVersion: 3.0
3
+ Style/StringLiterals:
4
+ Enabled: false
5
+
6
+ Style/FrozenStringLiteralComment:
7
+ Enabled: false
8
+ Style/Documentation:
9
+ Enabled: false
10
+ Style/DefWithParentheses:
11
+ Enabled: false
12
+ Style/ClassVars:
13
+ Enabled: false
14
+ Style/TrivialAccessors:
15
+ Enabled: false
16
+ Metrics/ParameterLists:
17
+ Enabled: false
18
+ Metrics/ClassLength:
19
+ Max: 150
20
+ Layout/IndentationWidth:
21
+ Width: 2
22
+ Layout/LineLength:
23
+ Max: 200
24
+ Layout/MultilineMethodCallIndentation:
25
+ Enabled: false
26
+ Metrics/BlockLength:
27
+ Exclude:
28
+ - 'spec/**/*'
29
+ Metrics/AbcSize:
30
+ Max: 30
31
+ Metrics/MethodLength:
32
+ Max: 30
33
+ RaiseArgs:
34
+ EnforcedStyle: compact
@@ -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
@@ -0,0 +1,6 @@
1
+ # frozen_string_literal: true
2
+
3
+ source "https://rubygems.org"
4
+
5
+ # Specify your gem's dependencies in cpaas_test_ruby.gemspec
6
+ gemspec
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,2 @@
1
+ # cpaas_test_ruby
2
+ このリポジトリは、パッケージのリリース検証目的で使用されます。
data/Rakefile ADDED
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "bundler/gem_tasks"
4
+ require "rspec/core/rake_task"
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,78 @@
1
+ module Karaden
2
+ class Config
3
+ VERSION = '0.1.0'.freeze
4
+ DEFAULT_API_BASE = 'https://prg.karaden.jp/api'.freeze
5
+ DEFALUT_API_VERSION = '2024-03-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,10 @@
1
+ module Karaden
2
+ module Exception
3
+ class BadRequestException < KaradenException
4
+ STATUS_CODE = 400
5
+ def initialize(message = nil)
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class BulkMessageCreateFailedException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class BulkMessageListMessageRetryLimitExceedException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class BulkMessageShowRetryLimitExceedException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class FileDownloadFailedException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class FileNotFoundException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class FileUploadFailedException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module Karaden
2
+ module Exception
3
+ class ForbiddenException < KaradenException
4
+ STATUS_CODE = 403
5
+ def initialize(message = nil)
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class InvalidParamsException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class InvalidRequestOptionsException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ 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,10 @@
1
+ module Karaden
2
+ module Exception
3
+ class NotFoundException < KaradenException
4
+ STATUS_CODE = 404
5
+ def initialize(message = nil)
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Karaden
2
+ module Exception
3
+ class TooManyRequestsException < KaradenException
4
+ STATUS_CODE = 429
5
+ def initialize(message = nil)
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,10 @@
1
+ module Karaden
2
+ module Exception
3
+ class UnauthorizedException < KaradenException
4
+ STATUS_CODE = 401
5
+ def initialize(message = nil)
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class UnexpectedValueException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ module Karaden
2
+ module Exception
3
+ class UnknownErrorException < KaradenException
4
+ def initialize(message = nil)
5
+ super
6
+ end
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,10 @@
1
+ module Karaden
2
+ module Exception
3
+ class UnprocessableEntityException < KaradenException
4
+ STATUS_CODE = 422
5
+ def initialize(message = nil)
6
+ super
7
+ end
8
+ end
9
+ end
10
+ end
@@ -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
@@ -0,0 +1,15 @@
1
+ module Karaden
2
+ module Model
3
+ class Collection < KaradenObject
4
+ OBJECT_NAME = 'list'.freeze
5
+
6
+ def data()
7
+ property('data')
8
+ end
9
+
10
+ def more?()
11
+ property('has_more')
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