rainbow-submarine-test-3356 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (113) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +150 -0
  4. data/Rakefile +8 -0
  5. data/docs/AppUser.md +14 -0
  6. data/docs/AppUserApi.md +616 -0
  7. data/docs/AppUserLink.md +9 -0
  8. data/docs/AppUserPreCreate.md +14 -0
  9. data/docs/AppUserResponse.md +8 -0
  10. data/docs/AppUserUpdate.md +12 -0
  11. data/docs/Client.md +12 -0
  12. data/docs/ClientInfo.md +15 -0
  13. data/docs/ClientResponse.md +8 -0
  14. data/docs/Conversation.md +9 -0
  15. data/docs/ConversationApi.md +192 -0
  16. data/docs/DeviceUpdate.md +10 -0
  17. data/docs/Event.md +8 -0
  18. data/docs/GetMessagesResponse.md +10 -0
  19. data/docs/Menu.md +9 -0
  20. data/docs/MenuApi.md +163 -0
  21. data/docs/MenuItem.md +13 -0
  22. data/docs/MenuResponse.md +8 -0
  23. data/docs/Message.md +17 -0
  24. data/docs/MessageResponse.md +9 -0
  25. data/docs/Postback.md +11 -0
  26. data/docs/TrackEventResponse.md +8 -0
  27. data/docs/TypingActivityTrigger.md +11 -0
  28. data/git_push.sh +55 -0
  29. data/lib/rainbow-submarine-test-3356.rb +61 -0
  30. data/lib/rainbow-submarine-test-3356/api/app_user_api.rb +585 -0
  31. data/lib/rainbow-submarine-test-3356/api/conversation_api.rb +189 -0
  32. data/lib/rainbow-submarine-test-3356/api/menu_api.rb +173 -0
  33. data/lib/rainbow-submarine-test-3356/api_client.rb +376 -0
  34. data/lib/rainbow-submarine-test-3356/api_error.rb +37 -0
  35. data/lib/rainbow-submarine-test-3356/configuration.rb +209 -0
  36. data/lib/rainbow-submarine-test-3356/models/app_user.rb +258 -0
  37. data/lib/rainbow-submarine-test-3356/models/app_user_link.rb +201 -0
  38. data/lib/rainbow-submarine-test-3356/models/app_user_pre_create.rb +246 -0
  39. data/lib/rainbow-submarine-test-3356/models/app_user_response.rb +192 -0
  40. data/lib/rainbow-submarine-test-3356/models/app_user_update.rb +223 -0
  41. data/lib/rainbow-submarine-test-3356/models/client.rb +248 -0
  42. data/lib/rainbow-submarine-test-3356/models/client_info.rb +250 -0
  43. data/lib/rainbow-submarine-test-3356/models/client_response.rb +187 -0
  44. data/lib/rainbow-submarine-test-3356/models/conversation.rb +206 -0
  45. data/lib/rainbow-submarine-test-3356/models/device_update.rb +205 -0
  46. data/lib/rainbow-submarine-test-3356/models/event.rb +192 -0
  47. data/lib/rainbow-submarine-test-3356/models/get_messages_response.rb +207 -0
  48. data/lib/rainbow-submarine-test-3356/models/menu.rb +203 -0
  49. data/lib/rainbow-submarine-test-3356/models/menu_item.rb +242 -0
  50. data/lib/rainbow-submarine-test-3356/models/menu_response.rb +192 -0
  51. data/lib/rainbow-submarine-test-3356/models/message.rb +303 -0
  52. data/lib/rainbow-submarine-test-3356/models/message_response.rb +206 -0
  53. data/lib/rainbow-submarine-test-3356/models/postback.rb +229 -0
  54. data/lib/rainbow-submarine-test-3356/models/track_event_response.rb +187 -0
  55. data/lib/rainbow-submarine-test-3356/models/typing_activity_trigger.rb +224 -0
  56. data/lib/rainbow-submarine-test-3356/version.rb +14 -0
  57. data/lib/swagger_client.rb +61 -0
  58. data/lib/swagger_client/api/app_user_api.rb +585 -0
  59. data/lib/swagger_client/api/conversation_api.rb +189 -0
  60. data/lib/swagger_client/api/menu_api.rb +173 -0
  61. data/lib/swagger_client/api_client.rb +376 -0
  62. data/lib/swagger_client/api_error.rb +37 -0
  63. data/lib/swagger_client/configuration.rb +209 -0
  64. data/lib/swagger_client/models/app_user.rb +258 -0
  65. data/lib/swagger_client/models/app_user_link.rb +201 -0
  66. data/lib/swagger_client/models/app_user_pre_create.rb +246 -0
  67. data/lib/swagger_client/models/app_user_response.rb +192 -0
  68. data/lib/swagger_client/models/app_user_update.rb +223 -0
  69. data/lib/swagger_client/models/client.rb +248 -0
  70. data/lib/swagger_client/models/client_info.rb +250 -0
  71. data/lib/swagger_client/models/client_response.rb +187 -0
  72. data/lib/swagger_client/models/conversation.rb +206 -0
  73. data/lib/swagger_client/models/device_update.rb +205 -0
  74. data/lib/swagger_client/models/event.rb +192 -0
  75. data/lib/swagger_client/models/get_messages_response.rb +207 -0
  76. data/lib/swagger_client/models/menu.rb +203 -0
  77. data/lib/swagger_client/models/menu_item.rb +242 -0
  78. data/lib/swagger_client/models/menu_response.rb +192 -0
  79. data/lib/swagger_client/models/message.rb +303 -0
  80. data/lib/swagger_client/models/message_response.rb +206 -0
  81. data/lib/swagger_client/models/postback.rb +229 -0
  82. data/lib/swagger_client/models/track_event_response.rb +187 -0
  83. data/lib/swagger_client/models/typing_activity_trigger.rb +224 -0
  84. data/lib/swagger_client/version.rb +14 -0
  85. data/rainbow-submarine-test-3356.gemspec +44 -0
  86. data/spec/api/app_user_api_spec.rb +162 -0
  87. data/spec/api/conversation_api_spec.rb +73 -0
  88. data/spec/api/menu_api_spec.rb +68 -0
  89. data/spec/api_client_spec.rb +225 -0
  90. data/spec/configuration_spec.rb +41 -0
  91. data/spec/models/app_user_link_spec.rb +47 -0
  92. data/spec/models/app_user_pre_create_spec.rb +77 -0
  93. data/spec/models/app_user_response_spec.rb +41 -0
  94. data/spec/models/app_user_spec.rb +77 -0
  95. data/spec/models/app_user_update_spec.rb +65 -0
  96. data/spec/models/client_info_spec.rb +83 -0
  97. data/spec/models/client_response_spec.rb +41 -0
  98. data/spec/models/client_spec.rb +65 -0
  99. data/spec/models/conversation_spec.rb +47 -0
  100. data/spec/models/device_update_spec.rb +53 -0
  101. data/spec/models/event_spec.rb +41 -0
  102. data/spec/models/get_messages_response_spec.rb +53 -0
  103. data/spec/models/menu_item_spec.rb +71 -0
  104. data/spec/models/menu_response_spec.rb +41 -0
  105. data/spec/models/menu_spec.rb +47 -0
  106. data/spec/models/message_response_spec.rb +47 -0
  107. data/spec/models/message_spec.rb +95 -0
  108. data/spec/models/postback_spec.rb +59 -0
  109. data/spec/models/track_event_response_spec.rb +41 -0
  110. data/spec/models/typing_activity_trigger_spec.rb +59 -0
  111. data/spec/spec_helper.rb +110 -0
  112. data/swagger_client.gemspec +45 -0
  113. metadata +361 -0
