ZCRMSDK 2.0.0 → 3.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (174) hide show
  1. checksums.yaml +4 -4
  2. data/src/ZCRMSDK.rb +87 -2
  3. data/src/com/zoho/api/authenticator/oauth_token.rb +86 -31
  4. data/src/com/zoho/api/authenticator/store/db_store.rb +71 -29
  5. data/src/com/zoho/api/authenticator/store/file_store.rb +91 -21
  6. data/src/com/zoho/api/authenticator/store/token_store.rb +7 -0
  7. data/src/com/zoho/api/logger/sdk_logger.rb +18 -9
  8. data/src/com/zoho/crm/api/assignment_rules/api_exception.rb +121 -0
  9. data/src/com/zoho/crm/api/assignment_rules/assignment_rule.rb +215 -0
  10. data/src/com/zoho/crm/api/assignment_rules/assignment_rules_operations.rb +61 -0
  11. data/src/com/zoho/crm/api/assignment_rules/default_user.rb +80 -0
  12. data/src/com/zoho/crm/api/assignment_rules/response_handler.rb +10 -0
  13. data/src/com/zoho/crm/api/assignment_rules/response_wrapper.rb +63 -0
  14. data/src/com/zoho/crm/api/attachments/attachment.rb +42 -4
  15. data/src/com/zoho/crm/api/attachments/attachments_operations.rb +6 -6
  16. data/src/com/zoho/crm/api/blue_print/blue_print_operations.rb +2 -2
  17. data/src/com/zoho/crm/api/blue_print/escalation.rb +80 -0
  18. data/src/com/zoho/crm/api/blue_print/field.rb +1127 -0
  19. data/src/com/zoho/crm/api/blue_print/next_transition.rb +38 -0
  20. data/src/com/zoho/crm/api/blue_print/process_info.rb +4 -4
  21. data/src/com/zoho/crm/api/blue_print/transition.rb +19 -1
  22. data/src/com/zoho/crm/api/blue_print/validation_error.rb +57 -0
  23. data/src/com/zoho/crm/api/bulk_read/bulk_read_operations.rb +3 -3
  24. data/src/com/zoho/crm/api/bulk_read/criteria.rb +20 -0
  25. data/src/com/zoho/crm/api/bulk_read/query.rb +5 -4
  26. data/src/com/zoho/crm/api/bulk_write/bulk_write_operations.rb +3 -3
  27. data/src/com/zoho/crm/api/bulk_write/resource.rb +24 -4
  28. data/src/com/zoho/crm/api/contact_roles/contact_roles_operations.rb +7 -7
  29. data/src/com/zoho/crm/api/currencies/currencies_operations.rb +7 -7
  30. data/src/com/zoho/crm/api/custom_views/criteria.rb +5 -4
  31. data/src/com/zoho/crm/api/custom_views/custom_view.rb +100 -41
  32. data/src/com/zoho/crm/api/custom_views/custom_views_operations.rb +2 -2
  33. data/src/com/zoho/crm/api/custom_views/{shared_details.rb → shared_to.rb} +2 -2
  34. data/src/com/zoho/crm/api/dc/au_datacenter.rb +3 -3
  35. data/src/com/zoho/crm/api/dc/cn_datacenter.rb +3 -3
  36. data/src/com/zoho/crm/api/dc/datacenter.rb +3 -2
  37. data/src/com/zoho/crm/api/dc/eu_datacenter.rb +3 -3
  38. data/src/com/zoho/crm/api/dc/in_datacenter.rb +3 -3
  39. data/src/com/zoho/crm/api/dc/us_datacenter.rb +3 -3
  40. data/src/com/zoho/crm/api/email_templates/api_exception.rb +121 -0
  41. data/src/com/zoho/crm/api/email_templates/attachment.rb +118 -0
  42. data/src/com/zoho/crm/api/email_templates/email_template.rb +390 -0
  43. data/src/com/zoho/crm/api/email_templates/email_templates_operations.rb +61 -0
  44. data/src/com/zoho/crm/api/email_templates/response_handler.rb +10 -0
  45. data/src/com/zoho/crm/api/email_templates/response_wrapper.rb +83 -0
  46. data/src/com/zoho/crm/api/field_attachments/api_exception.rb +121 -0
  47. data/src/com/zoho/crm/api/field_attachments/body_wrapper.rb +62 -0
  48. data/src/com/zoho/crm/api/field_attachments/field_attachments_operations.rb +52 -0
  49. data/src/com/zoho/crm/api/field_attachments/file_body_wrapper.rb +64 -0
  50. data/src/com/zoho/crm/api/field_attachments/response_handler.rb +10 -0
  51. data/src/com/zoho/crm/api/fields/external.rb +99 -0
  52. data/src/com/zoho/crm/api/fields/field.rb +215 -61
  53. data/src/com/zoho/crm/api/fields/fields_operations.rb +2 -2
  54. data/src/com/zoho/crm/api/fields/history_tracking.rb +80 -0
  55. data/src/com/zoho/crm/api/fields/maps.rb +80 -0
  56. data/src/com/zoho/crm/api/fields/multi_module_lookup.rb +99 -0
  57. data/src/com/zoho/crm/api/fields/multi_select_lookup.rb +19 -0
  58. data/src/com/zoho/crm/api/fields/multi_user_lookup.rb +175 -0
  59. data/src/com/zoho/crm/api/fields/pick_list_value.rb +19 -0
  60. data/src/com/zoho/crm/api/fields/related_details.rb +19 -0
  61. data/src/com/zoho/crm/api/files/file_operations.rb +2 -2
  62. data/src/com/zoho/crm/api/initializer.rb +45 -17
  63. data/src/com/zoho/crm/api/inventory_templates/api_exception.rb +121 -0
  64. data/src/com/zoho/crm/api/inventory_templates/inventory_template.rb +352 -0
  65. data/src/com/zoho/crm/api/inventory_templates/inventory_templates_operations.rb +82 -0
  66. data/src/com/zoho/crm/api/inventory_templates/response_handler.rb +10 -0
  67. data/src/com/zoho/crm/api/inventory_templates/response_wrapper.rb +83 -0
  68. data/src/com/zoho/crm/api/layouts/layout.rb +38 -0
  69. data/src/com/zoho/crm/api/layouts/layouts_operations.rb +2 -2
  70. data/src/com/zoho/crm/api/layouts/section.rb +19 -0
  71. data/src/com/zoho/crm/api/modules/module.rb +57 -0
  72. data/src/com/zoho/crm/api/modules/modules_operations.rb +4 -4
  73. data/src/com/zoho/crm/api/notes/note.rb +19 -0
  74. data/src/com/zoho/crm/api/notes/notes_operations.rb +7 -7
  75. data/src/com/zoho/crm/api/notification/notification_operations.rb +6 -6
  76. data/src/com/zoho/crm/api/org/hierarchy_preference.rb +61 -0
  77. data/src/com/zoho/crm/api/org/org.rb +38 -0
  78. data/src/com/zoho/crm/api/org/org_operations.rb +2 -2
  79. data/src/com/zoho/crm/api/pipeline/action_handler.rb +10 -0
  80. data/src/com/zoho/crm/api/pipeline/action_response.rb +10 -0
  81. data/src/com/zoho/crm/api/pipeline/action_wrapper.rb +63 -0
  82. data/src/com/zoho/crm/api/pipeline/api_exception.rb +129 -0
  83. data/src/com/zoho/crm/api/pipeline/body_wrapper.rb +61 -0
  84. data/src/com/zoho/crm/api/pipeline/forecast_category.rb +80 -0
  85. data/src/com/zoho/crm/api/pipeline/pick_list_value.rb +175 -0
  86. data/src/com/zoho/crm/api/pipeline/pipeline.rb +213 -0
  87. data/src/com/zoho/crm/api/pipeline/pipeline_operations.rb +165 -0
  88. data/src/com/zoho/crm/api/pipeline/response_handler.rb +10 -0
  89. data/src/com/zoho/crm/api/pipeline/response_wrapper.rb +63 -0
  90. data/src/com/zoho/crm/api/pipeline/stage.rb +80 -0
  91. data/src/com/zoho/crm/api/pipeline/success_response.rb +123 -0
  92. data/src/com/zoho/crm/api/pipeline/transfer_action_handler.rb +10 -0
  93. data/src/com/zoho/crm/api/pipeline/transfer_action_response.rb +10 -0
  94. data/src/com/zoho/crm/api/pipeline/transfer_action_wrapper.rb +63 -0
  95. data/src/com/zoho/crm/api/pipeline/transfer_and_delete_wrapper.rb +61 -0
  96. data/src/com/zoho/crm/api/pipeline/transfer_pipe_line.rb +80 -0
  97. data/src/com/zoho/crm/api/profiles/category.rb +19 -0
  98. data/src/com/zoho/crm/api/profiles/default_view.rb +99 -0
  99. data/src/com/zoho/crm/api/profiles/profile.rb +49 -11
  100. data/src/com/zoho/crm/api/profiles/profiles_operations.rb +2 -2
  101. data/src/com/zoho/crm/api/query/query_operations.rb +1 -1
  102. data/src/com/zoho/crm/api/record/api_exception.rb +2 -0
  103. data/src/com/zoho/crm/api/record/body_wrapper.rb +0 -19
  104. data/src/com/zoho/crm/api/record/count_handler.rb +10 -0
  105. data/src/com/zoho/crm/api/record/count_wrapper.rb +63 -0
  106. data/src/com/zoho/crm/api/record/field.rb +17 -17
  107. data/src/com/zoho/crm/api/record/image_upload.rb +213 -0
  108. data/src/com/zoho/crm/api/record/line_tax.rb +19 -0
  109. data/src/com/zoho/crm/api/record/mass_update_body_wrapper.rb +4 -4
  110. data/src/com/zoho/crm/api/record/mass_update_territory.rb +80 -0
  111. data/src/com/zoho/crm/api/record/multi_select_lookup.rb +99 -0
  112. data/src/com/zoho/crm/api/record/multi_select_picklist.rb +80 -0
  113. data/src/com/zoho/crm/api/record/price_book.rb +31 -0
  114. data/src/com/zoho/crm/api/record/record_operations.rb +196 -26
  115. data/src/com/zoho/crm/api/record/tax.rb +80 -0
  116. data/src/com/zoho/crm/api/record/territory.rb +70 -12
  117. data/src/com/zoho/crm/api/record/widget.rb +80 -0
  118. data/src/com/zoho/crm/api/record/wizard.rb +80 -0
  119. data/src/com/zoho/crm/api/related_lists/related_lists_operations.rb +2 -2
  120. data/src/com/zoho/crm/api/related_records/related_records_operations.rb +6 -6
  121. data/src/com/zoho/crm/api/request_proxy.rb +3 -4
  122. data/src/com/zoho/crm/api/roles/roles_operations.rb +2 -2
  123. data/src/com/zoho/crm/api/sdk_config.rb +2 -68
  124. data/src/com/zoho/crm/api/send_mail/action_handler.rb +10 -0
  125. data/src/com/zoho/crm/api/send_mail/action_response.rb +10 -0
  126. data/src/com/zoho/crm/api/send_mail/action_wrapper.rb +63 -0
  127. data/src/com/zoho/crm/api/send_mail/api_exception.rb +125 -0
  128. data/src/com/zoho/crm/api/send_mail/body_wrapper.rb +61 -0
  129. data/src/com/zoho/crm/api/send_mail/data_subject_request.rb +80 -0
  130. data/src/com/zoho/crm/api/send_mail/inventory_details.rb +100 -0
  131. data/src/com/zoho/crm/api/send_mail/mail.rb +423 -0
  132. data/src/com/zoho/crm/api/send_mail/response_handler.rb +10 -0
  133. data/src/com/zoho/crm/api/send_mail/response_wrapper.rb +63 -0
  134. data/src/com/zoho/crm/api/send_mail/send_mail_operations.rb +61 -0
  135. data/src/com/zoho/crm/api/send_mail/success_response.rb +121 -0
  136. data/src/com/zoho/crm/api/send_mail/template.rb +10 -0
  137. data/src/com/zoho/crm/api/send_mail/user_address.rb +137 -0
  138. data/src/com/zoho/crm/api/share_records/share_records_operations.rb +4 -4
  139. data/src/com/zoho/crm/api/tags/tag.rb +19 -0
  140. data/src/com/zoho/crm/api/tags/tags_operations.rb +11 -11
  141. data/src/com/zoho/crm/api/taxes/taxes_operations.rb +6 -6
  142. data/src/com/zoho/crm/api/territories/response_wrapper.rb +20 -0
  143. data/src/com/zoho/crm/api/territories/territories_operations.rb +2 -2
  144. data/src/com/zoho/crm/api/territories/territory.rb +61 -23
  145. data/src/com/zoho/crm/api/users/user.rb +34 -0
  146. data/src/com/zoho/crm/api/users/users_operations.rb +6 -6
  147. data/src/com/zoho/crm/api/util/api_http_connector.rb +6 -5
  148. data/src/com/zoho/crm/api/util/common_api_handler.rb +5 -3
  149. data/src/com/zoho/crm/api/util/constants.rb +140 -15
  150. data/src/com/zoho/crm/api/util/converter.rb +30 -7
  151. data/src/com/zoho/crm/api/util/data_type_converter.rb +8 -2
  152. data/src/com/zoho/crm/api/util/form_data_converter.rb +4 -15
  153. data/src/com/zoho/crm/api/util/json_converter.rb +7 -9
  154. data/src/com/zoho/crm/api/util/module_fields_handler.rb +1 -1
  155. data/src/com/zoho/crm/api/util/utility.rb +274 -87
  156. data/src/com/zoho/crm/api/variable_groups/variable_groups_operations.rb +3 -3
  157. data/src/com/zoho/crm/api/variables/variables_operations.rb +9 -9
  158. data/src/com/zoho/crm/api/wizards/api_exception.rb +121 -0
  159. data/src/com/zoho/crm/api/wizards/button.rb +252 -0
  160. data/src/com/zoho/crm/api/wizards/chart_data.rb +118 -0
  161. data/src/com/zoho/crm/api/wizards/connection.rb +80 -0
  162. data/src/com/zoho/crm/api/wizards/container.rb +119 -0
  163. data/src/com/zoho/crm/api/wizards/node.rb +118 -0
  164. data/src/com/zoho/crm/api/wizards/response_handler.rb +10 -0
  165. data/src/com/zoho/crm/api/wizards/response_wrapper.rb +63 -0
  166. data/src/com/zoho/crm/api/wizards/screen.rb +99 -0
  167. data/src/com/zoho/crm/api/wizards/segment.rb +176 -0
  168. data/src/com/zoho/crm/api/wizards/transition.rb +80 -0
  169. data/src/com/zoho/crm/api/wizards/wizard.rb +273 -0
  170. data/src/com/zoho/crm/api/wizards/wizards_operations.rb +61 -0
  171. data/src/resources/JSONDetails.json +1 -1
  172. data/src/version.rb +1 -1
  173. metadata +92 -7
  174. data/src/com/zoho/crm/api/record/inventory_line_items.rb +0 -235
