Class: VisaAcceptanceMergedSpec::TicketIssuer

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

Overview

TicketIssuer 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(code: SKIP, name: SKIP, address: SKIP, locality: SKIP, administrative_area: SKIP, postal_code: SKIP, country: SKIP, additional_properties: nil) ⇒ TicketIssuer

Returns a new instance of TicketIssuer.



79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 79

def initialize(code: SKIP, name: SKIP, address: SKIP, locality: SKIP,
               administrative_area: SKIP, postal_code: SKIP, country: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @code = code unless code == SKIP
  @name = name unless name == SKIP
  @address = address unless address == SKIP
  @locality = locality unless locality == SKIP
  @administrative_area = administrative_area unless administrative_area == SKIP
  @postal_code = postal_code unless postal_code == SKIP
  @country = country unless country == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#addressString

Address of the company issuing the ticket.

Returns:

  • (String)


26
27
28
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 26

def address
  @address
end

#administrative_areaString

State in which transaction occured.

Returns:

  • (String)


38
39
40
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 38

def administrative_area
  @administrative_area
end

#codeString

IATA2 airline code. Format: English characters only. Required for Mastercard; optional for all other card types.

Returns:

  • (String)


16
17
18
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 16

def code
  @code
end

#countryString

Country in which transaction occured.

Returns:

  • (String)


46
47
48
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 46

def country
  @country
end

#localityString

City in which the transaction occurred. If the name of the city exceeds 18 characters, use meaningful abbreviations. Format: English characters only. Optional request field.

Returns:

  • (String)


34
35
36
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 34

def locality
  @locality
end

#nameString

Name of the ticket issuer. If you do not include this field, Visa Acceptance uses the value for your merchant name that is in the Visa Acceptance merchant configuration database.

Returns:

  • (String)


22
23
24
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 22

def name
  @name
end

#postal_codeString

Zip code of the city in which transaction occured.

Returns:

  • (String)


42
43
44
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 42

def postal_code
  @postal_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 96

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  code = hash.key?('code') ? hash['code'] : SKIP
  name = hash.key?('name') ? hash['name'] : SKIP
  address = hash.key?('address') ? hash['address'] : SKIP
  locality = hash.key?('locality') ? hash['locality'] : SKIP
  administrative_area =
    hash.key?('administrativeArea') ? hash['administrativeArea'] : SKIP
  postal_code = hash.key?('postalCode') ? hash['postalCode'] : SKIP
  country = hash.key?('country') ? hash['country'] : SKIP

  # 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.
  TicketIssuer.new(code: code,
                   name: name,
                   address: address,
                   locality: locality,
                   administrative_area: administrative_area,
                   postal_code: postal_code,
                   country: country,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



49
50
51
52
53
54
55
56
57
58
59
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 49

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['code'] = 'code'
  @_hash['name'] = 'name'
  @_hash['address'] = 'address'
  @_hash['locality'] = 'locality'
  @_hash['administrative_area'] = 'administrativeArea'
  @_hash['postal_code'] = 'postalCode'
  @_hash['country'] = 'country'
  @_hash
end

.nullablesObject

An array for nullable fields



75
76
77
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 75

def self.nullables
  []
end

.optionalsObject

An array for optional fields



62
63
64
65
66
67
68
69
70
71
72
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 62

def self.optionals
  %w[
    code
    name
    address
    locality
    administrative_area
    postal_code
    country
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



136
137
138
139
140
141
142
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 136

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code.inspect}, name: #{@name.inspect}, address:"\
  " #{@address.inspect}, locality: #{@locality.inspect}, administrative_area:"\
  " #{@administrative_area.inspect}, postal_code: #{@postal_code.inspect}, country:"\
  " #{@country.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



128
129
130
131
132
133
# File 'lib/visa_acceptance_merged_spec/models/ticket_issuer.rb', line 128

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} code: #{@code}, name: #{@name}, address: #{@address}, locality:"\
  " #{@locality}, administrative_area: #{@administrative_area}, postal_code: #{@postal_code},"\
  " country: #{@country}, additional_properties: #{@additional_properties}>"
end