@@ -0,0 +1,229 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module RainbowSubmarineTest3356
15
+
16
+ class Postback
17
+ attr_accessor :_id
18
+
19
+ attr_accessor :type
20
+
21
+ attr_accessor :text
22
+
23
+ attr_accessor :payload
24
+
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'_id' => :'_id',
30
+ :'type' => :'type',
31
+ :'text' => :'text',
32
+ :'payload' => :'payload'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'_id' => :'String',
40
+ :'type' => :'String',
41
+ :'text' => :'String',
42
+ :'payload' => :'String'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'_id')
55
+ self._id = attributes[:'_id']
56
+ end
57
+
58
+ if attributes.has_key?(:'type')
59
+ self.type = attributes[:'type']
60
+ end
61
+
62
+ if attributes.has_key?(:'text')
63
+ self.text = attributes[:'text']
64
+ end
65
+
66
+ if attributes.has_key?(:'payload')
67
+ self.payload = attributes[:'payload']
68
+ end
69
+
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properies with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ if @type.nil?
77
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
78
+ end
79
+
80
+ if @text.nil?
81
+ invalid_properties.push("invalid value for 'text', text cannot be nil.")
82
+ end
83
+
84
+ if @payload.nil?
85
+ invalid_properties.push("invalid value for 'payload', payload cannot be nil.")
86
+ end
87
+
88
+ return invalid_properties
89
+ end
90
+
91
+ # Check to see if the all the properties in the model are valid
92
+ # @return true if the model is valid
93
+ def valid?
94
+ return false if @type.nil?
95
+ return false if @text.nil?
96
+ return false if @payload.nil?
97
+ return true
98
+ end
99
+
100
+ # Checks equality by comparing each attribute.
101
+ # @param [Object] Object to be compared
102
+ def ==(o)
103
+ return true if self.equal?(o)
104
+ self.class == o.class &&
105
+ _id == o._id &&
106
+ type == o.type &&
107
+ text == o.text &&
108
+ payload == o.payload
109
+ end
110
+
111
+ # @see the `==` method
112
+ # @param [Object] Object to be compared
113
+ def eql?(o)
114
+ self == o
115
+ end
116
+
117
+ # Calculates hash code according to all attributes.
118
+ # @return [Fixnum] Hash code
119
+ def hash
120
+ [_id, type, text, payload].hash
121
+ end
122
+
123
+ # Builds the object from hash
124
+ # @param [Hash] attributes Model attributes in the form of hash
125
+ # @return [Object] Returns the model itself
126
+ def build_from_hash(attributes)
127
+ return nil unless attributes.is_a?(Hash)
128
+ self.class.swagger_types.each_pair do |key, type|
129
+ if type =~ /\AArray<(.*)>/i
130
+ # check to ensure the input is an array given that the the attribute
131
+ # is documented as an array but the input is not
132
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
133
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
134
+ end
135
+ elsif !attributes[self.class.attribute_map[key]].nil?
136
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
137
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
138
+ end
139
+
140
+ self
141
+ end
142
+
143
+ # Deserializes the data based on type
144
+ # @param string type Data type
145
+ # @param string value Value to be deserialized
146
+ # @return [Object] Deserialized data
147
+ def _deserialize(type, value)
148
+ case type.to_sym
149
+ when :DateTime
150
+ DateTime.parse(value)
151
+ when :Date
152
+ Date.parse(value)
153
+ when :String
154
+ value.to_s
155
+ when :Integer
156
+ value.to_i
157
+ when :Float
158
+ value.to_f
159
+ when :BOOLEAN
160
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
161
+ true
162
+ else
163
+ false
164
+ end
165
+ when :Object
166
+ # generic object (usually a Hash), return directly
167
+ value
168
+ when /\AArray<(?<inner_type>.+)>\z/
169
+ inner_type = Regexp.last_match[:inner_type]
170
+ value.map { |v| _deserialize(inner_type, v) }
171
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
172
+ k_type = Regexp.last_match[:k_type]
173
+ v_type = Regexp.last_match[:v_type]
174
+ {}.tap do |hash|
175
+ value.each do |k, v|
176
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
177
+ end
178
+ end
179
+ else # model
180
+ temp_model = RainbowSubmarineTest3356.const_get(type).new
181
+ temp_model.build_from_hash(value)
182
+ end
183
+ end
184
+
185
+ # Returns the string representation of the object
186
+ # @return [String] String presentation of the object
187
+ def to_s
188
+ to_hash.to_s
189
+ end
190
+
191
+ # to_body is an alias to to_hash (backward compatibility)
192
+ # @return [Hash] Returns the object in the form of hash
193
+ def to_body
194
+ to_hash
195
+ end
196
+
197
+ # Returns the object in the form of hash
198
+ # @return [Hash] Returns the object in the form of hash
199
+ def to_hash
200
+ hash = {}
201
+ self.class.attribute_map.each_pair do |attr, param|
202
+ value = self.send(attr)
203
+ next if value.nil?
204
+ hash[param] = _to_hash(value)
205
+ end
206
+ hash
207
+ end
208
+
209
+ # Outputs non-array value in the form of hash
210
+ # For object, use to_hash. Otherwise, just return the value
211
+ # @param [Object] value Any valid value
212
+ # @return [Hash] Returns the value in the form of hash
213
+ def _to_hash(value)
214
+ if value.is_a?(Array)
215
+ value.compact.map{ |v| _to_hash(v) }
216
+ elsif value.is_a?(Hash)
217
+ {}.tap do |hash|
218
+ value.each { |k, v| hash[k] = _to_hash(v) }
219
+ end
220
+ elsif value.respond_to? :to_hash
221
+ value.to_hash
222
+ else
223
+ value
224
+ end
225
+ end
226
+
227
+ end
228
+
229
+ end
@@ -0,0 +1,187 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module RainbowSubmarineTest3356
15
+
16
+ class TrackEventResponse
17
+ attr_accessor :conversation_updated
18
+
19
+
20
+ # Attribute mapping from ruby-style variable name to JSON key.
21
+ def self.attribute_map
22
+ {
23
+ :'conversation_updated' => :'conversationUpdated'
24
+ }
25
+ end
26
+
27
+ # Attribute type mapping.
28
+ def self.swagger_types
29
+ {
30
+ :'conversation_updated' => :'BOOLEAN'
31
+ }
32
+ end
33
+
34
+ # Initializes the object
35
+ # @param [Hash] attributes Model attributes in the form of hash
36
+ def initialize(attributes = {})
37
+ return unless attributes.is_a?(Hash)
38
+
39
+ # convert string to symbol for hash key
40
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
41
+
42
+ if attributes.has_key?(:'conversationUpdated')
43
+ self.conversation_updated = attributes[:'conversationUpdated']
44
+ end
45
+
46
+ end
47
+
48
+ # Show invalid properties with the reasons. Usually used together with valid?
49
+ # @return Array for valid properies with the reasons
50
+ def list_invalid_properties
51
+ invalid_properties = Array.new
52
+ return invalid_properties
53
+ end
54
+
55
+ # Check to see if the all the properties in the model are valid
56
+ # @return true if the model is valid
57
+ def valid?
58
+ return true
59
+ end
60
+
61
+ # Checks equality by comparing each attribute.
62
+ # @param [Object] Object to be compared
63
+ def ==(o)
64
+ return true if self.equal?(o)
65
+ self.class == o.class &&
66
+ conversation_updated == o.conversation_updated
67
+ end
68
+
69
+ # @see the `==` method
70
+ # @param [Object] Object to be compared
71
+ def eql?(o)
72
+ self == o
73
+ end
74
+
75
+ # Calculates hash code according to all attributes.
76
+ # @return [Fixnum] Hash code
77
+ def hash
78
+ [conversation_updated].hash
79
+ end
80
+
81
+ # Builds the object from hash
82
+ # @param [Hash] attributes Model attributes in the form of hash
83
+ # @return [Object] Returns the model itself
84
+ def build_from_hash(attributes)
85
+ return nil unless attributes.is_a?(Hash)
86
+ self.class.swagger_types.each_pair do |key, type|
87
+ if type =~ /\AArray<(.*)>/i
88
+ # check to ensure the input is an array given that the the attribute
89
+ # is documented as an array but the input is not
90
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
91
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
92
+ end
93
+ elsif !attributes[self.class.attribute_map[key]].nil?
94
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
95
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
96
+ end
97
+
98
+ self
99
+ end
100
+
101
+ # Deserializes the data based on type
102
+ # @param string type Data type
103
+ # @param string value Value to be deserialized
104
+ # @return [Object] Deserialized data
105
+ def _deserialize(type, value)
106
+ case type.to_sym
107
+ when :DateTime
108
+ DateTime.parse(value)
109
+ when :Date
110
+ Date.parse(value)
111
+ when :String
112
+ value.to_s
113
+ when :Integer
114
+ value.to_i
115
+ when :Float
116
+ value.to_f
117
+ when :BOOLEAN
118
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
119
+ true
120
+ else
121
+ false
122
+ end
123
+ when :Object
124
+ # generic object (usually a Hash), return directly
125
+ value
126
+ when /\AArray<(?<inner_type>.+)>\z/
127
+ inner_type = Regexp.last_match[:inner_type]
128
+ value.map { |v| _deserialize(inner_type, v) }
129
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
130
+ k_type = Regexp.last_match[:k_type]
131
+ v_type = Regexp.last_match[:v_type]
132
+ {}.tap do |hash|
133
+ value.each do |k, v|
134
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
135
+ end
136
+ end
137
+ else # model
138
+ temp_model = RainbowSubmarineTest3356.const_get(type).new
139
+ temp_model.build_from_hash(value)
140
+ end
141
+ end
142
+
143
+ # Returns the string representation of the object
144
+ # @return [String] String presentation of the object
145
+ def to_s
146
+ to_hash.to_s
147
+ end
148
+
149
+ # to_body is an alias to to_hash (backward compatibility)
150
+ # @return [Hash] Returns the object in the form of hash
151
+ def to_body
152
+ to_hash
153
+ end
154
+
155
+ # Returns the object in the form of hash
156
+ # @return [Hash] Returns the object in the form of hash
157
+ def to_hash
158
+ hash = {}
159
+ self.class.attribute_map.each_pair do |attr, param|
160
+ value = self.send(attr)
161
+ next if value.nil?
162
+ hash[param] = _to_hash(value)
163
+ end
164
+ hash
165
+ end
166
+
167
+ # Outputs non-array value in the form of hash
168
+ # For object, use to_hash. Otherwise, just return the value
169
+ # @param [Object] value Any valid value
170
+ # @return [Hash] Returns the value in the form of hash
171
+ def _to_hash(value)
172
+ if value.is_a?(Array)
173
+ value.compact.map{ |v| _to_hash(v) }
174
+ elsif value.is_a?(Hash)
175
+ {}.tap do |hash|
176
+ value.each { |k, v| hash[k] = _to_hash(v) }
177
+ end
178
+ elsif value.respond_to? :to_hash
179
+ value.to_hash
180
+ else
181
+ value
182
+ end
183
+ end
184
+
185
+ end
186
+
187
+ end
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #Smooch
3
+
4
+ #No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+
10
+ =end
11
+
12
+ require 'date'
13
+
14
+ module RainbowSubmarineTest3356
15
+
16
+ class TypingActivityTrigger
17
+ attr_accessor :role
18
+
19
+ attr_accessor :type
20
+
21
+ attr_accessor :name
22
+
23
+ attr_accessor :avatar_url
24
+
25
+
26
+ # Attribute mapping from ruby-style variable name to JSON key.
27
+ def self.attribute_map
28
+ {
29
+ :'role' => :'role',
30
+ :'type' => :'type',
31
+ :'name' => :'name',
32
+ :'avatar_url' => :'avatarUrl'
33
+ }
34
+ end
35
+
36
+ # Attribute type mapping.
37
+ def self.swagger_types
38
+ {
39
+ :'role' => :'String',
40
+ :'type' => :'String',
41
+ :'name' => :'String',
42
+ :'avatar_url' => :'String'
43
+ }
44
+ end
45
+
46
+ # Initializes the object
47
+ # @param [Hash] attributes Model attributes in the form of hash
48
+ def initialize(attributes = {})
49
+ return unless attributes.is_a?(Hash)
50
+
51
+ # convert string to symbol for hash key
52
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
53
+
54
+ if attributes.has_key?(:'role')
55
+ self.role = attributes[:'role']
56
+ end
57
+
58
+ if attributes.has_key?(:'type')
59
+ self.type = attributes[:'type']
60
+ end
61
+
62
+ if attributes.has_key?(:'name')
63
+ self.name = attributes[:'name']
64
+ end
65
+
66
+ if attributes.has_key?(:'avatarUrl')
67
+ self.avatar_url = attributes[:'avatarUrl']
68
+ end
69
+
70
+ end
71
+
72
+ # Show invalid properties with the reasons. Usually used together with valid?
73
+ # @return Array for valid properies with the reasons
74
+ def list_invalid_properties
75
+ invalid_properties = Array.new
76
+ if @role.nil?
77
+ invalid_properties.push("invalid value for 'role', role cannot be nil.")
78
+ end
79
+
80
+ if @type.nil?
81
+ invalid_properties.push("invalid value for 'type', type cannot be nil.")
82
+ end
83
+
84
+ return invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @role.nil?
91
+ return false if @type.nil?
92
+ return true
93
+ end
94
+
95
+ # Checks equality by comparing each attribute.
96
+ # @param [Object] Object to be compared
97
+ def ==(o)
98
+ return true if self.equal?(o)
99
+ self.class == o.class &&
100
+ role == o.role &&
101
+ type == o.type &&
102
+ name == o.name &&
103
+ avatar_url == o.avatar_url
104
+ end
105
+
106
+ # @see the `==` method
107
+ # @param [Object] Object to be compared
108
+ def eql?(o)
109
+ self == o
110
+ end
111
+
112
+ # Calculates hash code according to all attributes.
113
+ # @return [Fixnum] Hash code
114
+ def hash
115
+ [role, type, name, avatar_url].hash
116
+ end
117
+
118
+ # Builds the object from hash
119
+ # @param [Hash] attributes Model attributes in the form of hash
120
+ # @return [Object] Returns the model itself
121
+ def build_from_hash(attributes)
122
+ return nil unless attributes.is_a?(Hash)
123
+ self.class.swagger_types.each_pair do |key, type|
124
+ if type =~ /\AArray<(.*)>/i
125
+ # check to ensure the input is an array given that the the attribute
126
+ # is documented as an array but the input is not
127
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
128
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
129
+ end
130
+ elsif !attributes[self.class.attribute_map[key]].nil?
131
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
132
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
133
+ end
134
+
135
+ self
136
+ end
137
+
138
+ # Deserializes the data based on type
139
+ # @param string type Data type
140
+ # @param string value Value to be deserialized
141
+ # @return [Object] Deserialized data
142
+ def _deserialize(type, value)
143
+ case type.to_sym
144
+ when :DateTime
145
+ DateTime.parse(value)
146
+ when :Date
147
+ Date.parse(value)
148
+ when :String
149
+ value.to_s
150
+ when :Integer
151
+ value.to_i
152
+ when :Float
153
+ value.to_f
154
+ when :BOOLEAN
155
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
156
+ true
157
+ else
158
+ false
159
+ end
160
+ when :Object
161
+ # generic object (usually a Hash), return directly
162
+ value
163
+ when /\AArray<(?<inner_type>.+)>\z/
164
+ inner_type = Regexp.last_match[:inner_type]
165
+ value.map { |v| _deserialize(inner_type, v) }
166
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
167
+ k_type = Regexp.last_match[:k_type]
168
+ v_type = Regexp.last_match[:v_type]
169
+ {}.tap do |hash|
170
+ value.each do |k, v|
171
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
172
+ end
173
+ end
174
+ else # model
175
+ temp_model = RainbowSubmarineTest3356.const_get(type).new
176
+ temp_model.build_from_hash(value)
177
+ end
178
+ end
179
+
180
+ # Returns the string representation of the object
181
+ # @return [String] String presentation of the object
182
+ def to_s
183
+ to_hash.to_s
184
+ end
185
+
186
+ # to_body is an alias to to_hash (backward compatibility)
187
+ # @return [Hash] Returns the object in the form of hash
188
+ def to_body
189
+ to_hash
190
+ end
191
+
192
+ # Returns the object in the form of hash
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_hash
195
+ hash = {}
196
+ self.class.attribute_map.each_pair do |attr, param|
197
+ value = self.send(attr)
198
+ next if value.nil?
199
+ hash[param] = _to_hash(value)
200
+ end
201
+ hash
202
+ end
203
+
204
+ # Outputs non-array value in the form of hash
205
+ # For object, use to_hash. Otherwise, just return the value
206
+ # @param [Object] value Any valid value
207
+ # @return [Hash] Returns the value in the form of hash
208
+ def _to_hash(value)
209
+ if value.is_a?(Array)
210
+ value.compact.map{ |v| _to_hash(v) }
211
+ elsif value.is_a?(Hash)
212
+ {}.tap do |hash|
213
+ value.each { |k, v| hash[k] = _to_hash(v) }
214
+ end
215
+ elsif value.respond_to? :to_hash
216
+ value.to_hash
217
+ else
218
+ value
219
+ end
220
+ end
221
+
222
+ end
223
+
224
+ end