@@ -13,6 +13,7 @@ module Fields
13
13
  @actual_value = nil
14
14
  @sys_ref_name = nil
15
15
  @type = nil
16
+ @id = nil
16
17
  @key_modified = Hash.new
17
18
  end
18
19
 
@@ -142,6 +143,24 @@ module Fields
142
143
  @key_modified['type'] = 1
143
144
  end
144
145
 
146
+ # The method to get the id
147
+ # @return A Integer value
148
+
149
+ def id
150
+ @id
151
+ end
152
+
153
+ # The method to set the value to id
154
+ # @param id [Integer] A Integer
155
+
156
+ def id=(id)
157
+ if id!=nil and !id.is_a? Integer
158
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: id EXPECTED TYPE: Integer', nil, nil)
159
+ end
160
+ @id = id
161
+ @key_modified['id'] = 1
162
+ end
163
+
145
164
  # The method to check if the user has modified the given key
146
165
  # @param key [String] A String
147
166
  # @return A Integer value
@@ -7,6 +7,7 @@ module Fields
7
7
  # Creates an instance of RelatedDetails
8
8
  def initialize
9
9
  @display_label = nil
10
+ @field_label = nil
10
11
  @api_name = nil
11
12
  @module_1 = nil
12
13
  @id = nil
@@ -32,6 +33,24 @@ module Fields
32
33
  @key_modified['display_label'] = 1
