supportify_client 1.0.2 → 3.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.
@@ -0,0 +1,158 @@
1
+ require 'date'
2
+
3
+ module Supportify
4
+ class InfoApplication
5
+ # The name of the application being accessed.
6
+ attr_accessor :name
7
+
8
+ # The unique identifier of the application being accessed.
9
+ attr_accessor :id
10
+
11
+ # Attribute mapping from ruby-style variable name to JSON key.
12
+ def self.attribute_map
13
+ {
14
+
15
+ :'name' => :'name',
16
+
17
+ :'id' => :'id'
18
+
19
+ }
20
+ end
21
+
22
+ # Attribute type mapping.
23
+ def self.swagger_types
24
+ {
25
+ :'name' => :'Integer',
26
+ :'id' => :'Integer'
27
+
28
+ }
29
+ end
30
+
31
+ def initialize(attributes = {})
32
+ return unless attributes.is_a?(Hash)
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
36
+
37
+
38
+ if attributes[:'name']
39
+ self.name = attributes[:'name']
40
+ end
41
+
42
+ if attributes[:'id']
43
+ self.id = attributes[:'id']
44
+ end
45
+
46
+ end
47
+
48
+ # Check equality by comparing each attribute.
49
+ def ==(o)
50
+ return true if self.equal?(o)
51
+ self.class == o.class &&
52
+ name == o.name &&
53
+ id == o.id
54
+ end
55
+
56
+ # @see the `==` method
57
+ def eql?(o)
58
+ self == o
59
+ end
60
+
61
+ # Calculate hash code according to all attributes.
62
+ def hash
63
+ [name, id].hash
64
+ end
65
+
66
+ # build the object from hash
67
+ def build_from_hash(attributes)
68
+ return nil unless attributes.is_a?(Hash)
69
+ self.class.swagger_types.each_pair do |key, type|
70
+ if type =~ /^Array<(.*)>/i
71
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
72
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
73
+ else
74
+ #TODO show warning in debug mode
75
+ end
76
+ elsif !attributes[self.class.attribute_map[key]].nil?
77
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
78
+ else
79
+ # data not found in attributes(hash), not an issue as the data can be optional
80
+ end
81
+ end
82
+
83
+ self
84
+ end
85
+
86
+ def _deserialize(type, value)
87
+ case type.to_sym
88
+ when :DateTime
89
+ DateTime.parse(value)
90
+ when :Date
91
+ Date.parse(value)
92
+ when :String
93
+ value.to_s
94
+ when :Integer
95
+ value.to_i
96
+ when :Float
97
+ value.to_f
98
+ when :BOOLEAN
99
+ if value =~ /^(true|t|yes|y|1)$/i
100
+ true
101
+ else
102
+ false
103
+ end
104
+ when /\AArray<(?<inner_type>.+)>\z/
105
+ inner_type = Regexp.last_match[:inner_type]
106
+ value.map { |v| _deserialize(inner_type, v) }
107
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
108
+ k_type = Regexp.last_match[:k_type]
109
+ v_type = Regexp.last_match[:v_type]
110
+ {}.tap do |hash|
111
+ value.each do |k, v|
112
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
113
+ end
114
+ end
115
+ else # model
116
+ _model = Supportify.const_get(type).new
117
+ _model.build_from_hash(value)
118
+ end
119
+ end
120
+
121
+ def to_s
122
+ to_hash.to_s
123
+ end
124
+
125
+ # to_body is an alias to to_body (backward compatibility))
126
+ def to_body
127
+ to_hash
128
+ end
129
+
130
+ # return the object in the form of hash
131
+ def to_hash
132
+ hash = {}
133
+ self.class.attribute_map.each_pair do |attr, param|
134
+ value = self.send(attr)
135
+ next if value.nil?
136
+ hash[param] = _to_hash(value)
137
+ end
138
+ hash
139
+ end
140
+
141
+ # Method to output non-array value in the form of hash
142
+ # For object, use to_hash. Otherwise, just return the value
143
+ def _to_hash(value)
144
+ if value.is_a?(Array)
145
+ value.compact.map{ |v| _to_hash(v) }
146
+ elsif value.is_a?(Hash)
147
+ {}.tap do |hash|
148
+ value.each { |k, v| hash[k] = _to_hash(v) }
149
+ end
150
+ elsif value.respond_to? :to_hash
151
+ value.to_hash
152
+ else
153
+ value
154
+ end
155
+ end
156
+
157
+ end
158
+ end
@@ -0,0 +1,147 @@
1
+ require 'date'
2
+
3
+ module Supportify
4
+ class InfoSupportify
5
+ # The current version of the Supportify API.
6
+ attr_accessor :version
7
+
8
+ # Attribute mapping from ruby-style variable name to JSON key.
9
+ def self.attribute_map
10
+ {
11
+
12
+ :'version' => :'version'
13
+
14
+ }
15
+ end
16
+
17
+ # Attribute type mapping.
18
+ def self.swagger_types
19
+ {
20
+ :'version' => :'Float'
21
+
22
+ }
23
+ end
24
+
25
+ def initialize(attributes = {})
26
+ return unless attributes.is_a?(Hash)
27
+
28
+ # convert string to symbol for hash key
29
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
30
+
31
+
32
+ if attributes[:'version']
33
+ self.version = attributes[:'version']
34
+ end
35
+
36
+ end
37
+
38
+ # Check equality by comparing each attribute.
39
+ def ==(o)
40
+ return true if self.equal?(o)
41
+ self.class == o.class &&
42
+ version == o.version
43
+ end
44
+
45
+ # @see the `==` method
46
+ def eql?(o)
47
+ self == o
48
+ end
49
+
50
+ # Calculate hash code according to all attributes.
51
+ def hash
52
+ [version].hash
53
+ end
54
+
55
+ # build the object from hash
56
+ def build_from_hash(attributes)
57
+ return nil unless attributes.is_a?(Hash)
58
+ self.class.swagger_types.each_pair do |key, type|
59
+ if type =~ /^Array<(.*)>/i
60
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
61
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
62
+ else
63
+ #TODO show warning in debug mode
64
+ end
65
+ elsif !attributes[self.class.attribute_map[key]].nil?
66
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
67
+ else
68
+ # data not found in attributes(hash), not an issue as the data can be optional
69
+ end
70
+ end
71
+
72
+ self
73
+ end
74
+
75
+ def _deserialize(type, value)
76
+ case type.to_sym
77
+ when :DateTime
78
+ DateTime.parse(value)
79
+ when :Date
80
+ Date.parse(value)
81
+ when :String
82
+ value.to_s
83
+ when :Integer
84
+ value.to_i
85
+ when :Float
86
+ value.to_f
87
+ when :BOOLEAN
88
+ if value =~ /^(true|t|yes|y|1)$/i
89
+ true
90
+ else
91
+ false
92
+ end
93
+ when /\AArray<(?<inner_type>.+)>\z/
94
+ inner_type = Regexp.last_match[:inner_type]
95
+ value.map { |v| _deserialize(inner_type, v) }
96
+ when /\AHash<(?<k_type>.+), (?<v_type>.+)>\z/
97
+ k_type = Regexp.last_match[:k_type]
98
+ v_type = Regexp.last_match[:v_type]
99
+ {}.tap do |hash|
100
+ value.each do |k, v|
101
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
102
+ end
103
+ end
104
+ else # model
105
+ _model = Supportify.const_get(type).new
106
+ _model.build_from_hash(value)
107
+ end
108
+ end
109
+
110
+ def to_s
111
+ to_hash.to_s
112
+ end
113
+
114
+ # to_body is an alias to to_body (backward compatibility))
115
+ def to_body
116
+ to_hash
117
+ end
118
+
119
+ # return the object in the form of hash
120
+ def to_hash
121
+ hash = {}
122
+ self.class.attribute_map.each_pair do |attr, param|
123
+ value = self.send(attr)
124
+ next if value.nil?
125
+ hash[param] = _to_hash(value)
126
+ end
127
+ hash
128
+ end
129
+
130
+ # Method to output non-array value in the form of hash
131
+ # For object, use to_hash. Otherwise, just return the value
132
+ def _to_hash(value)
133
+ if value.is_a?(Array)
134
+ value.compact.map{ |v| _to_hash(v) }
135
+ elsif value.is_a?(Hash)
136
+ {}.tap do |hash|
137
+ value.each { |k, v| hash[k] = _to_hash(v) }
138
+ end
139
+ elsif value.respond_to? :to_hash
140
+ value.to_hash
141
+ else
142
+ value
143
+ end
144
+ end
145
+
146
+ end
147
+ end
@@ -1,24 +1,30 @@
1
+ require 'date'
2
+
1
3
  module Supportify
2
- #
3
- class Tag < BaseObject
4
- attr_accessor :id, :description, :name
5
- # attribute mapping from ruby-style variable name to JSON key
4
+ class Tag
5
+ # Unique identifier representing a specific tag within an application.
6
+ attr_accessor :id
7
+
8
+ # Description of the tag.
9
+ attr_accessor :description
10
+
11
+ # Display name of the tag.
12
+ attr_accessor :name
13
+
14
+ # Attribute mapping from ruby-style variable name to JSON key.
6
15
  def self.attribute_map
7
16
  {
8
17
 
9
- # Unique identifier representing a specific tag within an application.
10
18
  :'id' => :'id',
11
19
 
12
- # Description of the tag.
13
20
  :'description' => :'description',
14
21
 
15
- # Display name of the tag.
16
22
  :'name' => :'name'
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
  :'id' => :'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
+ id == o.id &&
63
+ description == o.description &&
64
+ name == o.name
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
+ [id, description, name].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