dadapush_client 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +9 -0
  3. data/Gemfile.lock +79 -0
  4. data/README.md +105 -0
  5. data/Rakefile +10 -0
  6. data/dadapush_client.gemspec +45 -0
  7. data/docs/Action.md +21 -0
  8. data/docs/DaDaPushMessageApi.md +218 -0
  9. data/docs/MessageObject.md +27 -0
  10. data/docs/MessagePushRequest.md +23 -0
  11. data/docs/MessagePushResponse.md +17 -0
  12. data/docs/PageResponseOfMessageObject.md +21 -0
  13. data/docs/Result.md +21 -0
  14. data/docs/ResultOfMessageObject.md +21 -0
  15. data/docs/ResultOfMessagePushResponse.md +21 -0
  16. data/docs/ResultOfPageResponseOfMessageObject.md +21 -0
  17. data/git_push.sh +55 -0
  18. data/lib/dadapush_client.rb +49 -0
  19. data/lib/dadapush_client/api/da_da_push_message_api.rb +292 -0
  20. data/lib/dadapush_client/api_client.rb +385 -0
  21. data/lib/dadapush_client/api_error.rb +57 -0
  22. data/lib/dadapush_client/configuration.rb +241 -0
  23. data/lib/dadapush_client/models/action.rb +328 -0
  24. data/lib/dadapush_client/models/message_object.rb +269 -0
  25. data/lib/dadapush_client/models/message_push_request.rb +300 -0
  26. data/lib/dadapush_client/models/message_push_response.rb +201 -0
  27. data/lib/dadapush_client/models/page_response_of_message_object.rb +216 -0
  28. data/lib/dadapush_client/models/result.rb +224 -0
  29. data/lib/dadapush_client/models/result_of_message_object.rb +224 -0
  30. data/lib/dadapush_client/models/result_of_message_push_response.rb +224 -0
  31. data/lib/dadapush_client/models/result_of_page_response_of_message_object.rb +224 -0
  32. data/lib/dadapush_client/version.rb +15 -0
  33. data/spec/api/da_da_push_message_api_spec.rb +88 -0
  34. data/spec/api_client_spec.rb +226 -0
  35. data/spec/configuration_spec.rb +42 -0
  36. data/spec/models/action_spec.rb +57 -0
  37. data/spec/models/message_object_spec.rb +71 -0
  38. data/spec/models/message_push_request_spec.rb +59 -0
  39. data/spec/models/message_push_response_spec.rb +41 -0
  40. data/spec/models/page_response_of_message_object_spec.rb +53 -0
  41. data/spec/models/result_of_message_object_spec.rb +53 -0
  42. data/spec/models/result_of_message_push_response_spec.rb +53 -0
  43. data/spec/models/result_of_page_response_of_message_object_spec.rb +53 -0
  44. data/spec/models/result_spec.rb +53 -0
  45. data/spec/spec_helper.rb +111 -0
  46. metadata +282 -0
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #DaDaPush Public API
3
+
4
+ #DaDaPush: Real-time Notifications App Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: contacts@dadapush.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DaDaPushClient
16
+ class ResultOfMessagePushResponse
17
+ attr_accessor :code
18
+
19
+ attr_accessor :data
20
+
21
+ attr_accessor :errmsg
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'code' => :'code',
27
+ :'data' => :'data',
28
+ :'errmsg' => :'errmsg'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'code' => :'Integer',
36
+ :'data' => :'MessagePushResponse',
37
+ :'errmsg' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaDaPushClient::ResultOfMessagePushResponse` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaDaPushClient::ResultOfMessagePushResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'code')
57
+ self.code = attributes[:'code']
58
+ end
59
+
60
+ if attributes.key?(:'data')
61
+ self.data = attributes[:'data']
62
+ end
63
+
64
+ if attributes.key?(:'errmsg')
65
+ self.errmsg = attributes[:'errmsg']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @code.nil?
74
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
75
+ end
76
+
77
+ if @errmsg.nil?
78
+ invalid_properties.push('invalid value for "errmsg", errmsg cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @code.nil?
88
+ return false if @errmsg.nil?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ code == o.code &&
98
+ data == o.data &&
99
+ errmsg == o.errmsg
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [code, data, errmsg].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ DaDaPushClient.const_get(type).build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ next if value.nil?
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map { |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,224 @@
1
+ =begin
2
+ #DaDaPush Public API
3
+
4
+ #DaDaPush: Real-time Notifications App Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: contacts@dadapush.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.2
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module DaDaPushClient
16
+ class ResultOfPageResponseOfMessageObject
17
+ attr_accessor :code
18
+
19
+ attr_accessor :data
20
+
21
+ attr_accessor :errmsg
22
+
23
+ # Attribute mapping from ruby-style variable name to JSON key.
24
+ def self.attribute_map
25
+ {
26
+ :'code' => :'code',
27
+ :'data' => :'data',
28
+ :'errmsg' => :'errmsg'
29
+ }
30
+ end
31
+
32
+ # Attribute type mapping.
33
+ def self.openapi_types
34
+ {
35
+ :'code' => :'Integer',
36
+ :'data' => :'PageResponseOfMessageObject',
37
+ :'errmsg' => :'String'
38
+ }
39
+ end
40
+
41
+ # Initializes the object
42
+ # @param [Hash] attributes Model attributes in the form of hash
43
+ def initialize(attributes = {})
44
+ if (!attributes.is_a?(Hash))
45
+ fail ArgumentError, "The input argument (attributes) must be a hash in `DaDaPushClient::ResultOfPageResponseOfMessageObject` initialize method"
46
+ end
47
+
48
+ # check to see if the attribute exists and convert string to symbol for hash key
49
+ attributes = attributes.each_with_object({}) { |(k, v), h|
50
+ if (!self.class.attribute_map.key?(k.to_sym))
51
+ fail ArgumentError, "`#{k}` is not a valid attribute in `DaDaPushClient::ResultOfPageResponseOfMessageObject`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
52
+ end
53
+ h[k.to_sym] = v
54
+ }
55
+
56
+ if attributes.key?(:'code')
57
+ self.code = attributes[:'code']
58
+ end
59
+
60
+ if attributes.key?(:'data')
61
+ self.data = attributes[:'data']
62
+ end
63
+
64
+ if attributes.key?(:'errmsg')
65
+ self.errmsg = attributes[:'errmsg']
66
+ end
67
+ end
68
+
69
+ # Show invalid properties with the reasons. Usually used together with valid?
70
+ # @return Array for valid properties with the reasons
71
+ def list_invalid_properties
72
+ invalid_properties = Array.new
73
+ if @code.nil?
74
+ invalid_properties.push('invalid value for "code", code cannot be nil.')
75
+ end
76
+
77
+ if @errmsg.nil?
78
+ invalid_properties.push('invalid value for "errmsg", errmsg cannot be nil.')
79
+ end
80
+
81
+ invalid_properties
82
+ end
83
+
84
+ # Check to see if the all the properties in the model are valid
85
+ # @return true if the model is valid
86
+ def valid?
87
+ return false if @code.nil?
88
+ return false if @errmsg.nil?
89
+ true
90
+ end
91
+
92
+ # Checks equality by comparing each attribute.
93
+ # @param [Object] Object to be compared
94
+ def ==(o)
95
+ return true if self.equal?(o)
96
+ self.class == o.class &&
97
+ code == o.code &&
98
+ data == o.data &&
99
+ errmsg == o.errmsg
100
+ end
101
+
102
+ # @see the `==` method
103
+ # @param [Object] Object to be compared
104
+ def eql?(o)
105
+ self == o
106
+ end
107
+
108
+ # Calculates hash code according to all attributes.
109
+ # @return [Integer] Hash code
110
+ def hash
111
+ [code, data, errmsg].hash
112
+ end
113
+
114
+ # Builds the object from hash
115
+ # @param [Hash] attributes Model attributes in the form of hash
116
+ # @return [Object] Returns the model itself
117
+ def self.build_from_hash(attributes)
118
+ new.build_from_hash(attributes)
119
+ end
120
+
121
+ # Builds the object from hash
122
+ # @param [Hash] attributes Model attributes in the form of hash
123
+ # @return [Object] Returns the model itself
124
+ def build_from_hash(attributes)
125
+ return nil unless attributes.is_a?(Hash)
126
+ self.class.openapi_types.each_pair do |key, type|
127
+ if type =~ /\AArray<(.*)>/i
128
+ # check to ensure the input is an array given that the attribute
129
+ # is documented as an array but the input is not
130
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
131
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
132
+ end
133
+ elsif !attributes[self.class.attribute_map[key]].nil?
134
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
135
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
136
+ end
137
+
138
+ self
139
+ end
140
+
141
+ # Deserializes the data based on type
142
+ # @param string type Data type
143
+ # @param string value Value to be deserialized
144
+ # @return [Object] Deserialized data
145
+ def _deserialize(type, value)
146
+ case type.to_sym
147
+ when :DateTime
148
+ DateTime.parse(value)
149
+ when :Date
150
+ Date.parse(value)
151
+ when :String
152
+ value.to_s
153
+ when :Integer
154
+ value.to_i
155
+ when :Float
156
+ value.to_f
157
+ when :Boolean
158
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
159
+ true
160
+ else
161
+ false
162
+ end
163
+ when :Object
164
+ # generic object (usually a Hash), return directly
165
+ value
166
+ when /\AArray<(?<inner_type>.+)>\z/
167
+ inner_type = Regexp.last_match[:inner_type]
168
+ value.map { |v| _deserialize(inner_type, v) }
169
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
170
+ k_type = Regexp.last_match[:k_type]
171
+ v_type = Regexp.last_match[:v_type]
172
+ {}.tap do |hash|
173
+ value.each do |k, v|
174
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
175
+ end
176
+ end
177
+ else # model
178
+ DaDaPushClient.const_get(type).build_from_hash(value)
179
+ end
180
+ end
181
+
182
+ # Returns the string representation of the object
183
+ # @return [String] String presentation of the object
184
+ def to_s
185
+ to_hash.to_s
186
+ end
187
+
188
+ # to_body is an alias to to_hash (backward compatibility)
189
+ # @return [Hash] Returns the object in the form of hash
190
+ def to_body
191
+ to_hash
192
+ end
193
+
194
+ # Returns the object in the form of hash
195
+ # @return [Hash] Returns the object in the form of hash
196
+ def to_hash
197
+ hash = {}
198
+ self.class.attribute_map.each_pair do |attr, param|
199
+ value = self.send(attr)
200
+ next if value.nil?
201
+ hash[param] = _to_hash(value)
202
+ end
203
+ hash
204
+ end
205
+
206
+ # Outputs non-array value in the form of hash
207
+ # For object, use to_hash. Otherwise, just return the value
208
+ # @param [Object] value Any valid value
209
+ # @return [Hash] Returns the value in the form of hash
210
+ def _to_hash(value)
211
+ if value.is_a?(Array)
212
+ value.compact.map { |v| _to_hash(v) }
213
+ elsif value.is_a?(Hash)
214
+ {}.tap do |hash|
215
+ value.each { |k, v| hash[k] = _to_hash(v) }
216
+ end
217
+ elsif value.respond_to? :to_hash
218
+ value.to_hash
219
+ else
220
+ value
221
+ end
222
+ end
223
+ end
224
+ end
@@ -0,0 +1,15 @@
1
+ =begin
2
+ #DaDaPush Public API
3
+
4
+ #DaDaPush: Real-time Notifications App Send real-time notifications through our API without coding and maintaining your own app for iOS or Android devices.
5
+
6
+ The version of the OpenAPI document: v1
7
+ Contact: contacts@dadapush.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 4.0.2
10
+
11
+ =end
12
+
13
+ module DaDaPushClient
14
+ VERSION = '1.0.0'
15
+ end