33
34
  end
34
35
 
36
+ # The method to get the field_label
37
+ # @return A String value
38
+
39
+ def field_label
40
+ @field_label
41
+ end
42
+
43
+ # The method to set the value to field_label
44
+ # @param field_label [String] A String
45
+
46
+ def field_label=(field_label)
47
+ if field_label!=nil and !field_label.is_a? String
48
+ raise SDKException.new(Constants::DATA_TYPE_ERROR, 'KEY: field_label EXPECTED TYPE: String', nil, nil)
49
+ end
50
+ @field_label = field_label
51
+ @key_modified['field_label'] = 1
52
+ end
53
+
35
54
  # The method to get the api_name
36
55
  # @return A String value
37
56
 
@@ -26,7 +26,7 @@ module Files
26
26
  end
27
27
  handler_instance = Handler::CommonAPIHandler.new
28
28
  api_path = ''
29
- api_path = api_path + '/crm/v2/files'
29
+ api_path = api_path + '/crm/v2.1/files'
30
30
  handler_instance.api_path = api_path
31
31
  handler_instance.http_method = Constants::REQUEST_METHOD_POST
32
32
  handler_instance.category_method = 'CREATE'
@@ -48,7 +48,7 @@ module Files
48
48
  end
49
49
  handler_instance = Handler::CommonAPIHandler.new
