supportify_client 1.0.2 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,24 +1,30 @@
1
+ require 'date'
2
+
1
3
  module Supportify
2
- #
3
- class Error < BaseObject
4
- attr_accessor :code, :short_description, :long_description
5
- # attribute mapping from ruby-style variable name to JSON key
4
+ class Error
5
+ # An HTTP error code.
6
+ attr_accessor :code
7
+
8
+ # A short keyword describing the error that occurred.
9
+ attr_accessor :short_description
10
+
11
+ # A more detailed description of the cause of the error.
12
+ attr_accessor :long_description
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
6
15
  def self.attribute_map
7
16
  {
8
17
 
9
- # An HTTP error code.
10
18
  :'code' => :'code',
11
19
 
12
- # A short keyword describing the error that occurred.
13
20
  :'short_description' => :'short_description',
14
21
 
15
- # A more detailed description of the cause of the error.
16
22
  :'long_description' => :'long_description'
17
23
 
18
24
  }
19
25
  end
20
26
 
21
- # attribute type
27
+ # Attribute type mapping.
22
28
  def self.swagger_types
23
29
  {
24
30
  :'code' => :'Integer',
@@ -29,7 +35,7 @@ module Supportify
29
35
  end
30
36
 
31
37
  def initialize(attributes = {})
32
- return if !attributes.is_a?(Hash) || attributes.empty?
38
+ return unless attributes.is_a?(Hash)
33
39
 
34
40
  # convert string to symbol for hash key
35
41
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
@@ -49,5 +55,115 @@ module Supportify
49
55
 
50
56
  end
51
57
 
58
+ # Check equality by comparing each attribute.
59
+ def ==(o)
60
+ return true if self.equal?(o)
61
+ self.class == o.class &&
62
+ code == o.code &&
63
+ short_description == o.short_description &&
64
+ long_description == o.long_description
65
+ end
66
+
67
+ # @see the `==` method
68
+ def eql?(o)
69
+ self == o
70
+ end
71
+
72
+ # Calculate hash code according to all attributes.
73
+ def hash
74
+ [code, short_description, long_description].hash
75
+ end
76
+
77
+ # build the object from hash
78
+ def build_from_hash(attributes)
79
+ return nil unless attributes.is_a?(Hash)
80
+ self.class.swagger_types.each_pair do |key, type|
81
+ if type =~ /^Array<(.*)>/i
82
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
83
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
84
+ else
85
+ #TODO show warning in debug mode
86
+ end
87
+ elsif !attributes[self.class.attribute_map[key]].nil?
88
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
89
+ else
90
+ # data not found in attributes(hash), not an issue as the data can be optional
91
+ end
92
+ end
93
+
94
+ self
95
+ end
96
+
97
+ def _deserialize(type, value)
98
+ case type.to_sym
99
+ when :DateTime
100
+ DateTime.parse(value)
101
+ when :Date
102
+ Date.parse(value)
103
+ when :String
104
+ value.to_s
105
+ when :Integer
106
+ value.to_i
107
+ when :Float
108
+ value.to_f
109
+ when :BOOLEAN
110
+ if value =~ /^(true|t|yes|y|1)$/i
111
+ true
112
+ else
113
+ false
114
+ end
115
+ when /\AArray<(?<inner_type>.+)>\z/
116
+ inner_type = Regexp.last_match[:inner_type]
117
+ value.map { |v| _deserialize(inner_type, v) }
118
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
119
+ k_type = Regexp.last_match[:k_type]
120
+ v_type = Regexp.last_match[:v_type]
121
+ {}.tap do |hash|
122
+ value.each do |k, v|
123
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
124
+ end
125
+ end
126
+ else # model
127
+ _model = Supportify.const_get(type).new
128
+ _model.build_from_hash(value)
129
+ end
130
+ end
131
+
132
+ def to_s
133
+ to_hash.to_s
134
+ end
135
+
136
+ # to_body is an alias to to_body (backward compatibility))
137
+ def to_body
138
+ to_hash
139
+ end
140
+
141
+ # return the object in the form of hash
142
+ def to_hash
143
+ hash = {}
144
+ self.class.attribute_map.each_pair do |attr, param|
145
+ value = self.send(attr)
146
+ next if value.nil?
147
+ hash[param] = _to_hash(value)
148
+ end
149
+ hash
150
+ end
151
+
152
+ # Method to output non-array value in the form of hash
153
+ # For object, use to_hash. Otherwise, just return the value
154
+ def _to_hash(value)
155
+ if value.is_a?(Array)
156
+ value.compact.map{ |v| _to_hash(v) }
157
+ elsif value.is_a?(Hash)
158
+ {}.tap do |hash|
159
+ value.each { |k, v| hash[k] = _to_hash(v) }
160
+ end
161
+ elsif value.respond_to? :to_hash
162
+ value.to_hash
163
+ else
164
+ value
165
+ end
166
+ end
167
+
52
168
  end
53
169
  end
@@ -1,63 +1,91 @@
1
+ require 'date'
2
+
1
3
  module Supportify
2
- #
3
- class Faq < BaseObject
4
- attr_accessor :id, :answer, :categories, :controversy_score, :date_created, :date_last_modified, :direct_views, :question, :rating, :raw_score, :search_views, :tags, :total_views, :votes, :was_created_by, :was_last_modified_by
5
- # attribute mapping from ruby-style variable name to JSON key
4
+ class Faq
5
+ # Unique identifier representing a specific content entry within an application.
6
+ attr_accessor :id
7
+
8
+ # The body of the content entry. Can be an answer to a FAQ, a knowledge base entry, or any other type of string. This is a non-encoded string and may contain HTML.
9
+ attr_accessor :answer
10
+
11
+ attr_accessor :categories
12
+
13
+ # A score that measures the disparity between positive and negative votes for the content entry.
14
+ attr_accessor :controversy_score
15
+
16
+ # The date and time that the content entry was created.
17
+ attr_accessor :date_created
18
+
19
+ # The date and time that the content entry was last modified.
20
+ attr_accessor :date_last_modified
21
+
22
+ # The total number of views that the content entry has received individually (i.e., access via the '/faqs/<id>' path.
23
+ attr_accessor :direct_views
24
+
25
+ # The title of the content entry. Can be a question, a title, or any other type of string. This is a non-encoded string and may contain HTML.
26
+ attr_accessor :question
27
+
28
+ # The score for the content entry within the application. This is weighted score tabulated based on a total of up and down votes and compared against other votes for content entries in the application.
29
+ attr_accessor :rating
30
+
31
+ # The total number of positive votes minus the number of negative votes for the content entry.
32
+ attr_accessor :raw_score
33
+
34
+ # The total number of views that the content entry has received as part of a set of search results (i.e., access via the '/search' path.
35
+ attr_accessor :search_views
36
+
37
+ attr_accessor :tags
38
+
39
+ # The total number of views that the content entry has received as part of a whole collection, individually, or as part of a set of search results.
40
+ attr_accessor :total_views
41
+
42
+ # The total number of votes that the content entry has received since it was created.
43
+ attr_accessor :votes
44
+
45
+ attr_accessor :was_created_by
46
+
47
+ attr_accessor :was_last_modified_by
48
+
49
+ # Attribute mapping from ruby-style variable name to JSON key.
6
50
  def self.attribute_map
7
51
  {
8
52
 
9
- # Unique identifier representing a specific content entry within an application.
10
53
  :'id' => :'id',
11
54
 
12
- # The body of the content entry. Can be an answer to a FAQ, a knowledge base entry, or any other type of string. This is a non-encoded string and may contain HTML.
13
55
  :'answer' => :'answer',
14
56
 
15
- #
16
57
  :'categories' => :'categories',
17
58
 
18
- # A score that measures the disparity between positive and negative votes for the content entry.
19
59
  :'controversy_score' => :'controversy_score',
20
60
 
21
- # The date and time that the content entry was created.
22
61
  :'date_created' => :'date_created',
23
62
 
24
- # The date and time that the content entry was last modified.
25
63
  :'date_last_modified' => :'date_last_modified',
26
64
 
27
- # The total number of views that the content entry has received individually (i.e., access via the &#39;/faqs/&lt;id&gt;&#39; path.
28
65
  :'direct_views' => :'direct_views',
29
66
 
30
- # The title of the content entry. Can be a question, a title, or any other type of string. This is a non-encoded string and may contain HTML.
31
67
  :'question' => :'question',
32
68
 
33
- # The score for the content entry within the application. This is weighted score tabulated based on a total of up and down votes and compared against other votes for content entries in the application.
34
69
  :'rating' => :'rating',
35
70
 
36
- # The total number of positive votes minus the number of negative votes for the content entry.
37
71
  :'raw_score' => :'raw_score',
38
72
 
39
- # The total number of views that the content entry has received as part of a set of search results (i.e., access via the &#39;/search&#39; path.
40
73
  :'search_views' => :'search_views',
41
74
 
42
- #
43
75
  :'tags' => :'tags',
44
76
 
45
- # The total number of views that the content entry has received as part of a whole collection, individually, or as part of a set of search results.
46
77
  :'total_views' => :'total_views',
47
78
 
48
- # The total number of votes that the content entry has received since it was created.
49
79
  :'votes' => :'votes',
50
80
 
51
- #
52
81
  :'was_created_by' => :'was_created_by',
53
82
 
54
- #
55
83
  :'was_last_modified_by' => :'was_last_modified_by'
56
84
 
57
85
  }
58
86
  end
59
87
 
60
- # attribute type
88
+ # Attribute type mapping.
61
89
  def self.swagger_types
62
90
  {
63
91
  :'id' => :'Integer',
@@ -81,7 +109,7 @@ module Supportify
81
109
  end
82
110
 
83
111
  def initialize(attributes = {})
84
- return if !attributes.is_a?(Hash) || attributes.empty?
112
+ return unless attributes.is_a?(Hash)
85
113
 
86
114
  # convert string to symbol for hash key
87
115
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
@@ -157,5 +185,128 @@ module Supportify
157
185
 
158
186
  end
159
187
 
188
+ # Check equality by comparing each attribute.
189
+ def ==(o)
190
+ return true if self.equal?(o)
191
+ self.class == o.class &&
192
+ id == o.id &&
193
+ answer == o.answer &&
194
+ categories == o.categories &&
195
+ controversy_score == o.controversy_score &&
196
+ date_created == o.date_created &&
197
+ date_last_modified == o.date_last_modified &&
198
+ direct_views == o.direct_views &&
199
+ question == o.question &&
200
+ rating == o.rating &&
201
+ raw_score == o.raw_score &&
202
+ search_views == o.search_views &&
203
+ tags == o.tags &&
204
+ total_views == o.total_views &&
205
+ votes == o.votes &&
206
+ was_created_by == o.was_created_by &&
207
+ was_last_modified_by == o.was_last_modified_by
208
+ end
209
+
210
+ # @see the `==` method
211
+ def eql?(o)
212
+ self == o
213
+ end
214
+
215
+ # Calculate hash code according to all attributes.
216
+ def hash
217
+ [id, answer, categories, controversy_score, date_created, date_last_modified, direct_views, question, rating, raw_score, search_views, tags, total_views, votes, was_created_by, was_last_modified_by].hash
218
+ end
219
+
220
+ # build the object from hash
221
+ def build_from_hash(attributes)
222
+ return nil unless attributes.is_a?(Hash)
223
+ self.class.swagger_types.each_pair do |key, type|
224
+ if type =~ /^Array<(.*)>/i
225
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
226
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
227
+ else
228
+ #TODO show warning in debug mode
229
+ end
230
+ elsif !attributes[self.class.attribute_map[key]].nil?
231
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
232
+ else
233
+ # data not found in attributes(hash), not an issue as the data can be optional
234
+ end
235
+ end
236
+
237
+ self
238
+ end
239
+
240
+ def _deserialize(type, value)
241
+ case type.to_sym
242
+ when :DateTime
243
+ DateTime.parse(value)
244
+ when :Date
245
+ Date.parse(value)
246
+ when :String
247
+ value.to_s
248
+ when :Integer
249
+ value.to_i
250
+ when :Float
251
+ value.to_f
252
+ when :BOOLEAN
253
+ if value =~ /^(true|t|yes|y|1)$/i
254
+ true
255
+ else
256
+ false
257
+ end
258
+ when /\AArray<(?<inner_type>.+)>\z/
259
+ inner_type = Regexp.last_match[:inner_type]
260
+ value.map { |v| _deserialize(inner_type, v) }
261
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
262
+ k_type = Regexp.last_match[:k_type]
263
+ v_type = Regexp.last_match[:v_type]
264
+ {}.tap do |hash|
265
+ value.each do |k, v|
266
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
267
+ end
268
+ end
269
+ else # model
270
+ _model = Supportify.const_get(type).new
271
+ _model.build_from_hash(value)
272
+ end
273
+ end
274
+
275
+ def to_s
276
+ to_hash.to_s
277
+ end
278
+
279
+ # to_body is an alias to to_body (backward compatibility))
280
+ def to_body
281
+ to_hash
282
+ end
283
+
284
+ # return the object in the form of hash
285
+ def to_hash
286
+ hash = {}
287
+ self.class.attribute_map.each_pair do |attr, param|
288
+ value = self.send(attr)
289
+ next if value.nil?
290
+ hash[param] = _to_hash(value)
291
+ end
292
+ hash
293
+ end
294
+
295
+ # Method to output non-array value in the form of hash
296
+ # For object, use to_hash. Otherwise, just return the value
297
+ def _to_hash(value)
298
+ if value.is_a?(Array)
299
+ value.compact.map{ |v| _to_hash(v) }
300
+ elsif value.is_a?(Hash)
301
+ {}.tap do |hash|
302
+ value.each { |k, v| hash[k] = _to_hash(v) }
303
+ end
304
+ elsif value.respond_to? :to_hash
305
+ value.to_hash
306
+ else
307
+ value
308
+ end
309
+ end
310
+
160
311
  end
161
312
  end
@@ -1,31 +1,33 @@
1
+ require 'date'
2
+
1
3
  module Supportify
2
- #
3
- class Info < BaseObject
4
- attr_accessor :application, :supportify
5
- # attribute mapping from ruby-style variable name to JSON key
4
+ class Info
5
+ attr_accessor :application
6
+
7
+ attr_accessor :supportify
8
+
9
+ # Attribute mapping from ruby-style variable name to JSON key.
6
10
  def self.attribute_map
7
11
  {
8
12
 
9
- #
10
13
  :'application' => :'application',
11
14
 
12
- #
13
15
  :'supportify' => :'supportify'
14
16
 
15
17
  }
16
18
  end
17
19
 
18
- # attribute type
20
+ # Attribute type mapping.
19
21
  def self.swagger_types
20
22
  {
21
- :'application' => :'Object',
22
- :'supportify' => :'Object'
23
+ :'application' => :'Info_application',
24
+ :'supportify' => :'Info_supportify'
23
25
 
24
26
  }
25
27
  end
26
28
 
27
29
  def initialize(attributes = {})
28
- return if !attributes.is_a?(Hash) || attributes.empty?
30
+ return unless attributes.is_a?(Hash)
29
31
 
30
32
  # convert string to symbol for hash key
31
33
  attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
@@ -41,5 +43,114 @@ module Supportify
41
43
 
42
44
  end
43
45
 
46
+ # Check equality by comparing each attribute.
47
+ def ==(o)
48
+ return true if self.equal?(o)
49
+ self.class == o.class &&
50
+ application == o.application &&
51
+ supportify == o.supportify
52
+ end
53
+
54
+ # @see the `==` method
55
+ def eql?(o)
56
+ self == o
57
+ end
58
+
59
+ # Calculate hash code according to all attributes.
60
+ def hash
61
+ [application, supportify].hash
62
+ end
63
+
64
+ # build the object from hash
65
+ def build_from_hash(attributes)
66
+ return nil unless attributes.is_a?(Hash)
67
+ self.class.swagger_types.each_pair do |key, type|
68
+ if type =~ /^Array<(.*)>/i
69
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
70
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
71
+ else
72
+ #TODO show warning in debug mode
73
+ end
74
+ elsif !attributes[self.class.attribute_map[key]].nil?
75
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
76
+ else
77
+ # data not found in attributes(hash), not an issue as the data can be optional
78
+ end
79
+ end
80
+
81
+ self
82
+ end
83
+
84
+ def _deserialize(type, value)
85
+ case type.to_sym
86
+ when :DateTime
87
+ DateTime.parse(value)
88
+ when :Date
89
+ Date.parse(value)
90
+ when :String
91
+ value.to_s
92
+ when :Integer
93
+ value.to_i
94
+ when :Float
95
+ value.to_f
96
+ when :BOOLEAN
97
+ if value =~ /^(true|t|yes|y|1)$/i
98
+ true
99
+ else
100
+ false
101
+ end
102
+ when /\AArray<(?<inner_type>.+)>\z/
103
+ inner_type = Regexp.last_match[:inner_type]
104
+ value.map { |v| _deserialize(inner_type, v) }
105
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
106
+ k_type = Regexp.last_match[:k_type]
107
+ v_type = Regexp.last_match[:v_type]
108
+ {}.tap do |hash|
109
+ value.each do |k, v|
110
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
111
+ end
112
+ end
113
+ else # model
114
+ _model = Supportify.const_get(type).new
115
+ _model.build_from_hash(value)
116
+ end
117
+ end
118
+
119
+ def to_s
120
+ to_hash.to_s
121
+ end
122
+
123
+ # to_body is an alias to to_body (backward compatibility))
124
+ def to_body
125
+ to_hash
126
+ end
127
+
128
+ # return the object in the form of hash
129
+ def to_hash
130
+ hash = {}
131
+ self.class.attribute_map.each_pair do |attr, param|
132
+ value = self.send(attr)
133
+ next if value.nil?
134
+ hash[param] = _to_hash(value)
135
+ end
136
+ hash
137
+ end
138
+
139
+ # Method to output non-array value in the form of hash
140
+ # For object, use to_hash. Otherwise, just return the value
141
+ def _to_hash(value)
142
+ if value.is_a?(Array)
143
+ value.compact.map{ |v| _to_hash(v) }
144
+ elsif value.is_a?(Hash)
145
+ {}.tap do |hash|
146
+ value.each { |k, v| hash[k] = _to_hash(v) }
147
+ end
148
+ elsif value.respond_to? :to_hash
149
+ value.to_hash
150
+ else
151
+ value
152
+ end
153
+ end
154
+
44
155
  end
45
156
  end