Class: Devdraft::CreateInvoiceDto
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Devdraft::CreateInvoiceDto
- Defined in:
- lib/devdraft/models/create_invoice_dto.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#address ⇒ Object
Address.
-
#currency ⇒ Object
Currency for the invoice.
-
#customer_id ⇒ Object
Customer ID.
-
#delivery ⇒ Object
Delivery method.
-
#due_date ⇒ Object
Due date of the invoice.
-
#email ⇒ Object
Email address.
-
#items ⇒ Object
Returns the value of attribute items.
-
#logo ⇒ Object
Logo URL.
-
#name ⇒ Object
Name of the invoice.
-
#partial_payment ⇒ Object
Allow partial payments.
-
#payment_link ⇒ Object
Whether to generate a payment link.
-
#payment_methods ⇒ Object
Array of accepted payment methods.
-
#phone_number ⇒ Object
Phone number.
-
#send_date ⇒ Object
Send date.
-
#status ⇒ Object
Invoice status.
-
#tax_id ⇒ Object
Tax ID.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ CreateInvoiceDto
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ CreateInvoiceDto
Initializes the object
149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 149 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Devdraft::CreateInvoiceDto` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Devdraft::CreateInvoiceDto`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'name') self.name = attributes[:'name'] else self.name = nil end if attributes.key?(:'email') self.email = attributes[:'email'] else self.email = nil end if attributes.key?(:'customer_id') self.customer_id = attributes[:'customer_id'] else self.customer_id = nil end if attributes.key?(:'currency') self.currency = attributes[:'currency'] else self.currency = nil end if attributes.key?(:'items') self.items = attributes[:'items'] else self.items = nil end if attributes.key?(:'due_date') self.due_date = attributes[:'due_date'] else self.due_date = nil end if attributes.key?(:'delivery') self.delivery = attributes[:'delivery'] else self.delivery = nil end if attributes.key?(:'payment_link') self.payment_link = attributes[:'payment_link'] else self.payment_link = nil end if attributes.key?(:'payment_methods') if (value = attributes[:'payment_methods']).is_a?(Array) self.payment_methods = value end else self.payment_methods = nil end if attributes.key?(:'status') self.status = attributes[:'status'] else self.status = nil end if attributes.key?(:'address') self.address = attributes[:'address'] end if attributes.key?(:'phone_number') self.phone_number = attributes[:'phone_number'] end if attributes.key?(:'send_date') self.send_date = attributes[:'send_date'] end if attributes.key?(:'logo') self.logo = attributes[:'logo'] end if attributes.key?(:'partial_payment') self.partial_payment = attributes[:'partial_payment'] else self.partial_payment = nil end if attributes.key?(:'tax_id') self.tax_id = attributes[:'tax_id'] end end |
Instance Attribute Details
#address ⇒ Object
Address
48 49 50 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 48 def address @address end |
#currency ⇒ Object
Currency for the invoice
28 29 30 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 28 def currency @currency end |
#customer_id ⇒ Object
Customer ID
25 26 27 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 25 def customer_id @customer_id end |
#delivery ⇒ Object
Delivery method
36 37 38 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 36 def delivery @delivery end |
#due_date ⇒ Object
Due date of the invoice
33 34 35 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 33 def due_date @due_date end |
#email ⇒ Object
Email address
22 23 24 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 22 def email @email end |
#items ⇒ Object
Returns the value of attribute items.
30 31 32 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 30 def items @items end |
#logo ⇒ Object
Logo URL
57 58 59 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 57 def logo @logo end |
#name ⇒ Object
Name of the invoice
19 20 21 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 19 def name @name end |
#partial_payment ⇒ Object
Allow partial payments
60 61 62 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 60 def partial_payment @partial_payment end |
#payment_link ⇒ Object
Whether to generate a payment link
39 40 41 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 39 def payment_link @payment_link end |
#payment_methods ⇒ Object
Array of accepted payment methods
42 43 44 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 42 def payment_methods @payment_methods end |
#phone_number ⇒ Object
Phone number
51 52 53 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 51 def phone_number @phone_number end |
#send_date ⇒ Object
Send date
54 55 56 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 54 def send_date @send_date end |
#status ⇒ Object
Invoice status
45 46 47 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 45 def status @status end |
#tax_id ⇒ Object
Tax ID
63 64 65 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 63 def tax_id @tax_id end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
110 111 112 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 110 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
115 116 117 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 115 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 88 def self.attribute_map { :'name' => :'name', :'email' => :'email', :'customer_id' => :'customer_id', :'currency' => :'currency', :'items' => :'items', :'due_date' => :'due_date', :'delivery' => :'delivery', :'payment_link' => :'payment_link', :'payment_methods' => :'payment_methods', :'status' => :'status', :'address' => :'address', :'phone_number' => :'phone_number', :'send_date' => :'send_date', :'logo' => :'logo', :'partial_payment' => :'partial_payment', :'tax_id' => :'taxId' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 466 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
142 143 144 145 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 142 def self.openapi_nullable Set.new([ ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 120 def self.openapi_types { :'name' => :'String', :'email' => :'String', :'customer_id' => :'String', :'currency' => :'String', :'items' => :'Object', :'due_date' => :'Time', :'delivery' => :'String', :'payment_link' => :'Boolean', :'payment_methods' => :'Array<String>', :'status' => :'String', :'address' => :'String', :'phone_number' => :'String', :'send_date' => :'Time', :'logo' => :'String', :'partial_payment' => :'Boolean', :'tax_id' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 430 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && email == o.email && customer_id == o.customer_id && currency == o.currency && items == o.items && due_date == o.due_date && delivery == o.delivery && payment_link == o.payment_link && payment_methods == o.payment_methods && status == o.status && address == o.address && phone_number == o.phone_number && send_date == o.send_date && logo == o.logo && partial_payment == o.partial_payment && tax_id == o.tax_id end |
#eql?(o) ⇒ Boolean
453 454 455 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 453 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
459 460 461 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 459 def hash [name, email, customer_id, currency, items, due_date, delivery, payment_link, payment_methods, status, address, phone_number, send_date, logo, partial_payment, tax_id].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 254 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @name.nil? invalid_properties.push('invalid value for "name", name cannot be nil.') end if @email.nil? invalid_properties.push('invalid value for "email", email cannot be nil.') end if @customer_id.nil? invalid_properties.push('invalid value for "customer_id", customer_id cannot be nil.') end if @currency.nil? invalid_properties.push('invalid value for "currency", currency cannot be nil.') end if @items.nil? invalid_properties.push('invalid value for "items", items cannot be nil.') end if @due_date.nil? invalid_properties.push('invalid value for "due_date", due_date cannot be nil.') end if @delivery.nil? invalid_properties.push('invalid value for "delivery", delivery cannot be nil.') end if @payment_link.nil? invalid_properties.push('invalid value for "payment_link", payment_link cannot be nil.') end if @payment_methods.nil? invalid_properties.push('invalid value for "payment_methods", payment_methods cannot be nil.') end if @status.nil? invalid_properties.push('invalid value for "status", status cannot be nil.') end if @partial_payment.nil? invalid_properties.push('invalid value for "partial_payment", partial_payment cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
488 489 490 491 492 493 494 495 496 497 498 499 500 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 488 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 |
# File 'lib/devdraft/models/create_invoice_dto.rb', line 306 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? return false if @email.nil? return false if @customer_id.nil? return false if @currency.nil? currency_validator = EnumAttributeValidator.new('String', ["usdc", "eurc"]) return false unless currency_validator.valid?(@currency) return false if @items.nil? return false if @due_date.nil? return false if @delivery.nil? delivery_validator = EnumAttributeValidator.new('String', ["EMAIL", "MANUALLY"]) return false unless delivery_validator.valid?(@delivery) return false if @payment_link.nil? return false if @payment_methods.nil? return false if @status.nil? status_validator = EnumAttributeValidator.new('String', ["DRAFT", "OPEN", "PASTDUE", "PAID", "PARTIALLYPAID"]) return false unless status_validator.valid?(@status) return false if @partial_payment.nil? true end |