50
50
  api_path = ''
51
- api_path = api_path + '/crm/v2/files'
51
+ api_path = api_path + '/crm/v2.1/files'
52
52
  handler_instance.api_path = api_path
53
53
  handler_instance.http_method = Constants::REQUEST_METHOD_GET
54
54
  handler_instance.category_method = 'READ'
@@ -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, :user, :environment, :store, :token, :initializer, :local, :sdk_config, :resources_path, :request_proxy
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, environment, token, store, sdk_config, resources_path, log = nil, request_proxy = nil)
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::USERSIGNATURE_ERROR_MESSAGE, error, nil)
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
- log = SDKLog::Log.initialize(Levels::INFO, File.join(Dir.pwd, Constants::LOGFILE_NAME)) if log.nil?
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
@@ -109,7 +116,10 @@ class Initializer
109
116
  end
110
117
 
111
118
  def self.get_JSONDetails
112
- JSON.parse(File.open(File.join(File.dirname(File.expand_path(__FILE__)), '../../../../' + Constants::JSON_DETAILS_FILE_PATH)).read)
119
+ if @@json_details.nil? || @@json_details.length == 0
120
+ return JSON.parse(File.open(File.join(File.dirname(File.expand_path(__FILE__)), '../../../../' + Constants::JSON_DETAILS_FILE_PATH)).read)
121
+ end
122
+ @@json_details
113
123
  rescue StandardError => e
