rustici_software_cloud_v2 1.0.0beta

Sign up to get free protection for your applications and to get access to all the features.
Files changed (226) hide show
  1. data/Gemfile +7 -0
  2. data/LICENSE +201 -0
  3. data/README.md +283 -0
  4. data/Rakefile +8 -0
  5. data/docs/ActivityResultSchema.md +20 -0
  6. data/docs/ApplicationListSchema.md +8 -0
  7. data/docs/ApplicationManagementApi.md +570 -0
  8. data/docs/ApplicationSchema.md +9 -0
  9. data/docs/ApplicationToken.md +10 -0
  10. data/docs/AuthenticationApi.md +64 -0
  11. data/docs/CommentSchema.md +10 -0
  12. data/docs/CompletionAmountSchema.md +8 -0
  13. data/docs/CourseActivitySchema.md +15 -0
  14. data/docs/CourseApi.md +1459 -0
  15. data/docs/CourseListNonPagedSchema.md +8 -0
  16. data/docs/CourseListSchema.md +9 -0
  17. data/docs/CourseReferenceSchema.md +10 -0
  18. data/docs/CourseSchema.md +20 -0
  19. data/docs/CourseTagsBatchSchema.md +9 -0
  20. data/docs/CreateRegistrationSchema.md +17 -0
  21. data/docs/CredentialCreatedSchema.md +12 -0
  22. data/docs/CredentialListSchema.md +8 -0
  23. data/docs/CredentialRequestSchema.md +9 -0
  24. data/docs/CredentialSchema.md +12 -0
  25. data/docs/ImportFetchRequestSchema.md +8 -0
  26. data/docs/ImportJobResultSchema.md +11 -0
  27. data/docs/ImportResultSchema.md +11 -0
  28. data/docs/IntegerResultSchema.md +8 -0
  29. data/docs/ItemValuePairSchema.md +9 -0
  30. data/docs/LaunchHistoryListSchema.md +8 -0
  31. data/docs/LaunchHistorySchema.md +17 -0
  32. data/docs/LaunchLinkRequestSchema.md +17 -0
  33. data/docs/LaunchLinkSchema.md +8 -0
  34. data/docs/LearnerPreferenceSchema.md +11 -0
  35. data/docs/LearnerSchema.md +11 -0
  36. data/docs/LinkSchema.md +8 -0
  37. data/docs/MessageSchema.md +8 -0
  38. data/docs/MetadataSchema.md +14 -0
  39. data/docs/ObjectiveSchema.md +20 -0
  40. data/docs/PermissionsSchema.md +9 -0
  41. data/docs/PingApi.md +57 -0
  42. data/docs/PingSchema.md +8 -0
  43. data/docs/PostBackSchema.md +12 -0
  44. data/docs/RegistrationApi.md +1490 -0
  45. data/docs/RegistrationCompletion.md +7 -0
  46. data/docs/RegistrationListSchema.md +9 -0
  47. data/docs/RegistrationSchema.md +27 -0
  48. data/docs/RegistrationSuccess.md +7 -0
  49. data/docs/RegistrationTagsBatchSchema.md +9 -0
  50. data/docs/ResponseError.md +8 -0
  51. data/docs/RuntimeInteractionSchema.md +18 -0
  52. data/docs/RuntimeObjectiveSchema.md +16 -0
  53. data/docs/RuntimeSchema.md +27 -0
  54. data/docs/ScoreSchema.md +8 -0
  55. data/docs/SettingItem.md +12 -0
  56. data/docs/SettingListSchema.md +8 -0
  57. data/docs/SettingMetadata.md +15 -0
  58. data/docs/SettingMetadataValidValues.md +9 -0
  59. data/docs/SettingValidValue.md +9 -0
  60. data/docs/SettingsIndividualSchema.md +10 -0
  61. data/docs/SettingsPostSchema.md +8 -0
  62. data/docs/SharedDataEntrySchema.md +9 -0
  63. data/docs/StaticPropertiesSchema.md +13 -0
  64. data/docs/StringResultSchema.md +8 -0
  65. data/docs/TagListSchema.md +8 -0
  66. data/docs/TagPostSchema.md +7 -0
  67. data/docs/TitleSchema.md +8 -0
  68. data/docs/TokenRequestSchema.md +9 -0
  69. data/docs/XapiAccount.md +9 -0
  70. data/docs/XapiActivity.md +10 -0
  71. data/docs/XapiActivityDefinition.md +19 -0
  72. data/docs/XapiAgentGroup.md +14 -0
  73. data/docs/XapiAttachment.md +14 -0
  74. data/docs/XapiContext.md +16 -0
  75. data/docs/XapiContextActivity.md +11 -0
  76. data/docs/XapiInteractionComponent.md +9 -0
  77. data/docs/XapiResult.md +13 -0
  78. data/docs/XapiScore.md +11 -0
  79. data/docs/XapiStatement.md +20 -0
  80. data/docs/XapiStatementReference.md +9 -0
  81. data/docs/XapiStatementResult.md +9 -0
  82. data/docs/XapiVerb.md +9 -0
  83. data/git_push.sh +55 -0
  84. data/lib/rustici_software_cloud_v2.rb +116 -0
  85. data/lib/rustici_software_cloud_v2/api/application_management_api.rb +574 -0
  86. data/lib/rustici_software_cloud_v2/api/authentication_api.rb +87 -0
  87. data/lib/rustici_software_cloud_v2/api/course_api.rb +1469 -0
  88. data/lib/rustici_software_cloud_v2/api/ping_api.rb +69 -0
  89. data/lib/rustici_software_cloud_v2/api/registration_api.rb +1499 -0
  90. data/lib/rustici_software_cloud_v2/api_client.rb +389 -0
  91. data/lib/rustici_software_cloud_v2/api_error.rb +38 -0
  92. data/lib/rustici_software_cloud_v2/configuration.rb +237 -0
  93. data/lib/rustici_software_cloud_v2/models/activity_result_schema.rb +341 -0
  94. data/lib/rustici_software_cloud_v2/models/application_list_schema.rb +185 -0
  95. data/lib/rustici_software_cloud_v2/models/application_schema.rb +194 -0
  96. data/lib/rustici_software_cloud_v2/models/application_token.rb +201 -0
  97. data/lib/rustici_software_cloud_v2/models/comment_schema.rb +201 -0
  98. data/lib/rustici_software_cloud_v2/models/completion_amount_schema.rb +184 -0
  99. data/lib/rustici_software_cloud_v2/models/course_activity_schema.rb +289 -0
  100. data/lib/rustici_software_cloud_v2/models/course_list_non_paged_schema.rb +185 -0
  101. data/lib/rustici_software_cloud_v2/models/course_list_schema.rb +194 -0
  102. data/lib/rustici_software_cloud_v2/models/course_reference_schema.rb +202 -0
  103. data/lib/rustici_software_cloud_v2/models/course_schema.rb +328 -0
  104. data/lib/rustici_software_cloud_v2/models/course_tags_batch_schema.rb +204 -0
  105. data/lib/rustici_software_cloud_v2/models/create_registration_schema.rb +287 -0
  106. data/lib/rustici_software_cloud_v2/models/credential_created_schema.rb +223 -0
  107. data/lib/rustici_software_cloud_v2/models/credential_list_schema.rb +185 -0
  108. data/lib/rustici_software_cloud_v2/models/credential_request_schema.rb +194 -0
  109. data/lib/rustici_software_cloud_v2/models/credential_schema.rb +223 -0
  110. data/lib/rustici_software_cloud_v2/models/import_fetch_request_schema.rb +190 -0
  111. data/lib/rustici_software_cloud_v2/models/import_job_result_schema.rb +244 -0
  112. data/lib/rustici_software_cloud_v2/models/import_result_schema.rb +215 -0
  113. data/lib/rustici_software_cloud_v2/models/integer_result_schema.rb +188 -0
  114. data/lib/rustici_software_cloud_v2/models/item_value_pair_schema.rb +192 -0
  115. data/lib/rustici_software_cloud_v2/models/launch_history_list_schema.rb +185 -0
  116. data/lib/rustici_software_cloud_v2/models/launch_history_schema.rb +317 -0
  117. data/lib/rustici_software_cloud_v2/models/launch_link_request_schema.rb +282 -0
  118. data/lib/rustici_software_cloud_v2/models/launch_link_schema.rb +188 -0
  119. data/lib/rustici_software_cloud_v2/models/learner_preference_schema.rb +210 -0
  120. data/lib/rustici_software_cloud_v2/models/learner_schema.rb +216 -0
  121. data/lib/rustici_software_cloud_v2/models/link_schema.rb +188 -0
  122. data/lib/rustici_software_cloud_v2/models/message_schema.rb +188 -0
  123. data/lib/rustici_software_cloud_v2/models/metadata_schema.rb +239 -0
  124. data/lib/rustici_software_cloud_v2/models/objective_schema.rb +355 -0
  125. data/lib/rustici_software_cloud_v2/models/permissions_schema.rb +195 -0
  126. data/lib/rustici_software_cloud_v2/models/ping_schema.rb +188 -0
  127. data/lib/rustici_software_cloud_v2/models/post_back_schema.rb +273 -0
  128. data/lib/rustici_software_cloud_v2/models/registration_completion.rb +31 -0
  129. data/lib/rustici_software_cloud_v2/models/registration_list_schema.rb +199 -0
  130. data/lib/rustici_software_cloud_v2/models/registration_schema.rb +360 -0
  131. data/lib/rustici_software_cloud_v2/models/registration_success.rb +31 -0
  132. data/lib/rustici_software_cloud_v2/models/registration_tags_batch_schema.rb +204 -0
  133. data/lib/rustici_software_cloud_v2/models/response_error.rb +188 -0
  134. data/lib/rustici_software_cloud_v2/models/runtime_interaction_schema.rb +311 -0
  135. data/lib/rustici_software_cloud_v2/models/runtime_objective_schema.rb +305 -0
  136. data/lib/rustici_software_cloud_v2/models/runtime_schema.rb +398 -0
  137. data/lib/rustici_software_cloud_v2/models/score_schema.rb +184 -0
  138. data/lib/rustici_software_cloud_v2/models/setting_item.rb +256 -0
  139. data/lib/rustici_software_cloud_v2/models/setting_list_schema.rb +190 -0
  140. data/lib/rustici_software_cloud_v2/models/setting_metadata.rb +294 -0
  141. data/lib/rustici_software_cloud_v2/models/setting_metadata_valid_values.rb +209 -0
  142. data/lib/rustici_software_cloud_v2/models/setting_valid_value.rb +193 -0
  143. data/lib/rustici_software_cloud_v2/models/settings_individual_schema.rb +203 -0
  144. data/lib/rustici_software_cloud_v2/models/settings_post_schema.rb +185 -0
  145. data/lib/rustici_software_cloud_v2/models/shared_data_entry_schema.rb +192 -0
  146. data/lib/rustici_software_cloud_v2/models/static_properties_schema.rb +228 -0
  147. data/lib/rustici_software_cloud_v2/models/string_result_schema.rb +188 -0
  148. data/lib/rustici_software_cloud_v2/models/tag_list_schema.rb +185 -0
  149. data/lib/rustici_software_cloud_v2/models/tag_post_schema.rb +174 -0
  150. data/lib/rustici_software_cloud_v2/models/title_schema.rb +183 -0
  151. data/lib/rustici_software_cloud_v2/models/token_request_schema.rb +203 -0
  152. data/lib/rustici_software_cloud_v2/models/xapi_account.rb +203 -0
  153. data/lib/rustici_software_cloud_v2/models/xapi_activity.rb +209 -0
  154. data/lib/rustici_software_cloud_v2/models/xapi_activity_definition.rb +301 -0
  155. data/lib/rustici_software_cloud_v2/models/xapi_agent_group.rb +279 -0
  156. data/lib/rustici_software_cloud_v2/models/xapi_attachment.rb +267 -0
  157. data/lib/rustici_software_cloud_v2/models/xapi_context.rb +258 -0
  158. data/lib/rustici_software_cloud_v2/models/xapi_context_activity.rb +219 -0
  159. data/lib/rustici_software_cloud_v2/models/xapi_interaction_component.rb +200 -0
  160. data/lib/rustici_software_cloud_v2/models/xapi_result.rb +231 -0
  161. data/lib/rustici_software_cloud_v2/models/xapi_score.rb +211 -0
  162. data/lib/rustici_software_cloud_v2/models/xapi_statement.rb +294 -0
  163. data/lib/rustici_software_cloud_v2/models/xapi_statement_reference.rb +205 -0
  164. data/lib/rustici_software_cloud_v2/models/xapi_statement_result.rb +200 -0
  165. data/lib/rustici_software_cloud_v2/models/xapi_verb.rb +200 -0
  166. data/lib/rustici_software_cloud_v2/version.rb +15 -0
  167. data/rustici_software_cloud_v2.gemspec +45 -0
  168. data/spec/api_client_spec.rb +237 -0
  169. data/spec/configuration_spec.rb +42 -0
  170. data/spec/models/activity_result_schema_spec.rb +133 -0
  171. data/spec/models/application_list_schema_spec.rb +53 -0
  172. data/spec/models/application_schema_spec.rb +59 -0
  173. data/spec/models/application_token_spec.rb +65 -0
  174. data/spec/models/comment_schema_spec.rb +65 -0
  175. data/spec/models/completion_amount_schema_spec.rb +53 -0
  176. data/spec/models/course_activity_schema_spec.rb +99 -0
  177. data/spec/models/course_list_non_paged_schema_spec.rb +53 -0
  178. data/spec/models/course_list_schema_spec.rb +59 -0
  179. data/spec/models/course_reference_schema_spec.rb +65 -0
  180. data/spec/models/course_schema_spec.rb +129 -0
  181. data/spec/models/create_registration_schema_spec.rb +107 -0
  182. data/spec/models/credential_created_schema_spec.rb +77 -0
  183. data/spec/models/credential_list_schema_spec.rb +53 -0
  184. data/spec/models/credential_request_schema_spec.rb +59 -0
  185. data/spec/models/credential_schema_spec.rb +77 -0
  186. data/spec/models/import_fetch_request_schema_spec.rb +53 -0
  187. data/spec/models/import_job_result_schema_spec.rb +75 -0
  188. data/spec/models/import_result_schema_spec.rb +71 -0
  189. data/spec/models/integer_result_schema_spec.rb +53 -0
  190. data/spec/models/item_value_pair_schema_spec.rb +59 -0
  191. data/spec/models/launch_history_list_schema_spec.rb +53 -0
  192. data/spec/models/launch_history_schema_spec.rb +115 -0
  193. data/spec/models/launch_link_request_schema_spec.rb +107 -0
  194. data/spec/models/launch_link_schema_spec.rb +53 -0
  195. data/spec/models/learner_preference_schema_spec.rb +71 -0
  196. data/spec/models/learner_schema_spec.rb +71 -0
  197. data/spec/models/link_schema_spec.rb +53 -0
  198. data/spec/models/message_schema_spec.rb +53 -0
  199. data/spec/models/metadata_schema_spec.rb +89 -0
  200. data/spec/models/objective_schema_spec.rb +137 -0
  201. data/spec/models/permissions_schema_spec.rb +59 -0
  202. data/spec/models/ping_schema_spec.rb +53 -0
  203. data/spec/models/post_back_schema_spec.rb +85 -0
  204. data/spec/models/registration_completion_spec.rb +47 -0
  205. data/spec/models/registration_list_schema_spec.rb +59 -0
  206. data/spec/models/registration_schema_spec.rb +167 -0
  207. data/spec/models/registration_success_spec.rb +47 -0
  208. data/spec/models/response_error_spec.rb +53 -0
  209. data/spec/models/runtime_interaction_schema_spec.rb +117 -0
  210. data/spec/models/runtime_objective_schema_spec.rb +109 -0
  211. data/spec/models/runtime_schema_spec.rb +171 -0
  212. data/spec/models/score_schema_spec.rb +53 -0
  213. data/spec/models/setting_item_spec.rb +81 -0
  214. data/spec/models/setting_list_schema_spec.rb +53 -0
  215. data/spec/models/setting_metadata_spec.rb +99 -0
  216. data/spec/models/setting_metadata_valid_values_spec.rb +59 -0
  217. data/spec/models/settings_individual_schema_spec.rb +65 -0
  218. data/spec/models/settings_post_schema_spec.rb +53 -0
  219. data/spec/models/shared_data_entry_schema_spec.rb +59 -0
  220. data/spec/models/static_properties_schema_spec.rb +83 -0
  221. data/spec/models/string_result_schema_spec.rb +53 -0
  222. data/spec/models/title_schema_spec.rb +53 -0
  223. data/spec/models/token_request_schema_spec.rb +59 -0
  224. data/spec/spec_helper.rb +122 -0
  225. data/swagger-codegen.config +11 -0
  226. metadata +526 -0
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #SCORM Cloud Rest API
3
+
4
+ #REST API used for SCORM Cloud integrations.
5
+
6
+ OpenAPI spec version: 2.0 beta
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module RusticiSoftwareCloudV2
16
+ class PingSchema
17
+ attr_accessor :message
18
+
19
+ # Attribute mapping from ruby-style variable name to JSON key.
20
+ def self.attribute_map
21
+ {
22
+ :'message' => :'message'
23
+ }
24
+ end
25
+
26
+ # Attribute type mapping.
27
+ def self.swagger_types
28
+ {
29
+ :'message' => :'String'
30
+ }
31
+ end
32
+
33
+ # Initializes the object
34
+ # @param [Hash] attributes Model attributes in the form of hash
35
+ def initialize(attributes = {})
36
+ return unless attributes.is_a?(Hash)
37
+
38
+ # convert string to symbol for hash key
39
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
40
+
41
+ if attributes.has_key?(:'message')
42
+ self.message = attributes[:'message']
43
+ end
44
+ end
45
+
46
+ # Show invalid properties with the reasons. Usually used together with valid?
47
+ # @return Array for valid properties with the reasons
48
+ def list_invalid_properties
49
+ invalid_properties = Array.new
50
+ if @message.nil?
51
+ invalid_properties.push('invalid value for "message", message cannot be nil.')
52
+ end
53
+
54
+ invalid_properties
55
+ end
56
+
57
+ # Check to see if the all the properties in the model are valid
58
+ # @return true if the model is valid
59
+ def valid?
60
+ return false if @message.nil?
61
+ true
62
+ end
63
+
64
+ # Checks equality by comparing each attribute.
65
+ # @param [Object] Object to be compared
66
+ def ==(o)
67
+ return true if self.equal?(o)
68
+ self.class == o.class &&
69
+ message == o.message
70
+ end
71
+
72
+ # @see the `==` method
73
+ # @param [Object] Object to be compared
74
+ def eql?(o)
75
+ self == o
76
+ end
77
+
78
+ # Calculates hash code according to all attributes.
79
+ # @return [Fixnum] Hash code
80
+ def hash
81
+ [message].hash
82
+ end
83
+
84
+ # Builds the object from hash
85
+ # @param [Hash] attributes Model attributes in the form of hash
86
+ # @return [Object] Returns the model itself
87
+ def build_from_hash(attributes)
88
+ return nil unless attributes.is_a?(Hash)
89
+ self.class.swagger_types.each_pair do |key, type|
90
+ if type =~ /\AArray<(.*)>/i
91
+ # check to ensure the input is an array given that the the attribute
92
+ # is documented as an array but the input is not
93
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
94
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
95
+ end
96
+ elsif !attributes[self.class.attribute_map[key]].nil?
97
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
98
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
99
+ end
100
+
101
+ self
102
+ end
103
+
104
+ # Deserializes the data based on type
105
+ # @param string type Data type
106
+ # @param string value Value to be deserialized
107
+ # @return [Object] Deserialized data
108
+ def _deserialize(type, value)
109
+ case type.to_sym
110
+ when :DateTime
111
+ DateTime.parse(value)
112
+ when :Date
113
+ Date.parse(value)
114
+ when :String
115
+ value.to_s
116
+ when :Integer
117
+ value.to_i
118
+ when :Float
119
+ value.to_f
120
+ when :BOOLEAN
121
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
122
+ true
123
+ else
124
+ false
125
+ end
126
+ when :Object
127
+ # generic object (usually a Hash), return directly
128
+ value
129
+ when /\AArray<(?<inner_type>.+)>\z/
130
+ inner_type = Regexp.last_match[:inner_type]
131
+ value.map { |v| _deserialize(inner_type, v) }
132
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
133
+ k_type = Regexp.last_match[:k_type]
134
+ v_type = Regexp.last_match[:v_type]
135
+ {}.tap do |hash|
136
+ value.each do |k, v|
137
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
138
+ end
139
+ end
140
+ else # model
141
+ temp_model = RusticiSoftwareCloudV2.const_get(type).new
142
+ temp_model.build_from_hash(value)
143
+ end
144
+ end
145
+
146
+ # Returns the string representation of the object
147
+ # @return [String] String presentation of the object
148
+ def to_s
149
+ to_hash.to_s
150
+ end
151
+
152
+ # to_body is an alias to to_hash (backward compatibility)
153
+ # @return [Hash] Returns the object in the form of hash
154
+ def to_body
155
+ to_hash
156
+ end
157
+
158
+ # Returns the object in the form of hash
159
+ # @return [Hash] Returns the object in the form of hash
160
+ def to_hash
161
+ hash = {}
162
+ self.class.attribute_map.each_pair do |attr, param|
163
+ value = self.send(attr)
164
+ next if value.nil?
165
+ hash[param] = _to_hash(value)
166
+ end
167
+ hash
168
+ end
169
+
170
+ # Outputs non-array value in the form of hash
171
+ # For object, use to_hash. Otherwise, just return the value
172
+ # @param [Object] value Any valid value
173
+ # @return [Hash] Returns the value in the form of hash
174
+ def _to_hash(value)
175
+ if value.is_a?(Array)
176
+ value.compact.map { |v| _to_hash(v) }
177
+ elsif value.is_a?(Hash)
178
+ {}.tap do |hash|
179
+ value.each { |k, v| hash[k] = _to_hash(v) }
180
+ end
181
+ elsif value.respond_to? :to_hash
182
+ value.to_hash
183
+ else
184
+ value
185
+ end
186
+ end
187
+ end
188
+ end
@@ -0,0 +1,273 @@
1
+ =begin
2
+ #SCORM Cloud Rest API
3
+
4
+ #REST API used for SCORM Cloud integrations.
5
+
6
+ OpenAPI spec version: 2.0 beta
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module RusticiSoftwareCloudV2
16
+ class PostBackSchema
17
+ attr_accessor :url
18
+
19
+ # Optional parameter to specify how to authorize against the given postbackurl, can be 'form' or 'httpbasic'. If form authentication, the username and password for authentication are submitted as form fields 'username' and 'password', and the registration data as the form field 'data'. If httpbasic authentication is used, the username and password are placed in the standard Authorization HTTP header, and the registration data is the body of the message (sent as text/xml content type). This field is set to 'form' by default.
20
+ attr_accessor :auth_type
21
+
22
+ # The user name to be used in authorizing the postback of data to the URL specified by postback url.
23
+ attr_accessor :user_name
24
+
25
+ # The password to be used in authorizing the postback of data to the URL specified by postback url.
26
+ attr_accessor :password
27
+
28
+ # This parameter allows you to specify a level of detail in the information that is posted back while the course is being taken. It may be one of three values: 'course' (course summary), 'activity' (activity summary, or 'full' (full detail), and is set to 'course' by default. The information will be posted as xml, and the format of that xml is specified below under the method 'getRegistrationResult'
29
+ attr_accessor :results_format
30
+
31
+ class EnumAttributeValidator
32
+ attr_reader :datatype
33
+ attr_reader :allowable_values
34
+
35
+ def initialize(datatype, allowable_values)
36
+ @allowable_values = allowable_values.map do |value|
37
+ case datatype.to_s
38
+ when /Integer/i
39
+ value.to_i
40
+ when /Float/i
41
+ value.to_f
42
+ else
43
+ value
44
+ end
45
+ end
46
+ end
47
+
48
+ def valid?(value)
49
+ !value || allowable_values.include?(value)
50
+ end
51
+ end
52
+
53
+ # Attribute mapping from ruby-style variable name to JSON key.
54
+ def self.attribute_map
55
+ {
56
+ :'url' => :'url',
57
+ :'auth_type' => :'authType',
58
+ :'user_name' => :'userName',
59
+ :'password' => :'password',
60
+ :'results_format' => :'resultsFormat'
61
+ }
62
+ end
63
+
64
+ # Attribute type mapping.
65
+ def self.swagger_types
66
+ {
67
+ :'url' => :'String',
68
+ :'auth_type' => :'String',
69
+ :'user_name' => :'String',
70
+ :'password' => :'String',
71
+ :'results_format' => :'String'
72
+ }
73
+ end
74
+
75
+ # Initializes the object
76
+ # @param [Hash] attributes Model attributes in the form of hash
77
+ def initialize(attributes = {})
78
+ return unless attributes.is_a?(Hash)
79
+
80
+ # convert string to symbol for hash key
81
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
82
+
83
+ if attributes.has_key?(:'url')
84
+ self.url = attributes[:'url']
85
+ end
86
+
87
+ if attributes.has_key?(:'authType')
88
+ self.auth_type = attributes[:'authType']
89
+ else
90
+ self.auth_type = 'UNDEFINED'
91
+ end
92
+
93
+ if attributes.has_key?(:'userName')
94
+ self.user_name = attributes[:'userName']
95
+ end
96
+
97
+ if attributes.has_key?(:'password')
98
+ self.password = attributes[:'password']
99
+ end
100
+
101
+ if attributes.has_key?(:'resultsFormat')
102
+ self.results_format = attributes[:'resultsFormat']
103
+ else
104
+ self.results_format = 'COURSE'
105
+ end
106
+ end
107
+
108
+ # Show invalid properties with the reasons. Usually used together with valid?
109
+ # @return Array for valid properties with the reasons
110
+ def list_invalid_properties
111
+ invalid_properties = Array.new
112
+ invalid_properties
113
+ end
114
+
115
+ # Check to see if the all the properties in the model are valid
116
+ # @return true if the model is valid
117
+ def valid?
118
+ auth_type_validator = EnumAttributeValidator.new('String', ['UNDEFINED', 'FORM', 'HTTPBASIC'])
119
+ return false unless auth_type_validator.valid?(@auth_type)
120
+ results_format_validator = EnumAttributeValidator.new('String', ['COURSE', 'ACTIVITY', 'FULL'])
121
+ return false unless results_format_validator.valid?(@results_format)
122
+ true
123
+ end
124
+
125
+ # Custom attribute writer method checking allowed values (enum).
126
+ # @param [Object] auth_type Object to be assigned
127
+ def auth_type=(auth_type)
128
+ validator = EnumAttributeValidator.new('String', ['UNDEFINED', 'FORM', 'HTTPBASIC'])
129
+ unless validator.valid?(auth_type)
130
+ fail ArgumentError, 'invalid value for "auth_type", must be one of #{validator.allowable_values}.'
131
+ end
132
+ @auth_type = auth_type
133
+ end
134
+
135
+ # Custom attribute writer method checking allowed values (enum).
136
+ # @param [Object] results_format Object to be assigned
137
+ def results_format=(results_format)
138
+ validator = EnumAttributeValidator.new('String', ['COURSE', 'ACTIVITY', 'FULL'])
139
+ unless validator.valid?(results_format)
140
+ fail ArgumentError, 'invalid value for "results_format", must be one of #{validator.allowable_values}.'
141
+ end
142
+ @results_format = results_format
143
+ end
144
+
145
+ # Checks equality by comparing each attribute.
146
+ # @param [Object] Object to be compared
147
+ def ==(o)
148
+ return true if self.equal?(o)
149
+ self.class == o.class &&
150
+ url == o.url &&
151
+ auth_type == o.auth_type &&
152
+ user_name == o.user_name &&
153
+ password == o.password &&
154
+ results_format == o.results_format
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Fixnum] Hash code
165
+ def hash
166
+ [url, auth_type, user_name, password, results_format].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def build_from_hash(attributes)
173
+ return nil unless attributes.is_a?(Hash)
174
+ self.class.swagger_types.each_pair do |key, type|
175
+ if type =~ /\AArray<(.*)>/i
176
+ # check to ensure the input is an array given that the the attribute
177
+ # is documented as an array but the input is not
178
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
179
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
180
+ end
181
+ elsif !attributes[self.class.attribute_map[key]].nil?
182
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
183
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
184
+ end
185
+
186
+ self
187
+ end
188
+
189
+ # Deserializes the data based on type
190
+ # @param string type Data type
191
+ # @param string value Value to be deserialized
192
+ # @return [Object] Deserialized data
193
+ def _deserialize(type, value)
194
+ case type.to_sym
195
+ when :DateTime
196
+ DateTime.parse(value)
197
+ when :Date
198
+ Date.parse(value)
199
+ when :String
200
+ value.to_s
201
+ when :Integer
202
+ value.to_i
203
+ when :Float
204
+ value.to_f
205
+ when :BOOLEAN
206
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
207
+ true
208
+ else
209
+ false
210
+ end
211
+ when :Object
212
+ # generic object (usually a Hash), return directly
213
+ value
214
+ when /\AArray<(?<inner_type>.+)>\z/
215
+ inner_type = Regexp.last_match[:inner_type]
216
+ value.map { |v| _deserialize(inner_type, v) }
217
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
218
+ k_type = Regexp.last_match[:k_type]
219
+ v_type = Regexp.last_match[:v_type]
220
+ {}.tap do |hash|
221
+ value.each do |k, v|
222
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
223
+ end
224
+ end
225
+ else # model
226
+ temp_model = RusticiSoftwareCloudV2.const_get(type).new
227
+ temp_model.build_from_hash(value)
228
+ end
229
+ end
230
+
231
+ # Returns the string representation of the object
232
+ # @return [String] String presentation of the object
233
+ def to_s
234
+ to_hash.to_s
235
+ end
236
+
237
+ # to_body is an alias to to_hash (backward compatibility)
238
+ # @return [Hash] Returns the object in the form of hash
239
+ def to_body
240
+ to_hash
241
+ end
242
+
243
+ # Returns the object in the form of hash
244
+ # @return [Hash] Returns the object in the form of hash
245
+ def to_hash
246
+ hash = {}
247
+ self.class.attribute_map.each_pair do |attr, param|
248
+ value = self.send(attr)
249
+ next if value.nil?
250
+ hash[param] = _to_hash(value)
251
+ end
252
+ hash
253
+ end
254
+
255
+ # Outputs non-array value in the form of hash
256
+ # For object, use to_hash. Otherwise, just return the value
257
+ # @param [Object] value Any valid value
258
+ # @return [Hash] Returns the value in the form of hash
259
+ def _to_hash(value)
260
+ if value.is_a?(Array)
261
+ value.compact.map { |v| _to_hash(v) }
262
+ elsif value.is_a?(Hash)
263
+ {}.tap do |hash|
264
+ value.each { |k, v| hash[k] = _to_hash(v) }
265
+ end
266
+ elsif value.respond_to? :to_hash
267
+ value.to_hash
268
+ else
269
+ value
270
+ end
271
+ end
272
+ end
273
+ end