siwapp-client 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (51) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +112 -0
  4. data/Rakefile +8 -0
  5. data/docs/DefaultApi.md +119 -0
  6. data/docs/Invoice.md +8 -0
  7. data/docs/InvoiceData.md +11 -0
  8. data/docs/InvoiceDataAttributes.md +13 -0
  9. data/docs/InvoiceDataMeta.md +8 -0
  10. data/docs/InvoiceDataRelationships.md +9 -0
  11. data/docs/InvoiceDataRelationshipsItems.md +8 -0
  12. data/docs/InvoiceDataRelationshipsPayments.md +8 -0
  13. data/docs/InvoiceItem.md +8 -0
  14. data/docs/InvoiceItemAttributes.md +12 -0
  15. data/docs/InvoicePayment.md +8 -0
  16. data/docs/InvoicePaymentAttributes.md +10 -0
  17. data/git_push.sh +55 -0
  18. data/lib/siwapp-client.rb +51 -0
  19. data/lib/siwapp-client/api/default_api.rb +139 -0
  20. data/lib/siwapp-client/api_client.rb +389 -0
  21. data/lib/siwapp-client/api_error.rb +38 -0
  22. data/lib/siwapp-client/configuration.rb +209 -0
  23. data/lib/siwapp-client/models/invoice.rb +188 -0
  24. data/lib/siwapp-client/models/invoice_data.rb +216 -0
  25. data/lib/siwapp-client/models/invoice_data_attributes.rb +249 -0
  26. data/lib/siwapp-client/models/invoice_data_meta.rb +189 -0
  27. data/lib/siwapp-client/models/invoice_data_relationships.rb +197 -0
  28. data/lib/siwapp-client/models/invoice_data_relationships_items.rb +190 -0
  29. data/lib/siwapp-client/models/invoice_data_relationships_payments.rb +190 -0
  30. data/lib/siwapp-client/models/invoice_item.rb +188 -0
  31. data/lib/siwapp-client/models/invoice_item_attributes.rb +236 -0
  32. data/lib/siwapp-client/models/invoice_payment.rb +188 -0
  33. data/lib/siwapp-client/models/invoice_payment_attributes.rb +209 -0
  34. data/lib/siwapp-client/version.rb +15 -0
  35. data/siwapp-client.gemspec +46 -0
  36. data/spec/api/default_api_spec.rb +60 -0
  37. data/spec/api_client_spec.rb +226 -0
  38. data/spec/configuration_spec.rb +42 -0
  39. data/spec/models/invoice_data_attributes_spec.rb +72 -0
  40. data/spec/models/invoice_data_meta_spec.rb +42 -0
  41. data/spec/models/invoice_data_relationships_items_spec.rb +42 -0
  42. data/spec/models/invoice_data_relationships_payments_spec.rb +42 -0
  43. data/spec/models/invoice_data_relationships_spec.rb +48 -0
  44. data/spec/models/invoice_data_spec.rb +60 -0
  45. data/spec/models/invoice_item_attributes_spec.rb +66 -0
  46. data/spec/models/invoice_item_spec.rb +42 -0
  47. data/spec/models/invoice_payment_attributes_spec.rb +54 -0
  48. data/spec/models/invoice_payment_spec.rb +42 -0
  49. data/spec/models/invoice_spec.rb +42 -0
  50. data/spec/spec_helper.rb +111 -0
  51. metadata +281 -0
