Class: VisaAcceptanceMergedSpec::Service

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

Overview

Service 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(category_code: SKIP, sub_category_code: SKIP, additional_properties: nil) ⇒ Service

Returns a new instance of Service.



55
56
57
58
59
60
61
62
63
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 55

def initialize(category_code: SKIP, sub_category_code: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @category_code = category_code unless category_code == SKIP
  @sub_category_code = sub_category_code unless sub_category_code == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#category_codeString

Category code for the ancillary service that is provided. Obtain the codes from the International Air Transport Association (IATA). Note # is either 0, 1, 2, or 3. Important This field is required in the U.S. in order for you to qualify for either the custom payment service (CPS) or the electronic interchange reimbursement fee (EIRF)program. Format: English characters only. Optional request field for ancillary services.

Returns:

  • (String)


23
24
25
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 23

def category_code
  @category_code
end

#sub_category_codeString

Subcategory code for the ancillary service category. Obtain the codes from the International Air Transport Association (IATA). Note # is either 0, 1, 2, or 3. Format English characters only. Optional request field for ancillary services.

Returns:

  • (String)


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

def sub_category_code
  @sub_category_code
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  category_code = hash.key?('categoryCode') ? hash['categoryCode'] : SKIP
  sub_category_code =
    hash.key?('subCategoryCode') ? hash['subCategoryCode'] : 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.
  Service.new(category_code: category_code,
              sub_category_code: sub_category_code,
              additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



35
36
37
38
39
40
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 35

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['category_code'] = 'categoryCode'
  @_hash['sub_category_code'] = 'subCategoryCode'
  @_hash
end

.nullablesObject

An array for nullable fields



51
52
53
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 51

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
48
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 43

def self.optionals
  %w[
    category_code
    sub_category_code
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



95
96
97
98
99
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 95

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} category_code: #{@category_code.inspect}, sub_category_code:"\
  " #{@sub_category_code.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



88
89
90
91
92
# File 'lib/visa_acceptance_merged_spec/models/service.rb', line 88

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} category_code: #{@category_code}, sub_category_code: #{@sub_category_code},"\
  " additional_properties: #{@additional_properties}>"
end