ZCRMSDK 2.0.0 → 3.0.0.beta
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/src/ZCRMSDK.rb +84 -1
- data/src/com/zoho/api/authenticator/oauth_token.rb +87 -31
- data/src/com/zoho/api/authenticator/store/db_store.rb +48 -28
- data/src/com/zoho/api/authenticator/store/file_store.rb +69 -21
- data/src/com/zoho/api/authenticator/store/token_store.rb +7 -0
- data/src/com/zoho/api/logger/sdk_logger.rb +18 -9
- data/src/com/zoho/crm/api/assignment_rules/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/assignment_rules/assignment_rule.rb +215 -0
- data/src/com/zoho/crm/api/assignment_rules/assignment_rules_operations.rb +61 -0
- data/src/com/zoho/crm/api/assignment_rules/default_user.rb +80 -0
- data/src/com/zoho/crm/api/assignment_rules/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/assignment_rules/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/attachments/attachment.rb +4 -4
- data/src/com/zoho/crm/api/attachments/attachments_operations.rb +6 -6
- data/src/com/zoho/crm/api/blue_print/blue_print_operations.rb +2 -2
- data/src/com/zoho/crm/api/blue_print/escalation.rb +80 -0
- data/src/com/zoho/crm/api/blue_print/field.rb +1107 -0
- data/src/com/zoho/crm/api/blue_print/next_transition.rb +38 -0
- data/src/com/zoho/crm/api/blue_print/process_info.rb +4 -4
- data/src/com/zoho/crm/api/blue_print/transition.rb +19 -1
- data/src/com/zoho/crm/api/blue_print/validation_error.rb +57 -0
- data/src/com/zoho/crm/api/bulk_read/bulk_read_operations.rb +3 -3
- data/src/com/zoho/crm/api/bulk_read/criteria.rb +20 -0
- data/src/com/zoho/crm/api/bulk_read/query.rb +5 -4
- data/src/com/zoho/crm/api/bulk_write/bulk_write_operations.rb +3 -3
- data/src/com/zoho/crm/api/bulk_write/resource.rb +24 -4
- data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +7 -7
- data/src/com/zoho/crm/api/currencies/currencies_operations.rb +7 -7
- data/src/com/zoho/crm/api/custom_views/criteria.rb +5 -4
- data/src/com/zoho/crm/api/custom_views/custom_view.rb +100 -41
- data/src/com/zoho/crm/api/custom_views/custom_views_operations.rb +2 -2
- data/src/com/zoho/crm/api/custom_views/{shared_details.rb → shared_to.rb} +2 -2
- data/src/com/zoho/crm/api/dc/au_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/cn_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/datacenter.rb +3 -2
- data/src/com/zoho/crm/api/dc/eu_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/in_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/dc/us_datacenter.rb +3 -3
- data/src/com/zoho/crm/api/email_templates/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/email_templates/attachment.rb +118 -0
- data/src/com/zoho/crm/api/email_templates/email_template.rb +390 -0
- data/src/com/zoho/crm/api/email_templates/email_templates_operations.rb +61 -0
- data/src/com/zoho/crm/api/email_templates/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/email_templates/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/field_attachments/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/field_attachments/body_wrapper.rb +62 -0
- data/src/com/zoho/crm/api/field_attachments/field_attachments_operations.rb +52 -0
- data/src/com/zoho/crm/api/field_attachments/file_body_wrapper.rb +64 -0
- data/src/com/zoho/crm/api/field_attachments/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/fields/external.rb +99 -0
- data/src/com/zoho/crm/api/fields/field.rb +192 -38
- data/src/com/zoho/crm/api/fields/fields_operations.rb +2 -2
- data/src/com/zoho/crm/api/fields/history_tracking.rb +80 -0
- data/src/com/zoho/crm/api/fields/maps.rb +80 -0
- data/src/com/zoho/crm/api/fields/multi_select_lookup.rb +19 -0
- data/src/com/zoho/crm/api/fields/multi_user_lookup.rb +175 -0
- data/src/com/zoho/crm/api/fields/pick_list_value.rb +19 -0
- data/src/com/zoho/crm/api/fields/related_details.rb +19 -0
- data/src/com/zoho/crm/api/files/file_operations.rb +2 -2
- data/src/com/zoho/crm/api/initializer.rb +41 -16
- data/src/com/zoho/crm/api/inventory_templates/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/inventory_templates/inventory_template.rb +352 -0
- data/src/com/zoho/crm/api/inventory_templates/inventory_templates_operations.rb +82 -0
- data/src/com/zoho/crm/api/inventory_templates/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/inventory_templates/response_wrapper.rb +83 -0
- data/src/com/zoho/crm/api/layouts/layout.rb +38 -0
- data/src/com/zoho/crm/api/layouts/layouts_operations.rb +2 -2
- data/src/com/zoho/crm/api/layouts/section.rb +19 -0
- data/src/com/zoho/crm/api/modules/module.rb +57 -0
- data/src/com/zoho/crm/api/modules/modules_operations.rb +4 -4
- data/src/com/zoho/crm/api/notes/notes_operations.rb +7 -7
- data/src/com/zoho/crm/api/notification/notification_operations.rb +6 -6
- data/src/com/zoho/crm/api/org/org_operations.rb +2 -2
- data/src/com/zoho/crm/api/pipeline/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/action_response.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/api_exception.rb +129 -0
- data/src/com/zoho/crm/api/pipeline/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/pipeline/forecast_category.rb +80 -0
- data/src/com/zoho/crm/api/pipeline/pick_list_value.rb +175 -0
- data/src/com/zoho/crm/api/pipeline/pipeline.rb +213 -0
- data/src/com/zoho/crm/api/pipeline/pipeline_operations.rb +165 -0
- data/src/com/zoho/crm/api/pipeline/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/stage.rb +80 -0
- data/src/com/zoho/crm/api/pipeline/success_response.rb +123 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_handler.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_response.rb +10 -0
- data/src/com/zoho/crm/api/pipeline/transfer_action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/pipeline/transfer_and_delete_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/pipeline/transfer_pipe_line.rb +80 -0
- data/src/com/zoho/crm/api/profiles/default_view.rb +99 -0
- data/src/com/zoho/crm/api/profiles/profile.rb +57 -0
- data/src/com/zoho/crm/api/profiles/profiles_operations.rb +2 -2
- data/src/com/zoho/crm/api/query/query_operations.rb +1 -1
- data/src/com/zoho/crm/api/record/api_exception.rb +2 -0
- data/src/com/zoho/crm/api/record/body_wrapper.rb +0 -19
- data/src/com/zoho/crm/api/record/count_handler.rb +10 -0
- data/src/com/zoho/crm/api/record/count_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/record/field.rb +1 -0
- data/src/com/zoho/crm/api/record/image_upload.rb +213 -0
- data/src/com/zoho/crm/api/record/inventory_line_items.rb +56 -39
- data/src/com/zoho/crm/api/record/mass_update_body_wrapper.rb +4 -4
- data/src/com/zoho/crm/api/record/mass_update_territory.rb +80 -0
- data/src/com/zoho/crm/api/record/multi_select_lookup.rb +99 -0
- data/src/com/zoho/crm/api/record/multi_select_picklist.rb +80 -0
- data/src/com/zoho/crm/api/record/price_book.rb +31 -0
- data/src/com/zoho/crm/api/record/record_operations.rb +196 -26
- data/src/com/zoho/crm/api/record/tax.rb +80 -0
- data/src/com/zoho/crm/api/record/territory.rb +70 -12
- data/src/com/zoho/crm/api/record/widget.rb +80 -0
- data/src/com/zoho/crm/api/record/wizard.rb +80 -0
- data/src/com/zoho/crm/api/related_lists/related_lists_operations.rb +2 -2
- data/src/com/zoho/crm/api/related_records/related_records_operations.rb +6 -6
- data/src/com/zoho/crm/api/request_proxy.rb +3 -4
- data/src/com/zoho/crm/api/roles/roles_operations.rb +2 -2
- data/src/com/zoho/crm/api/sdk_config.rb +2 -68
- data/src/com/zoho/crm/api/send_mail/action_handler.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/action_response.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/action_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/send_mail/api_exception.rb +125 -0
- data/src/com/zoho/crm/api/send_mail/body_wrapper.rb +61 -0
- data/src/com/zoho/crm/api/send_mail/data_subject_request.rb +80 -0
- data/src/com/zoho/crm/api/send_mail/inventory_details.rb +100 -0
- data/src/com/zoho/crm/api/send_mail/mail.rb +423 -0
- data/src/com/zoho/crm/api/send_mail/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/send_mail/send_mail_operations.rb +61 -0
- data/src/com/zoho/crm/api/send_mail/success_response.rb +121 -0
- data/src/com/zoho/crm/api/send_mail/template.rb +10 -0
- data/src/com/zoho/crm/api/send_mail/user_address.rb +137 -0
- data/src/com/zoho/crm/api/share_records/share_records_operations.rb +4 -4
- data/src/com/zoho/crm/api/tags/tag.rb +19 -0
- data/src/com/zoho/crm/api/tags/tags_operations.rb +11 -11
- data/src/com/zoho/crm/api/taxes/taxes_operations.rb +6 -6
- data/src/com/zoho/crm/api/territories/response_wrapper.rb +20 -0
- data/src/com/zoho/crm/api/territories/territories_operations.rb +2 -2
- data/src/com/zoho/crm/api/territories/territory.rb +61 -23
- data/src/com/zoho/crm/api/users/users_operations.rb +6 -6
- data/src/com/zoho/crm/api/util/api_http_connector.rb +5 -4
- data/src/com/zoho/crm/api/util/constants.rb +140 -13
- data/src/com/zoho/crm/api/util/converter.rb +21 -4
- data/src/com/zoho/crm/api/util/form_data_converter.rb +3 -14
- data/src/com/zoho/crm/api/util/utility.rb +226 -70
- data/src/com/zoho/crm/api/variable_groups/variable_groups_operations.rb +3 -3
- data/src/com/zoho/crm/api/variables/variables_operations.rb +9 -9
- data/src/com/zoho/crm/api/wizards/api_exception.rb +121 -0
- data/src/com/zoho/crm/api/wizards/button.rb +214 -0
- data/src/com/zoho/crm/api/wizards/chart_data.rb +118 -0
- data/src/com/zoho/crm/api/wizards/connection.rb +80 -0
- data/src/com/zoho/crm/api/wizards/container.rb +119 -0
- data/src/com/zoho/crm/api/wizards/node.rb +118 -0
- data/src/com/zoho/crm/api/wizards/response_handler.rb +10 -0
- data/src/com/zoho/crm/api/wizards/response_wrapper.rb +63 -0
- data/src/com/zoho/crm/api/wizards/screen.rb +99 -0
- data/src/com/zoho/crm/api/wizards/segment.rb +176 -0
- data/src/com/zoho/crm/api/wizards/wizard.rb +273 -0
- data/src/com/zoho/crm/api/wizards/wizards_operations.rb +61 -0
- data/src/resources/JSONDetails.json +1 -1
- data/src/version.rb +1 -1
- metadata +88 -5
@@ -7,8 +7,7 @@ require_relative 'util/constants'
|
|
7
7
|
|
8
8
|
# This class to initialize Zoho CRM SDK.
|
9
9
|
class Initializer
|
10
|
-
attr_accessor :json_details
|
11
|
-
|
10
|
+
attr_accessor :json_details,:user, :environment, :store, :token, :initializer, :local, :sdk_config, :resources_path, :request_proxy
|
12
11
|
@@json_details = nil
|
13
12
|
|
14
13
|
Thread.current['initi'] = nil
|
@@ -17,7 +16,7 @@ class Initializer
|
|
17
16
|
@@json_details
|
18
17
|
end
|
19
18
|
|
20
|
-
def self.initialize(user
|
19
|
+
def self.initialize(user:, environment:, token:, store:, sdk_config:, resources_path:, log: nil, request_proxy: nil)
|
21
20
|
error = {}
|
22
21
|
|
23
22
|
require_relative 'user_signature'
|
@@ -27,7 +26,7 @@ class Initializer
|
|
27
26
|
|
28
27
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = UserSignature
|
29
28
|
|
30
|
-
raise SDKException.new(Constants::INITIALIZATION_ERROR, Constants::
|
29
|
+
raise SDKException.new(Constants::INITIALIZATION_ERROR, Constants::USER_SIGNATURE_ERROR_MESSAGE, error, nil)
|
31
30
|
|
32
31
|
end
|
33
32
|
|
@@ -75,12 +74,20 @@ class Initializer
|
|
75
74
|
|
76
75
|
end
|
77
76
|
|
77
|
+
if !request_proxy.nil? && !sdk_config.is_a?(RequestProxy)
|
78
|
+
|
79
|
+
raise SDKException.new(Constants::INITIALIZATION_ERROR, Constants::REQUEST_PROXY_ERROR, nil, nil)
|
80
|
+
end
|
81
|
+
|
78
82
|
if resources_path.nil? || resources_path.empty?
|
79
83
|
raise SDKException.new(Constants::INITIALIZATION_ERROR, Constants::RESOURCE_PATH_ERROR_MESSAGE, nil, nil)
|
80
84
|
end
|
81
85
|
|
82
|
-
|
83
|
-
|
86
|
+
if !File.directory?(resources_path)
|
87
|
+
raise SDKException.new(Constants::INITIALIZATION_ERROR, Constants::RESOURCE_PATH_INVALID_ERROR_MESSAGE, nil, nil)
|
88
|
+
end
|
89
|
+
|
90
|
+
log = SDKLog::Log.initialize(level: Levels::INFO, path: File.join(Dir.pwd, Constants::LOGFILE_NAME)) if log.nil?
|
84
91
|
SDKLog::SDKLogger.initialize(log)
|
85
92
|
|
86
93
|
@@initializer = Initializer.new
|
@@ -120,21 +127,26 @@ class Initializer
|
|
120
127
|
@@initializer
|
121
128
|
end
|
122
129
|
|
123
|
-
def self.switch_user(user, environment, token, sdk_config, request_proxy
|
130
|
+
def self.switch_user(user:nil, environment:nil, token:nil, sdk_config:nil, request_proxy: nil)
|
131
|
+
|
132
|
+
if @@initializer.nil?
|
133
|
+
raise SDKException.new(Constants::SDK_UNINITIALIZATION_ERROR, Constants::SDK_UNINITIALIZATION_MESSAGE)
|
134
|
+
end
|
135
|
+
|
124
136
|
require_relative 'user_signature'
|
125
137
|
|
126
|
-
|
138
|
+
if !user.nil? and !user.is_a?(UserSignature)
|
127
139
|
error[Constants::ERROR_HASH_FIELD] = 'user'
|
128
140
|
|
129
141
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = UserSignature
|
130
142
|
|
131
|
-
raise SDKException.new(Constants::SWITCH_USER_ERROR, Constants::
|
143
|
+
raise SDKException.new(Constants::SWITCH_USER_ERROR, Constants::USER_SIGNATURE_ERROR_MESSAGE, error, nil)
|
132
144
|
|
133
145
|
end
|
134
146
|
|
135
147
|
require_relative '../../crm/api/dc/datacenter'
|
136
148
|
|
137
|
-
|
149
|
+
if !environment.nil? and !environment.is_a?(DC::DataCenter::Environment)
|
138
150
|
error[Constants::ERROR_HASH_FIELD] = 'environment'
|
139
151
|
|
140
152
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = DC::DataCenter::Environment
|
@@ -145,7 +157,7 @@ class Initializer
|
|
145
157
|
|
146
158
|
require_relative '../../api/authenticator/token'
|
147
159
|
|
148
|
-
|
160
|
+
if !token.nil? and !token.is_a?(Authenticator::Token)
|
149
161
|
error[Constants::ERROR_HASH_FIELD] = 'token'
|
150
162
|
|
151
163
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = Authenticator::Token
|
@@ -154,9 +166,20 @@ class Initializer
|
|
154
166
|
|
155
167
|
end
|
156
168
|
|
169
|
+
require_relative 'request_proxy'
|
170
|
+
|
171
|
+
if !request_proxy.nil? and !request_proxy.is_a?(RequestProxy)
|
172
|
+
error[Constants::ERROR_HASH_FIELD] = 'request_proxy'
|
173
|
+
|
174
|
+
error[Constants::ERROR_HASH_EXPECTED_TYPE] = RequestProxy
|
175
|
+
|
176
|
+
raise SDKException.new(Constants::SWITCH_USER_ERROR, Constants::REQUEST_PROXY_ERROR_MESSAGE, error, nil)
|
177
|
+
|
178
|
+
end
|
179
|
+
|
157
180
|
require_relative 'sdk_config'
|
158
181
|
|
159
|
-
|
182
|
+
if !sdk_config.nil? and !sdk_config.is_a?(SDKConfig)
|
160
183
|
error[Constants::ERROR_HASH_FIELD] = 'sdk_config'
|
161
184
|
|
162
185
|
error[Constants::ERROR_HASH_EXPECTED_TYPE] = SDKConfig
|
@@ -167,13 +190,15 @@ class Initializer
|
|
167
190
|
|
168
191
|
initializer = Initializer.new
|
169
192
|
|
170
|
-
|
193
|
+
previous_initializer = Initializer.get_initializer
|
194
|
+
|
195
|
+
initializer.user = user.nil? ? previous_initializer.user : user
|
171
196
|
|
172
|
-
initializer.environment = environment
|
197
|
+
initializer.environment = environment.nil? ? previous_initializer.environment : environment
|
173
198
|
|
174
|
-
initializer.sdk_config = sdk_config
|
199
|
+
initializer.sdk_config = sdk_config.nil? ? previous_initializer.sdk_config : sdk_config
|
175
200
|
|
176
|
-
initializer.token = token
|
201
|
+
initializer.token = token.nil? ? previous_initializer.token : token
|
177
202
|
|
178
203
|
initializer.store = @@initializer.store
|
179
204
|
|
@@ -0,0 +1,121 @@
|
|
1
|
+
require_relative '../util/choice'
|
2
|
+
require_relative '../util/model'
|
3
|
+
|
4
|
+
module InventoryTemplates
|
5
|
+
require_relative 'response_handler'
|
6
|
+
class APIException
|
7
|
+
include Util::Model
|
8
|
+
include ResponseHandler
|
9
|
+
|
10
|
+
# Creates an instance of APIException
|
11
|
+
def initialize
|
12
|
+
@code = nil
|
13
|
+
@status = nil
|
14
|
+
@message = nil
|
15
|
+
@details = nil
|
16
|
+
@key_modified = Hash.new
|
17
|
+
end
|
18
|
+
|
19
|
+
# The method to get the code
|
20
|
+
# @return An instance of Util::Choice
|
21
|
+
|
22
|
+
def code
|
23
|
+
@code
|
24
|
+
end
|
25
|
+
|
26
|
+
# The method to set the value to code
|
27
|
+
# @param code [Util::Choice] An instance of Util::Choice
|
28
|
+
|
29
|
+
def code=(code)
|
30
|
+
if code!=nil and !code.is_a? Util::Choice
|
31
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: code EXPECTED TYPE: Util::Choice', nil, nil)
|
32
|
+
end
|
33
|
+
@code = code
|
34
|
+
@key_modified['code'] = 1
|
35
|
+
end
|
36
|
+
|
37
|
+
# The method to get the status
|
38
|
+
# @return An instance of Util::Choice
|
39
|
+
|
40
|
+
def status
|
41
|
+
@status
|
42
|
+
end
|
43
|
+
|
44
|
+
# The method to set the value to status
|
45
|
+
# @param status [Util::Choice] An instance of Util::Choice
|
46
|
+
|
47
|
+
def status=(status)
|
48
|
+
if status!=nil and !status.is_a? Util::Choice
|
49
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: status EXPECTED TYPE: Util::Choice', nil, nil)
|
50
|
+
end
|
51
|
+
@status = status
|
52
|
+
@key_modified['status'] = 1
|
53
|
+
end
|
54
|
+
|
55
|
+
# The method to get the message
|
56
|
+
# @return An instance of Util::Choice
|
57
|
+
|
58
|
+
def message
|
59
|
+
@message
|
60
|
+
end
|
61
|
+
|
62
|
+
# The method to set the value to message
|
63
|
+
# @param message [Util::Choice] An instance of Util::Choice
|
64
|
+
|
65
|
+
def message=(message)
|
66
|
+
if message!=nil and !message.is_a? Util::Choice
|
67
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: message EXPECTED TYPE: Util::Choice', nil, nil)
|
68
|
+
end
|
69
|
+
@message = message
|
70
|
+
@key_modified['message'] = 1
|
71
|
+
end
|
72
|
+
|
73
|
+
# The method to get the details
|
74
|
+
# @return An instance of Hash
|
75
|
+
|
76
|
+
def details
|
77
|
+
@details
|
78
|
+
end
|
79
|
+
|
80
|
+
# The method to set the value to details
|
81
|
+
# @param details [Hash] An instance of Hash
|
82
|
+
|
83
|
+
def details=(details)
|
84
|
+
if details!=nil and !details.is_a? Hash
|
85
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: details EXPECTED TYPE: Hash', nil, nil)
|
86
|
+
end
|
87
|
+
@details = details
|
88
|
+
@key_modified['details'] = 1
|
89
|
+
end
|
90
|
+
|
91
|
+
# The method to check if the user has modified the given key
|
92
|
+
# @param key [String] A String
|
93
|
+
# @return A Integer value
|
94
|
+
|
95
|
+
def is_key_modified(key)
|
96
|
+
if key!=nil and !key.is_a? String
|
97
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: String', nil, nil)
|
98
|
+
end
|
99
|
+
if @key_modified.key?(key)
|
100
|
+
return @key_modified[key]
|
101
|
+
end
|
102
|
+
|
103
|
+
nil
|
104
|
+
end
|
105
|
+
|
106
|
+
# The method to mark the given key as modified
|
107
|
+
# @param key [String] A String
|
108
|
+
# @param modification [Integer] A Integer
|
109
|
+
|
110
|
+
def set_key_modified(key, modification)
|
111
|
+
if key!=nil and !key.is_a? String
|
112
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: String', nil, nil)
|
113
|
+
end
|
114
|
+
if modification!=nil and !modification.is_a? Integer
|
115
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: Integer', nil, nil)
|
116
|
+
end
|
117
|
+
@key_modified[key] = modification
|
118
|
+
end
|
119
|
+
|
120
|
+
end
|
121
|
+
end
|
@@ -0,0 +1,352 @@
|
|
1
|
+
require_relative '../modules/module'
|
2
|
+
require_relative '../send_mail/template'
|
3
|
+
require_relative '../users/user'
|
4
|
+
require_relative '../util/model'
|
5
|
+
|
6
|
+
module InventoryTemplates
|
7
|
+
require_relative '../send_mail/template'
|
8
|
+
|
9
|
+
class InventoryTemplate
|
10
|
+
include SendMail::Template
|
11
|
+
include Util::Model
|
12
|
+
|
13
|
+
# Creates an instance of InventoryTemplate
|
14
|
+
def initialize
|
15
|
+
@content = nil
|
16
|
+
@created_time = nil
|
17
|
+
@subject = nil
|
18
|
+
@module_1 = nil
|
19
|
+
@type = nil
|
20
|
+
@created_by = nil
|
21
|
+
@modified_time = nil
|
22
|
+
@last_usage_time = nil
|
23
|
+
@associated = nil
|
24
|
+
@name = nil
|
25
|
+
@modified_by = nil
|
26
|
+
@description = nil
|
27
|
+
@id = nil
|
28
|
+
@editor_mode = nil
|
29
|
+
@favorite = nil
|
30
|
+
@folder = nil
|
31
|
+
@key_modified = Hash.new
|
32
|
+
end
|
33
|
+
|
34
|
+
# The method to get the content
|
35
|
+
# @return A String value
|
36
|
+
|
37
|
+
def content
|
38
|
+
@content
|
39
|
+
end
|
40
|
+
|
41
|
+
# The method to set the value to content
|
42
|
+
# @param content [String] A String
|
43
|
+
|
44
|
+
def content=(content)
|
45
|
+
if content!=nil and !content.is_a? String
|
46
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: content EXPECTED TYPE: String', nil, nil)
|
47
|
+
end
|
48
|
+
@content = content
|
49
|
+
@key_modified['content'] = 1
|
50
|
+
end
|
51
|
+
|
52
|
+
# The method to get the created_time
|
53
|
+
# @return An instance of DateTime
|
54
|
+
|
55
|
+
def created_time
|
56
|
+
@created_time
|
57
|
+
end
|
58
|
+
|
59
|
+
# The method to set the value to created_time
|
60
|
+
# @param created_time [DateTime] An instance of DateTime
|
61
|
+
|
62
|
+
def created_time=(created_time)
|
63
|
+
if created_time!=nil and !created_time.is_a? DateTime
|
64
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: created_time EXPECTED TYPE: DateTime', nil, nil)
|
65
|
+
end
|
66
|
+
@created_time = created_time
|
67
|
+
@key_modified['created_time'] = 1
|
68
|
+
end
|
69
|
+
|
70
|
+
# The method to get the subject
|
71
|
+
# @return A String value
|
72
|
+
|
73
|
+
def subject
|
74
|
+
@subject
|
75
|
+
end
|
76
|
+
|
77
|
+
# The method to set the value to subject
|
78
|
+
# @param subject [String] A String
|
79
|
+
|
80
|
+
def subject=(subject)
|
81
|
+
if subject!=nil and !subject.is_a? String
|
82
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: subject EXPECTED TYPE: String', nil, nil)
|
83
|
+
end
|
84
|
+
@subject = subject
|
85
|
+
@key_modified['subject'] = 1
|
86
|
+
end
|
87
|
+
|
88
|
+
# The method to get the module
|
89
|
+
# @return An instance of Modules::Module
|
90
|
+
|
91
|
+
def module
|
92
|
+
@module_1
|
93
|
+
end
|
94
|
+
|
95
|
+
# The method to set the value to module
|
96
|
+
# @param module_1 [Modules::Module] An instance of Modules::Module
|
97
|
+
|
98
|
+
def module=(module_1)
|
99
|
+
if module_1!=nil and !module_1.is_a? Modules::Module
|
100
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: module_1 EXPECTED TYPE: Module', nil, nil)
|
101
|
+
end
|
102
|
+
@module_1 = module_1
|
103
|
+
@key_modified['module'] = 1
|
104
|
+
end
|
105
|
+
|
106
|
+
# The method to get the type
|
107
|
+
# @return A String value
|
108
|
+
|
109
|
+
def type
|
110
|
+
@type
|
111
|
+
end
|
112
|
+
|
113
|
+
# The method to set the value to type
|
114
|
+
# @param type [String] A String
|
115
|
+
|
116
|
+
def type=(type)
|
117
|
+
if type!=nil and !type.is_a? String
|
118
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: type EXPECTED TYPE: String', nil, nil)
|
119
|
+
end
|
120
|
+
@type = type
|
121
|
+
@key_modified['type'] = 1
|
122
|
+
end
|
123
|
+
|
124
|
+
# The method to get the created_by
|
125
|
+
# @return An instance of Users::User
|
126
|
+
|
127
|
+
def created_by
|
128
|
+
@created_by
|
129
|
+
end
|
130
|
+
|
131
|
+
# The method to set the value to created_by
|
132
|
+
# @param created_by [Users::User] An instance of Users::User
|
133
|
+
|
134
|
+
def created_by=(created_by)
|
135
|
+
if created_by!=nil and !created_by.is_a? Users::User
|
136
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: created_by EXPECTED TYPE: User', nil, nil)
|
137
|
+
end
|
138
|
+
@created_by = created_by
|
139
|
+
@key_modified['created_by'] = 1
|
140
|
+
end
|
141
|
+
|
142
|
+
# The method to get the modified_time
|
143
|
+
# @return An instance of DateTime
|
144
|
+
|
145
|
+
def modified_time
|
146
|
+
@modified_time
|
147
|
+
end
|
148
|
+
|
149
|
+
# The method to set the value to modified_time
|
150
|
+
# @param modified_time [DateTime] An instance of DateTime
|
151
|
+
|
152
|
+
def modified_time=(modified_time)
|
153
|
+
if modified_time!=nil and !modified_time.is_a? DateTime
|
154
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: modified_time EXPECTED TYPE: DateTime', nil, nil)
|
155
|
+
end
|
156
|
+
@modified_time = modified_time
|
157
|
+
@key_modified['modified_time'] = 1
|
158
|
+
end
|
159
|
+
|
160
|
+
# The method to get the last_usage_time
|
161
|
+
# @return An instance of DateTime
|
162
|
+
|
163
|
+
def last_usage_time
|
164
|
+
@last_usage_time
|
165
|
+
end
|
166
|
+
|
167
|
+
# The method to set the value to last_usage_time
|
168
|
+
# @param last_usage_time [DateTime] An instance of DateTime
|
169
|
+
|
170
|
+
def last_usage_time=(last_usage_time)
|
171
|
+
if last_usage_time!=nil and !last_usage_time.is_a? DateTime
|
172
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: last_usage_time EXPECTED TYPE: DateTime', nil, nil)
|
173
|
+
end
|
174
|
+
@last_usage_time = last_usage_time
|
175
|
+
@key_modified['last_usage_time'] = 1
|
176
|
+
end
|
177
|
+
|
178
|
+
# The method to get the associated
|
179
|
+
# @return A Boolean value
|
180
|
+
|
181
|
+
def associated
|
182
|
+
@associated
|
183
|
+
end
|
184
|
+
|
185
|
+
# The method to set the value to associated
|
186
|
+
# @param associated [Boolean] A Boolean
|
187
|
+
|
188
|
+
def associated=(associated)
|
189
|
+
if associated!=nil and ! [true, false].include?associated
|
190
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: associated EXPECTED TYPE: Boolean', nil, nil)
|
191
|
+
end
|
192
|
+
@associated = associated
|
193
|
+
@key_modified['associated'] = 1
|
194
|
+
end
|
195
|
+
|
196
|
+
# The method to get the name
|
197
|
+
# @return A String value
|
198
|
+
|
199
|
+
def name
|
200
|
+
@name
|
201
|
+
end
|
202
|
+
|
203
|
+
# The method to set the value to name
|
204
|
+
# @param name [String] A String
|
205
|
+
|
206
|
+
def name=(name)
|
207
|
+
if name!=nil and !name.is_a? String
|
208
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: name EXPECTED TYPE: String', nil, nil)
|
209
|
+
end
|
210
|
+
@name = name
|
211
|
+
@key_modified['name'] = 1
|
212
|
+
end
|
213
|
+
|
214
|
+
# The method to get the modified_by
|
215
|
+
# @return An instance of Users::User
|
216
|
+
|
217
|
+
def modified_by
|
218
|
+
@modified_by
|
219
|
+
end
|
220
|
+
|
221
|
+
# The method to set the value to modified_by
|
222
|
+
# @param modified_by [Users::User] An instance of Users::User
|
223
|
+
|
224
|
+
def modified_by=(modified_by)
|
225
|
+
if modified_by!=nil and !modified_by.is_a? Users::User
|
226
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: modified_by EXPECTED TYPE: User', nil, nil)
|
227
|
+
end
|
228
|
+
@modified_by = modified_by
|
229
|
+
@key_modified['modified_by'] = 1
|
230
|
+
end
|
231
|
+
|
232
|
+
# The method to get the description
|
233
|
+
# @return A String value
|
234
|
+
|
235
|
+
def description
|
236
|
+
@description
|
237
|
+
end
|
238
|
+
|
239
|
+
# The method to set the value to description
|
240
|
+
# @param description [String] A String
|
241
|
+
|
242
|
+
def description=(description)
|
243
|
+
if description!=nil and !description.is_a? String
|
244
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: description EXPECTED TYPE: String', nil, nil)
|
245
|
+
end
|
246
|
+
@description = description
|
247
|
+
@key_modified['description'] = 1
|
248
|
+
end
|
249
|
+
|
250
|
+
# The method to get the id
|
251
|
+
# @return A Integer value
|
252
|
+
|
253
|
+
def id
|
254
|
+
@id
|
255
|
+
end
|
256
|
+
|
257
|
+
# The method to set the value to id
|
258
|
+
# @param id [Integer] A Integer
|
259
|
+
|
260
|
+
def id=(id)
|
261
|
+
if id!=nil and !id.is_a? Integer
|
262
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: Integer', nil, nil)
|
263
|
+
end
|
264
|
+
@id = id
|
265
|
+
@key_modified['id'] = 1
|
266
|
+
end
|
267
|
+
|
268
|
+
# The method to get the editor_mode
|
269
|
+
# @return A String value
|
270
|
+
|
271
|
+
def editor_mode
|
272
|
+
@editor_mode
|
273
|
+
end
|
274
|
+
|
275
|
+
# The method to set the value to editor_mode
|
276
|
+
# @param editor_mode [String] A String
|
277
|
+
|
278
|
+
def editor_mode=(editor_mode)
|
279
|
+
if editor_mode!=nil and !editor_mode.is_a? String
|
280
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: editor_mode EXPECTED TYPE: String', nil, nil)
|
281
|
+
end
|
282
|
+
@editor_mode = editor_mode
|
283
|
+
@key_modified['editor_mode'] = 1
|
284
|
+
end
|
285
|
+
|
286
|
+
# The method to get the favorite
|
287
|
+
# @return A Boolean value
|
288
|
+
|
289
|
+
def favorite
|
290
|
+
@favorite
|
291
|
+
end
|
292
|
+
|
293
|
+
# The method to set the value to favorite
|
294
|
+
# @param favorite [Boolean] A Boolean
|
295
|
+
|
296
|
+
def favorite=(favorite)
|
297
|
+
if favorite!=nil and ! [true, false].include?favorite
|
298
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: favorite EXPECTED TYPE: Boolean', nil, nil)
|
299
|
+
end
|
300
|
+
@favorite = favorite
|
301
|
+
@key_modified['favorite'] = 1
|
302
|
+
end
|
303
|
+
|
304
|
+
# The method to get the folder
|
305
|
+
# @return An instance of InventoryTemplate
|
306
|
+
|
307
|
+
def folder
|
308
|
+
@folder
|
309
|
+
end
|
310
|
+
|
311
|
+
# The method to set the value to folder
|
312
|
+
# @param folder [InventoryTemplate] An instance of InventoryTemplate
|
313
|
+
|
314
|
+
def folder=(folder)
|
315
|
+
if folder!=nil and !folder.is_a? InventoryTemplate
|
316
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: folder EXPECTED TYPE: InventoryTemplate', nil, nil)
|
317
|
+
end
|
318
|
+
@folder = folder
|
319
|
+
@key_modified['folder'] = 1
|
320
|
+
end
|
321
|
+
|
322
|
+
# The method to check if the user has modified the given key
|
323
|
+
# @param key [String] A String
|
324
|
+
# @return A Integer value
|
325
|
+
|
326
|
+
def is_key_modified(key)
|
327
|
+
if key!=nil and !key.is_a? String
|
328
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: String', nil, nil)
|
329
|
+
end
|
330
|
+
if @key_modified.key?(key)
|
331
|
+
return @key_modified[key]
|
332
|
+
end
|
333
|
+
|
334
|
+
nil
|
335
|
+
end
|
336
|
+
|
337
|
+
# The method to mark the given key as modified
|
338
|
+
# @param key [String] A String
|
339
|
+
# @param modification [Integer] A Integer
|
340
|
+
|
341
|
+
def set_key_modified(key, modification)
|
342
|
+
if key!=nil and !key.is_a? String
|
343
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: key EXPECTED TYPE: String', nil, nil)
|
344
|
+
end
|
345
|
+
if modification!=nil and !modification.is_a? Integer
|
346
|
+
raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: modification EXPECTED TYPE: Integer', nil, nil)
|
347
|
+
end
|
348
|
+
@key_modified[key] = modification
|
349
|
+
end
|
350
|
+
|
351
|
+
end
|
352
|
+
end
|