114
124
  raise SDKException.new(nil, Constants::EXCEPTION_JSONDETAILS, nil, e)
115
125
  end
@@ -120,21 +130,26 @@ class Initializer
120
130
  @@initializer
121
131
  end
122
132
 
123
- def self.switch_user(user, environment, token, sdk_config, request_proxy = nil)
133
+ def self.switch_user(user:nil, environment:nil, token:nil, sdk_config:nil, request_proxy: nil)
134
+
135
+ if @@initializer.nil?
136
+ raise SDKException.new(Constants::SDK_UNINITIALIZATION_ERROR, Constants::SDK_UNINITIALIZATION_MESSAGE)
137
+ end
138
+
124
139
  require_relative 'user_signature'
125
140
 
126
- unless user.is_a?(UserSignature)
141
+ if !user.nil? and !user.is_a?(UserSignature)
127
142
  error[Constants::ERROR_HASH_FIELD] = 'user'
128
143
 
129
144
  error[Constants::ERROR_HASH_EXPECTED_TYPE] = UserSignature
130
145
 
131
- raise SDKException.new(Constants::SWITCH_USER_ERROR, Constants::USERSIGNATURE_ERROR_MESSAGE, error, nil)
146
+ raise SDKException.new(Constants::SWITCH_USER_ERROR, Constants::USER_SIGNATURE_ERROR_MESSAGE, error, nil)
132
147
 
