Class: VisaAcceptanceMergedSpec::DefaultShippingAddress1

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb

Overview

DefaultShippingAddress1 Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(links: SKIP, id: SKIP, default: SKIP, ship_to: SKIP, metadata: SKIP, additional_properties: nil) ⇒ DefaultShippingAddress1

Returns a new instance of DefaultShippingAddress1.



68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 68

def initialize(links: SKIP, id: SKIP, default: SKIP, ship_to: SKIP,
               metadata: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @links = links unless links == SKIP
  @id = id unless id == SKIP
  @default = default unless default == SKIP
  @ship_to = ship_to unless ship_to == SKIP
  @metadata =  unless  == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#defaultTrueClass | FalseClass

Flag that indicates whether customer shipping address is the dafault. Possible Values:

  • true: Shipping Address is customer's default.
  • false: Shipping Address is not customer's default.

Returns:

  • (TrueClass | FalseClass)


25
26
27
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 25

def default
  @default
end

#idString

The Id of the Shipping Address Token.

Returns:

  • (String)


18
19
20
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 18

def id
  @id
end

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 14

def links
  @links
end

#metadataMetadata4

Flag that indicates whether customer shipping address is the dafault. Possible Values:

  • true: Shipping Address is customer's default.
  • false: Shipping Address is not customer's default.

Returns:



39
40
41
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 39

def 
  @metadata
end

#ship_toShipTo14

Flag that indicates whether customer shipping address is the dafault. Possible Values:

  • true: Shipping Address is customer's default.
  • false: Shipping Address is not customer's default.

Returns:



32
33
34
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 32

def ship_to
  @ship_to
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 82

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  links = Links27.from_hash(hash['_links']) if hash['_links']
  id = hash.key?('id') ? hash['id'] : SKIP
  default = hash.key?('default') ? hash['default'] : SKIP
  ship_to = ShipTo14.from_hash(hash['shipTo']) if hash['shipTo']
   = Metadata4.from_hash(hash['metadata']) if hash['metadata']

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  DefaultShippingAddress1.new(links: links,
                              id: id,
                              default: default,
                              ship_to: ship_to,
                              metadata: ,
                              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['links'] = '_links'
  @_hash['id'] = 'id'
  @_hash['default'] = 'default'
  @_hash['ship_to'] = 'shipTo'
  @_hash['metadata'] = 'metadata'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 64

def self.nullables
  []
end

.optionalsObject

An array for optional fields



53
54
55
56
57
58
59
60
61
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 53

def self.optionals
  %w[
    links
    id
    default
    ship_to
    metadata
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



116
117
118
119
120
121
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 116

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links.inspect}, id: #{@id.inspect}, default: #{@default.inspect},"\
  " ship_to: #{@ship_to.inspect}, metadata: #{@metadata.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



109
110
111
112
113
# File 'lib/visa_acceptance_merged_spec/models/default_shipping_address1.rb', line 109

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} links: #{@links}, id: #{@id}, default: #{@default}, ship_to: #{@ship_to},"\
  " metadata: #{@metadata}, additional_properties: #{@additional_properties}>"
end