Class: Zippendo::CreateShippingRuleRequest
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Zippendo::CreateShippingRuleRequest
- Defined in:
- lib/zippendo/models/create_shipping_rule_request.rb
Defined Under Namespace
Classes: EnumAttributeValidator
Instance Attribute Summary collapse
-
#additional_parameters ⇒ Object
Carrier-specific extra parameters, keyed by the carrier parameter
keyfrom the product'sadditionalParameters[].key(e.g.returnFunctionality). -
#address_id ⇒ Object
Sender address ID.
-
#auto_create_return_shipment ⇒ Object
Automatically create and send a return shipment on dispatch.
-
#auto_print_documents ⇒ Object
Automatically print documents when shipment is sent.
-
#auto_print_labels ⇒ Object
Automatically print labels when shipment is sent.
-
#carrier_id ⇒ Object
Carrier ID.
-
#conditions ⇒ Object
Rule conditions (weight/price/quantity).
-
#description ⇒ Object
Optional description.
-
#direction ⇒ Object
Whether this rule is for outbound or inbound (return) shipments.
-
#document_printer_id ⇒ Object
ID of the document printer.
-
#email_notification ⇒ Object
Send email notification to recipient.
-
#generate_commercial_invoice ⇒ Object
Generate commercial invoice for international shipments.
-
#generate_packing_list ⇒ Object
Generate packing slip with package and item details.
-
#generate_proforma_invoice ⇒ Object
Generate proforma invoice for shipments.
-
#label_printer_id ⇒ Object
ID of the label printer.
-
#max_order_value ⇒ Object
Maximum allowed order value in currency units.
-
#max_weight ⇒ Object
Maximum allowed weight in kg.
-
#min_order_value ⇒ Object
Minimum required order value in currency units.
-
#min_weight ⇒ Object
Minimum required weight in kg.
-
#name ⇒ Object
Shipping rule name.
-
#phone_notification ⇒ Object
Send SMS notification to recipient.
-
#product_id ⇒ Object
Product ID from carrier.
-
#receiving_countries ⇒ Object
List of supported country codes.
-
#return_shipping_rule_id ⇒ Object
ID of the return shipping rule.
-
#services ⇒ Object
List of selected services.
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 = {}) ⇒ CreateShippingRuleRequest
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 = {}) ⇒ CreateShippingRuleRequest
Initializes the object
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 251 252 253 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 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 202 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Zippendo::CreateShippingRuleRequest` 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 `Zippendo::CreateShippingRuleRequest`. 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?(:'description') self.description = attributes[:'description'] end if attributes.key?(:'direction') self.direction = attributes[:'direction'] else self.direction = 'outbound' end if attributes.key?(:'carrier_id') self.carrier_id = attributes[:'carrier_id'] else self.carrier_id = nil end if attributes.key?(:'product_id') self.product_id = attributes[:'product_id'] else self.product_id = nil end if attributes.key?(:'services') if (value = attributes[:'services']).is_a?(Array) self.services = value end else self.services = nil end if attributes.key?(:'additional_parameters') if (value = attributes[:'additional_parameters']).is_a?(Hash) self.additional_parameters = value end end if attributes.key?(:'address_id') self.address_id = attributes[:'address_id'] else self.address_id = nil end if attributes.key?(:'receiving_countries') if (value = attributes[:'receiving_countries']).is_a?(Array) self.receiving_countries = value end else self.receiving_countries = nil end if attributes.key?(:'email_notification') self.email_notification = attributes[:'email_notification'] else self.email_notification = false end if attributes.key?(:'phone_notification') self.phone_notification = attributes[:'phone_notification'] else self.phone_notification = false end if attributes.key?(:'min_weight') self.min_weight = attributes[:'min_weight'] end if attributes.key?(:'max_weight') self.max_weight = attributes[:'max_weight'] end if attributes.key?(:'min_order_value') self.min_order_value = attributes[:'min_order_value'] end if attributes.key?(:'max_order_value') self.max_order_value = attributes[:'max_order_value'] end if attributes.key?(:'conditions') if (value = attributes[:'conditions']).is_a?(Array) self.conditions = value end else self.conditions = nil end if attributes.key?(:'generate_proforma_invoice') self.generate_proforma_invoice = attributes[:'generate_proforma_invoice'] else self.generate_proforma_invoice = false end if attributes.key?(:'generate_commercial_invoice') self.generate_commercial_invoice = attributes[:'generate_commercial_invoice'] else self.generate_commercial_invoice = false end if attributes.key?(:'generate_packing_list') self.generate_packing_list = attributes[:'generate_packing_list'] else self.generate_packing_list = false end if attributes.key?(:'auto_print_labels') self.auto_print_labels = attributes[:'auto_print_labels'] else self.auto_print_labels = false end if attributes.key?(:'auto_print_documents') self.auto_print_documents = attributes[:'auto_print_documents'] else self.auto_print_documents = false end if attributes.key?(:'label_printer_id') self.label_printer_id = attributes[:'label_printer_id'] end if attributes.key?(:'document_printer_id') self.document_printer_id = attributes[:'document_printer_id'] end if attributes.key?(:'return_shipping_rule_id') self.return_shipping_rule_id = attributes[:'return_shipping_rule_id'] end if attributes.key?(:'auto_create_return_shipment') self.auto_create_return_shipment = attributes[:'auto_create_return_shipment'] else self.auto_create_return_shipment = false end end |
Instance Attribute Details
#additional_parameters ⇒ Object
Carrier-specific extra parameters, keyed by the carrier parameter key from the product's additionalParameters[].key (e.g. returnFunctionality).
37 38 39 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 37 def additional_parameters @additional_parameters end |
#address_id ⇒ Object
Sender address ID
40 41 42 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 40 def address_id @address_id end |
#auto_create_return_shipment ⇒ Object
Automatically create and send a return shipment on dispatch
91 92 93 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 91 def auto_create_return_shipment @auto_create_return_shipment end |
#auto_print_documents ⇒ Object
Automatically print documents when shipment is sent
79 80 81 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 79 def auto_print_documents @auto_print_documents end |
#auto_print_labels ⇒ Object
Automatically print labels when shipment is sent
76 77 78 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 76 def auto_print_labels @auto_print_labels end |
#carrier_id ⇒ Object
Carrier ID
28 29 30 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 28 def carrier_id @carrier_id end |
#conditions ⇒ Object
Rule conditions (weight/price/quantity)
64 65 66 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 64 def conditions @conditions end |
#description ⇒ Object
Optional description
22 23 24 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 22 def description @description end |
#direction ⇒ Object
Whether this rule is for outbound or inbound (return) shipments
25 26 27 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 25 def direction @direction end |
#document_printer_id ⇒ Object
ID of the document printer
85 86 87 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 85 def document_printer_id @document_printer_id end |
#email_notification ⇒ Object
Send email notification to recipient
46 47 48 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 46 def email_notification @email_notification end |
#generate_commercial_invoice ⇒ Object
Generate commercial invoice for international shipments
70 71 72 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 70 def generate_commercial_invoice @generate_commercial_invoice end |
#generate_packing_list ⇒ Object
Generate packing slip with package and item details
73 74 75 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 73 def generate_packing_list @generate_packing_list end |
#generate_proforma_invoice ⇒ Object
Generate proforma invoice for shipments
67 68 69 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 67 def generate_proforma_invoice @generate_proforma_invoice end |
#label_printer_id ⇒ Object
ID of the label printer
82 83 84 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 82 def label_printer_id @label_printer_id end |
#max_order_value ⇒ Object
Maximum allowed order value in currency units
61 62 63 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 61 def max_order_value @max_order_value end |
#max_weight ⇒ Object
Maximum allowed weight in kg
55 56 57 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 55 def max_weight @max_weight end |
#min_order_value ⇒ Object
Minimum required order value in currency units
58 59 60 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 58 def min_order_value @min_order_value end |
#min_weight ⇒ Object
Minimum required weight in kg
52 53 54 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 52 def min_weight @min_weight end |
#name ⇒ Object
Shipping rule name
19 20 21 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 19 def name @name end |
#phone_notification ⇒ Object
Send SMS notification to recipient
49 50 51 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 49 def phone_notification @phone_notification end |
#product_id ⇒ Object
Product ID from carrier
31 32 33 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 31 def product_id @product_id end |
#receiving_countries ⇒ Object
List of supported country codes
43 44 45 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 43 def receiving_countries @receiving_countries end |
#return_shipping_rule_id ⇒ Object
ID of the return shipping rule
88 89 90 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 88 def return_shipping_rule_id @return_shipping_rule_id end |
#services ⇒ Object
List of selected services
34 35 36 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 34 def services @services end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
147 148 149 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 147 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
152 153 154 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 152 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 116 def self.attribute_map { :'name' => :'name', :'description' => :'description', :'direction' => :'direction', :'carrier_id' => :'carrierId', :'product_id' => :'productId', :'services' => :'services', :'additional_parameters' => :'additionalParameters', :'address_id' => :'addressId', :'receiving_countries' => :'receivingCountries', :'email_notification' => :'emailNotification', :'phone_notification' => :'phoneNotification', :'min_weight' => :'minWeight', :'max_weight' => :'maxWeight', :'min_order_value' => :'minOrderValue', :'max_order_value' => :'maxOrderValue', :'conditions' => :'conditions', :'generate_proforma_invoice' => :'generateProformaInvoice', :'generate_commercial_invoice' => :'generateCommercialInvoice', :'generate_packing_list' => :'generatePackingList', :'auto_print_labels' => :'autoPrintLabels', :'auto_print_documents' => :'autoPrintDocuments', :'label_printer_id' => :'labelPrinterId', :'document_printer_id' => :'documentPrinterId', :'return_shipping_rule_id' => :'returnShippingRuleId', :'auto_create_return_shipment' => :'autoCreateReturnShipment' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 605 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
188 189 190 191 192 193 194 195 196 197 198 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 188 def self.openapi_nullable Set.new([ :'min_weight', :'max_weight', :'min_order_value', :'max_order_value', :'label_printer_id', :'document_printer_id', :'return_shipping_rule_id', ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
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 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 157 def self.openapi_types { :'name' => :'String', :'description' => :'String', :'direction' => :'String', :'carrier_id' => :'String', :'product_id' => :'String', :'services' => :'Array<String>', :'additional_parameters' => :'Hash<String, CreateShippingRuleRequestAdditionalParametersValue>', :'address_id' => :'String', :'receiving_countries' => :'Array<String>', :'email_notification' => :'Boolean', :'phone_notification' => :'Boolean', :'min_weight' => :'Float', :'max_weight' => :'Float', :'min_order_value' => :'Float', :'max_order_value' => :'Float', :'conditions' => :'Array<CreateShippingRuleRequestConditionsInner>', :'generate_proforma_invoice' => :'Boolean', :'generate_commercial_invoice' => :'Boolean', :'generate_packing_list' => :'Boolean', :'auto_print_labels' => :'Boolean', :'auto_print_documents' => :'Boolean', :'label_printer_id' => :'String', :'document_printer_id' => :'String', :'return_shipping_rule_id' => :'String', :'auto_create_return_shipment' => :'Boolean' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 560 def ==(o) return true if self.equal?(o) self.class == o.class && name == o.name && description == o.description && direction == o.direction && carrier_id == o.carrier_id && product_id == o.product_id && services == o.services && additional_parameters == o.additional_parameters && address_id == o.address_id && receiving_countries == o.receiving_countries && email_notification == o.email_notification && phone_notification == o.phone_notification && min_weight == o.min_weight && max_weight == o.max_weight && min_order_value == o.min_order_value && max_order_value == o.max_order_value && conditions == o.conditions && generate_proforma_invoice == o.generate_proforma_invoice && generate_commercial_invoice == o.generate_commercial_invoice && generate_packing_list == o.generate_packing_list && auto_print_labels == o.auto_print_labels && auto_print_documents == o.auto_print_documents && label_printer_id == o.label_printer_id && document_printer_id == o.document_printer_id && return_shipping_rule_id == o.return_shipping_rule_id && auto_create_return_shipment == o.auto_create_return_shipment end |
#eql?(o) ⇒ Boolean
592 593 594 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 592 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
598 599 600 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 598 def hash [name, description, direction, carrier_id, product_id, services, additional_parameters, address_id, receiving_countries, email_notification, phone_notification, min_weight, max_weight, min_order_value, max_order_value, conditions, generate_proforma_invoice, generate_commercial_invoice, generate_packing_list, auto_print_labels, auto_print_documents, label_printer_id, document_printer_id, return_shipping_rule_id, auto_create_return_shipment].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 359 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 @name.to_s.length < 1 invalid_properties.push('invalid value for "name", the character length must be greater than or equal to 1.') end if @carrier_id.nil? invalid_properties.push('invalid value for "carrier_id", carrier_id cannot be nil.') end if @product_id.nil? invalid_properties.push('invalid value for "product_id", product_id cannot be nil.') end if @services.nil? invalid_properties.push('invalid value for "services", services cannot be nil.') end if @address_id.nil? invalid_properties.push('invalid value for "address_id", address_id cannot be nil.') end if @receiving_countries.nil? invalid_properties.push('invalid value for "receiving_countries", receiving_countries cannot be nil.') end if !@min_weight.nil? && @min_weight < 0 invalid_properties.push('invalid value for "min_weight", must be greater than or equal to 0.') end if !@max_weight.nil? && @max_weight < 0 invalid_properties.push('invalid value for "max_weight", must be greater than or equal to 0.') end if !@min_order_value.nil? && @min_order_value < 0 invalid_properties.push('invalid value for "min_order_value", must be greater than or equal to 0.') end if !@max_order_value.nil? && @max_order_value < 0 invalid_properties.push('invalid value for "max_order_value", must be greater than or equal to 0.') end if @conditions.nil? invalid_properties.push('invalid value for "conditions", conditions cannot be nil.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
627 628 629 630 631 632 633 634 635 636 637 638 639 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 627 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
415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 |
# File 'lib/zippendo/models/create_shipping_rule_request.rb', line 415 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @name.nil? return false if @name.to_s.length < 1 direction_validator = EnumAttributeValidator.new('String', ["outbound", "inbound"]) return false unless direction_validator.valid?(@direction) return false if @carrier_id.nil? return false if @product_id.nil? return false if @services.nil? return false if @address_id.nil? return false if @receiving_countries.nil? return false if !@min_weight.nil? && @min_weight < 0 return false if !@max_weight.nil? && @max_weight < 0 return false if !@min_order_value.nil? && @min_order_value < 0 return false if !@max_order_value.nil? && @max_order_value < 0 return false if @conditions.nil? true end |