Class: FdxV660Api::OperationEntity

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

Overview

Definition of a supported API for the /capability response object

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(id: SKIP, availability: SKIP, also_supported: SKIP, version: SKIP, fdx_versions: SKIP, content_types: SKIP, cut_off_time: SKIP, link: SKIP, additional_properties: nil) ⇒ OperationEntity

Returns a new instance of OperationEntity.



84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 84

def initialize(id: SKIP, availability: SKIP, also_supported: SKIP,
               version: SKIP, fdx_versions: SKIP, content_types: SKIP,
               cut_off_time: SKIP, link: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @id = id unless id == SKIP
  @availability = availability unless availability == SKIP
  @also_supported = also_supported unless also_supported == SKIP
  @version = version unless version == SKIP
  @fdx_versions = fdx_versions unless fdx_versions == SKIP
  @content_types = content_types unless content_types == SKIP
  @cut_off_time = cut_off_time unless cut_off_time == SKIP
  @link = link unless link == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#also_supportedArray[FdxResourceOperationId]

Additional FDX API endpoints supported at this API, e.g. Transactions within Accounts, or TxImages within Transactions

Returns:



24
25
26
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 24

def also_supported
  @also_supported
end

#availabilityAvailabilityEntity1

Whether and how this API is currently supported

Returns:



19
20
21
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 19

def availability
  @availability
end

#content_typesArray[ContentTypes]

HTTP response media types supported at this endpoint

Returns:



37
38
39
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 37

def content_types
  @content_types
end

#cut_off_timeDateTime

Cut off time for same-day execution of activity request submitted to this API. Alternatively, the as-of time when EOD account balances are typically set

Returns:

  • (DateTime)


43
44
45
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 43

def cut_off_time
  @cut_off_time
end

#fdx_versionsArray[FdxVersion]

FDX schema versions supported at this endpoint

Returns:



33
34
35
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 33

def fdx_versions
  @fdx_versions
end

#idFdxResourceOperationId1

Operation ID (e.g. name) of this API



15
16
17
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 15

def id
  @id
end

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

Returns:



49
50
51
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 49

def link
  @link
end

#versionString

Data provider's implementation version number for this operation, which is unrelated to the FDX API version

Returns:

  • (String)


29
30
31
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 29

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  id = hash.key?('id') ? hash['id'] : SKIP
  availability = AvailabilityEntity1.from_hash(hash['availability']) if hash['availability']
  also_supported = hash.key?('alsoSupported') ? hash['alsoSupported'] : SKIP
  version = hash.key?('version') ? hash['version'] : SKIP
  fdx_versions = hash.key?('fdxVersions') ? hash['fdxVersions'] : SKIP
  content_types = hash.key?('contentTypes') ? hash['contentTypes'] : SKIP
  cut_off_time = if hash.key?('cutOffTime')
                   (DateTimeHelper.from_rfc3339(hash['cutOffTime']) if hash['cutOffTime'])
                 else
                   SKIP
                 end
  link = HateoasLink4.from_hash(hash['link']) if hash['link']

  # 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.
  OperationEntity.new(id: id,
                      availability: availability,
                      also_supported: also_supported,
                      version: version,
                      fdx_versions: fdx_versions,
                      content_types: content_types,
                      cut_off_time: cut_off_time,
                      link: link,
                      additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 52

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['availability'] = 'availability'
  @_hash['also_supported'] = 'alsoSupported'
  @_hash['version'] = 'version'
  @_hash['fdx_versions'] = 'fdxVersions'
  @_hash['content_types'] = 'contentTypes'
  @_hash['cut_off_time'] = 'cutOffTime'
  @_hash['link'] = 'link'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 80

def self.nullables
  []
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 66

def self.optionals
  %w[
    id
    availability
    also_supported
    version
    fdx_versions
    content_types
    cut_off_time
    link
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



152
153
154
155
156
157
158
159
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 152

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, availability: #{@availability.inspect}, also_supported:"\
  " #{@also_supported.inspect}, version: #{@version.inspect}, fdx_versions:"\
  " #{@fdx_versions.inspect}, content_types: #{@content_types.inspect}, cut_off_time:"\
  " #{@cut_off_time.inspect}, link: #{@link.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_cut_off_timeObject



138
139
140
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 138

def to_custom_cut_off_time
  DateTimeHelper.to_rfc3339(cut_off_time)
end

#to_sObject

Provides a human-readable string representation of the object.



143
144
145
146
147
148
149
# File 'lib/fdx_v660_api/models/operation_entity.rb', line 143

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, availability: #{@availability}, also_supported:"\
  " #{@also_supported}, version: #{@version}, fdx_versions: #{@fdx_versions}, content_types:"\
  " #{@content_types}, cut_off_time: #{@cut_off_time}, link: #{@link}, additional_properties:"\
  " #{@additional_properties}>"
end