Class: FdxV660Api::HateoasLink4

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/fdx_v660_api/models/hateoas_link4.rb

Overview

General HATEOAS link for this API, specifying supported action (GET, POST, etc) and contentTypes (application/json, image/png, etc), but without any path parameter values

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(href:, action: SKIP, rel: SKIP, types: SKIP, additional_properties: nil) ⇒ HateoasLink4

Returns a new instance of HateoasLink4.



86
87
88
89
90
91
92
93
94
95
96
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 86

def initialize(href:, action: SKIP, rel: SKIP, types: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @href = href
  @action = action unless action == SKIP
  @rel = rel unless rel == SKIP
  @types = types unless types == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#actionHttpActionType2

HTTP Method to use for the request

Returns:



20
21
22
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 20

def action
  @action
end

#hrefString

URL to invoke the action on the resource

Returns:

  • (String)


16
17
18
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 16

def href
  @href
end

#relString

Relation of this link to its containing entity, as defined by IETF RFC5988 with many relation values specified in its Section 6.2.2, for example:

* `self` - Link to the current resource latest state or with more detail
* `prev` - Previous page in a paginated result set
* `next` - Subsequent page in a paginated result set
* `first` - First page in a paginated result set
* `last` - Last page in a paginated result set
* `related` - Link to a related resource, like a Transaction's

referenceTransactionId

  • up - Link to a related 'parent' resource, like a child account's parent account
  • payment - Link to a payment-scheduling endpoint Specific to FDX, rel values can contain a data cluster or space-delimited list of data clusters which link to the referenced data type(s), for example:
  • ACCOUNT_DETAILED - Link to the account's details via /accounts/{accountId}
  • PAYMENT_SUPPORT - Link to the account's ID and bank ID for payments or transfers via /accounts/{accountId}/payment-networks
  • CUSTOMER_CONTACT - Link to the account's customer contact details via /accounts/{accountId}/contact
  • TRANSACTIONS - Link to the account's transactions list via /accounts/{accountId}/transactions
  • REWARDS - Link to the account's reward program via /reward-programs/{rewardProgramId}
  • TRANSACTIONS REWARDS - Specific link to the account's transaction rewards via /accounts/{accountId}/reward-transactions
  • STATEMENTS - Link to the account's statements list via /accounts/{accountId}/statements
  • IMAGES - Link to the transaction's images list via /accounts/{accountId}/transaction-images/{imageId}

Returns:

  • (String)


56
57
58
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 56

def rel
  @rel
end

#typesArray[ContentTypes]

Content-types that can be used in the Accept header

Returns:



60
61
62
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 60

def types
  @types
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 99

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  href = hash.key?('href') ? hash['href'] : nil
  action = hash.key?('action') ? hash['action'] : SKIP
  rel = hash.key?('rel') ? hash['rel'] : SKIP
  types = hash.key?('types') ? hash['types'] : 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.
  HateoasLink4.new(href: href,
                   action: action,
                   rel: rel,
                   types: types,
                   additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



63
64
65
66
67
68
69
70
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 63

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['href'] = 'href'
  @_hash['action'] = 'action'
  @_hash['rel'] = 'rel'
  @_hash['types'] = 'types'
  @_hash
end

.nullablesObject

An array for nullable fields



82
83
84
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 82

def self.nullables
  []
end

.optionalsObject

An array for optional fields



73
74
75
76
77
78
79
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 73

def self.optionals
  %w[
    action
    rel
    types
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 131

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

#to_sObject

Provides a human-readable string representation of the object.



124
125
126
127
128
# File 'lib/fdx_v660_api/models/hateoas_link4.rb', line 124

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