133
148
  end
134
149
 
135
150
  require_relative '../../crm/api/dc/datacenter'
136
151
 
137
- unless environment.is_a?(DC::DataCenter::Environment)
152
+ if !environment.nil? and !environment.is_a?(DC::DataCenter::Environment)
138
153
  error[Constants::ERROR_HASH_FIELD] = 'environment'
139
154
 
140
155
  error[Constants::ERROR_HASH_EXPECTED_TYPE] = DC::DataCenter::Environment
@@ -145,7 +160,7 @@ class Initializer
145
160
 
146
161
  require_relative '../../api/authenticator/token'
147
162
 
148
- unless token.is_a?(Authenticator::Token)
163
+ if !token.nil? and !token.is_a?(Authenticator::Token)
149
164
  error[Constants::ERROR_HASH_FIELD] = 'token'
150
165
 
151
166
  error[Constants::ERROR_HASH_EXPECTED_TYPE] = Authenticator::Token
@@ -154,9 +169,20 @@ class Initializer
154
169
 
155
170
  end
156
171
 
172
+ require_relative 'request_proxy'
173
+
174
+ if !request_proxy.nil? and !request_proxy.is_a?(RequestProxy)
175
+ error[Constants::ERROR_HASH_FIELD] = 'request_proxy'
176
+
177
+ error[Constants::ERROR_HASH_EXPECTED_TYPE] = RequestProxy
178
+
179
+ raise SDKException.new(Constants::SWITCH_USER_ERROR, Constants::REQUEST_PROXY_ERROR_MESSAGE, error, nil)
180
+
181
+ end
182
+
157
183
  require_relative 'sdk_config'
158
184
 
159
- unless sdk_config.is_a?(SDKConfig)
185
+ if !sdk_config.nil? and !sdk_config.is_a?(SDKConfig)
160
186
  error[Constants::ERROR_HASH_FIELD] = 'sdk_config'
161
187
 
162
188
  error[Constants::ERROR_HASH_EXPECTED_TYPE] = SDKConfig
@@ -167,13 +193,15 @@ class Initializer
167
193
 
168
194
  initializer = Initializer.new
169
195
 
170
- initializer.user = user
196
+ previous_initializer = Initializer.get_initializer
197
+
198
+ initializer.user = user.nil? ? previous_initializer.user : user
171
199
 
172
- initializer.environment = environment
200
+ initializer.environment = environment.nil? ? previous_initializer.environment : environment
173
201
 
174
- initializer.sdk_config = sdk_config
202
+ initializer.sdk_config = sdk_config.nil? ? previous_initializer.sdk_config : sdk_config
175
203
 
176
- initializer.token = token
204
+ initializer.token = token.nil? ? previous_initializer.token : token
177
205
 
178
206
  initializer.store = @@initializer.store
179
207
 
@@ -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