@@ -0,0 +1,236 @@
1
+ =begin
2
+ #Siwapp API Client
3
+
4
+ #Access Siwapp data via API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SiwappClient
16
+
17
+ class InvoiceItemAttributes
18
+ # Items' description.
19
+ attr_accessor :description
20
+
21
+ # Items' quantity.
22
+ attr_accessor :quantity
23
+
24
+ # Items' discount (eg 22 equals 22% discount).
25
+ attr_accessor :discount
26
+
27
+ # Array of tax ids (have to be already defined in Siwapp).
28
+ attr_accessor :tax_ids
29
+
30
+ # Items' unitary cost.
31
+ attr_accessor :unitary_cost
32
+
33
+
34
+ # Attribute mapping from ruby-style variable name to JSON key.
35
+ def self.attribute_map
36
+ {
37
+ :'description' => :'description',
38
+ :'quantity' => :'quantity',
39
+ :'discount' => :'discount',
40
+ :'tax_ids' => :'tax_ids',
41
+ :'unitary_cost' => :'unitary_cost'
42
+ }
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.swagger_types
47
+ {
48
+ :'description' => :'String',
49
+ :'quantity' => :'Integer',
50
+ :'discount' => :'Integer',
51
+ :'tax_ids' => :'Array<Integer>',
52
+ :'unitary_cost' => :'Float'
53
+ }
54
+ end
55
+
56
+ # Initializes the object
57
+ # @param [Hash] attributes Model attributes in the form of hash
58
+ def initialize(attributes = {})
59
+ return unless attributes.is_a?(Hash)
60
+
61
+ # convert string to symbol for hash key
62
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
63
+
64
+ if attributes.has_key?(:'description')
65
+ self.description = attributes[:'description']
66
+ end
67
+
68
+ if attributes.has_key?(:'quantity')
69
+ self.quantity = attributes[:'quantity']
70
+ end
71
+
72
+ if attributes.has_key?(:'discount')
73
+ self.discount = attributes[:'discount']
74
+ end
75
+
76
+ if attributes.has_key?(:'tax_ids')
77
+ if (value = attributes[:'tax_ids']).is_a?(Array)
78
+ self.tax_ids = value
79
+ end
80
+ end
81
+
82
+ if attributes.has_key?(:'unitary_cost')
83
+ self.unitary_cost = attributes[:'unitary_cost']
84
+ end
85
+
86
+ end
87
+
88
+ # Show invalid properties with the reasons. Usually used together with valid?
89
+ # @return Array for valid properies with the reasons
90
+ def list_invalid_properties
91
+ invalid_properties = Array.new
92
+ if @tax_ids.nil?
93
+ invalid_properties.push("invalid value for 'tax_ids', tax_ids cannot be nil.")
94
+ end
95
+
96
+ return invalid_properties
97
+ end
98
+
99
+ # Check to see if the all the properties in the model are valid
100
+ # @return true if the model is valid
101
+ def valid?
102
+ return false if @tax_ids.nil?
103
+ return true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ description == o.description &&
112
+ quantity == o.quantity &&
113
+ discount == o.discount &&
114
+ tax_ids == o.tax_ids &&
115
+ unitary_cost == o.unitary_cost
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Fixnum] Hash code
126
+ def hash
127
+ [description, quantity, discount, tax_ids, unitary_cost].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.swagger_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :BOOLEAN
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
185
+ end
186
+ else # model
187
+ temp_model = SiwappClient.const_get(type).new
188
+ temp_model.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map{ |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
231
+ end
232
+ end
233
+
234
+ end
235
+
236
+ end
@@ -0,0 +1,188 @@
1
+ =begin
2
+ #Siwapp API Client
3
+
4
+ #Access Siwapp data via API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SiwappClient
16
+ # InvoiceItem wrapper.
17
+ class InvoicePayment
18
+ attr_accessor :attributes
19
+
20
+
21
+ # Attribute mapping from ruby-style variable name to JSON key.
22
+ def self.attribute_map
23
+ {
24
+ :'attributes' => :'attributes'
25
+ }
26
+ end
27
+
28
+ # Attribute type mapping.
29
+ def self.swagger_types
30
+ {
31
+ :'attributes' => :'InvoicePaymentAttributes'
32
+ }
33
+ end
34
+
35
+ # Initializes the object
36
+ # @param [Hash] attributes Model attributes in the form of hash
37
+ def initialize(attributes = {})
38
+ return unless attributes.is_a?(Hash)
39
+
40
+ # convert string to symbol for hash key
41
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
42
+
43
+ if attributes.has_key?(:'attributes')
44
+ self.attributes = attributes[:'attributes']
45
+ end
46
+
47
+ end
48
+
49
+ # Show invalid properties with the reasons. Usually used together with valid?
50
+ # @return Array for valid properies with the reasons
51
+ def list_invalid_properties
52
+ invalid_properties = Array.new
53
+ return invalid_properties
54
+ end
55
+
56
+ # Check to see if the all the properties in the model are valid
57
+ # @return true if the model is valid
58
+ def valid?
59
+ return true
60
+ end
61
+
62
+ # Checks equality by comparing each attribute.
63
+ # @param [Object] Object to be compared
64
+ def ==(o)
65
+ return true if self.equal?(o)
66
+ self.class == o.class &&
67
+ attributes == o.attributes
68
+ end
69
+
70
+ # @see the `==` method
71
+ # @param [Object] Object to be compared
72
+ def eql?(o)
73
+ self == o
74
+ end
75
+
76
+ # Calculates hash code according to all attributes.
77
+ # @return [Fixnum] Hash code
78
+ def hash
79
+ [attributes].hash
80
+ end
81
+
82
+ # Builds the object from hash
83
+ # @param [Hash] attributes Model attributes in the form of hash
84
+ # @return [Object] Returns the model itself
85
+ def build_from_hash(attributes)
86
+ return nil unless attributes.is_a?(Hash)
87
+ self.class.swagger_types.each_pair do |key, type|
88
+ if type =~ /\AArray<(.*)>/i
89
+ # check to ensure the input is an array given that the the attribute
90
+ # is documented as an array but the input is not
91
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
92
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
93
+ end
94
+ elsif !attributes[self.class.attribute_map[key]].nil?
95
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
96
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
97
+ end
98
+
99
+ self
100
+ end
101
+
102
+ # Deserializes the data based on type
103
+ # @param string type Data type
104
+ # @param string value Value to be deserialized
105
+ # @return [Object] Deserialized data
106
+ def _deserialize(type, value)
107
+ case type.to_sym
108
+ when :DateTime
109
+ DateTime.parse(value)
110
+ when :Date
111
+ Date.parse(value)
112
+ when :String
113
+ value.to_s
114
+ when :Integer
115
+ value.to_i
116
+ when :Float
117
+ value.to_f
118
+ when :BOOLEAN
119
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
120
+ true
121
+ else
122
+ false
123
+ end
124
+ when :Object
125
+ # generic object (usually a Hash), return directly
126
+ value
127
+ when /\AArray<(?<inner_type>.+)>\z/
128
+ inner_type = Regexp.last_match[:inner_type]
129
+ value.map { |v| _deserialize(inner_type, v) }
130
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
131
+ k_type = Regexp.last_match[:k_type]
132
+ v_type = Regexp.last_match[:v_type]
133
+ {}.tap do |hash|
134
+ value.each do |k, v|
135
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
136
+ end
137
+ end
138
+ else # model
139
+ temp_model = SiwappClient.const_get(type).new
140
+ temp_model.build_from_hash(value)
141
+ end
142
+ end
143
+
144
+ # Returns the string representation of the object
145
+ # @return [String] String presentation of the object
146
+ def to_s
147
+ to_hash.to_s
148
+ end
149
+
150
+ # to_body is an alias to to_hash (backward compatibility)
151
+ # @return [Hash] Returns the object in the form of hash
152
+ def to_body
153
+ to_hash
154
+ end
155
+
156
+ # Returns the object in the form of hash
157
+ # @return [Hash] Returns the object in the form of hash
158
+ def to_hash
159
+ hash = {}
160
+ self.class.attribute_map.each_pair do |attr, param|
161
+ value = self.send(attr)
162
+ next if value.nil?
163
+ hash[param] = _to_hash(value)
164
+ end
165
+ hash
166
+ end
167
+
168
+ # Outputs non-array value in the form of hash
169
+ # For object, use to_hash. Otherwise, just return the value
170
+ # @param [Object] value Any valid value
171
+ # @return [Hash] Returns the value in the form of hash
172
+ def _to_hash(value)
173
+ if value.is_a?(Array)
174
+ value.compact.map{ |v| _to_hash(v) }
175
+ elsif value.is_a?(Hash)
176
+ {}.tap do |hash|
177
+ value.each { |k, v| hash[k] = _to_hash(v) }
178
+ end
179
+ elsif value.respond_to? :to_hash
180
+ value.to_hash
181
+ else
182
+ value
183
+ end
184
+ end
185
+
186
+ end
187
+
188
+ end
@@ -0,0 +1,209 @@
1
+ =begin
2
+ #Siwapp API Client
3
+
4
+ #Access Siwapp data via API.
5
+
6
+ OpenAPI spec version: 1.0.0
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.2.3
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module SiwappClient
16
+
17
+ class InvoicePaymentAttributes
18
+ # Payment's notes.
19
+ attr_accessor :notes
20
+
21
+ # Payment's amount.
22
+ attr_accessor :amount
23
+
24
+ # Payment's date eg '2017-02-03'.
25
+ attr_accessor :date
26
+
27
+
28
+ # Attribute mapping from ruby-style variable name to JSON key.
29
+ def self.attribute_map
30
+ {
31
+ :'notes' => :'notes',
32
+ :'amount' => :'amount',
33
+ :'date' => :'date'
34
+ }
35
+ end
36
+
37
+ # Attribute type mapping.
38
+ def self.swagger_types
39
+ {
40
+ :'notes' => :'String',
41
+ :'amount' => :'Float',
42
+ :'date' => :'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?(:'notes')
55
+ self.notes = attributes[:'notes']
56
+ end
57
+
58
+ if attributes.has_key?(:'amount')
59
+ self.amount = attributes[:'amount']
60
+ end
61
+
62
+ if attributes.has_key?(:'date')
63
+ self.date = attributes[:'date']
64
+ end
65
+
66
+ end
67
+
68
+ # Show invalid properties with the reasons. Usually used together with valid?
69
+ # @return Array for valid properies with the reasons
70
+ def list_invalid_properties
71
+ invalid_properties = Array.new
72
+ return invalid_properties
73
+ end
74
+
75
+ # Check to see if the all the properties in the model are valid
76
+ # @return true if the model is valid
77
+ def valid?
78
+ return true
79
+ end
80
+
81
+ # Checks equality by comparing each attribute.
82
+ # @param [Object] Object to be compared
83
+ def ==(o)
84
+ return true if self.equal?(o)
85
+ self.class == o.class &&
86
+ notes == o.notes &&
87
+ amount == o.amount &&
88
+ date == o.date
89
+ end
90
+
91
+ # @see the `==` method
92
+ # @param [Object] Object to be compared
93
+ def eql?(o)
94
+ self == o
95
+ end
96
+
97
+ # Calculates hash code according to all attributes.
98
+ # @return [Fixnum] Hash code
99
+ def hash
100
+ [notes, amount, date].hash
101
+ end
102
+
103
+ # Builds the object from hash
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ # @return [Object] Returns the model itself
106
+ def build_from_hash(attributes)
107
+ return nil unless attributes.is_a?(Hash)
108
+ self.class.swagger_types.each_pair do |key, type|
109
+ if type =~ /\AArray<(.*)>/i
110
+ # check to ensure the input is an array given that the the attribute
111
+ # is documented as an array but the input is not
112
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
113
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
114
+ end
115
+ elsif !attributes[self.class.attribute_map[key]].nil?
116
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
117
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
118
+ end
119
+
120
+ self
121
+ end
122
+
123
+ # Deserializes the data based on type
124
+ # @param string type Data type
125
+ # @param string value Value to be deserialized
126
+ # @return [Object] Deserialized data
127
+ def _deserialize(type, value)
128
+ case type.to_sym
129
+ when :DateTime
130
+ DateTime.parse(value)
131
+ when :Date
132
+ Date.parse(value)
133
+ when :String
134
+ value.to_s
135
+ when :Integer
136
+ value.to_i
137
+ when :Float
138
+ value.to_f
139
+ when :BOOLEAN
140
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
141
+ true
142
+ else
143
+ false
144
+ end
145
+ when :Object
146
+ # generic object (usually a Hash), return directly
147
+ value
148
+ when /\AArray<(?<inner_type>.+)>\z/
149
+ inner_type = Regexp.last_match[:inner_type]
150
+ value.map { |v| _deserialize(inner_type, v) }
151
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
152
+ k_type = Regexp.last_match[:k_type]
153
+ v_type = Regexp.last_match[:v_type]
154
+ {}.tap do |hash|
155
+ value.each do |k, v|
156
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
157
+ end
158
+ end
159
+ else # model
160
+ temp_model = SiwappClient.const_get(type).new
161
+ temp_model.build_from_hash(value)
162
+ end
163
+ end
164
+
165
+ # Returns the string representation of the object
166
+ # @return [String] String presentation of the object
167
+ def to_s
168
+ to_hash.to_s
169
+ end
170
+
171
+ # to_body is an alias to to_hash (backward compatibility)
172
+ # @return [Hash] Returns the object in the form of hash
173
+ def to_body
174
+ to_hash
175
+ end
176
+
177
+ # Returns the object in the form of hash
178
+ # @return [Hash] Returns the object in the form of hash
179
+ def to_hash
180
+ hash = {}
181
+ self.class.attribute_map.each_pair do |attr, param|
182
+ value = self.send(attr)
183
+ next if value.nil?
184
+ hash[param] = _to_hash(value)
185
+ end
186
+ hash
187
+ end
188
+
189
+ # Outputs non-array value in the form of hash
190
+ # For object, use to_hash. Otherwise, just return the value
191
+ # @param [Object] value Any valid value
192
+ # @return [Hash] Returns the value in the form of hash
193
+ def _to_hash(value)
194
+ if value.is_a?(Array)
195
+ value.compact.map{ |v| _to_hash(v) }
196
+ elsif value.is_a?(Hash)
197
+ {}.tap do |hash|
198
+ value.each { |k, v| hash[k] = _to_hash(v) }
199
+ end
200
+ elsif value.respond_to? :to_hash
201
+ value.to_hash
202
+ else
203
+ value
204
+ end
205
+ end
206
+
207
+ end
208
+
209
+ end