Class: ThePlaidApi::HateoasLink
- Defined in:
- lib/the_plaid_api/models/hateoas_link.rb
Overview
REST application constraint (Hypermedia As The Engine Of Application State)
Instance Attribute Summary collapse
-
#action ⇒ FdxHateoasLinkAction
HTTP Method to use for the request.
-
#href ⇒ String
URL to invoke the action on the resource.
-
#rel ⇒ String
Relation of this link to its containing entity, as defined by and with many example relation values at [IETF RFC5988](datatracker.ietf.org/doc/html/rfc5988).
-
#types ⇒ Array[ContentTypes]
Content-types that can be used in the Accept header.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(href:, action: SKIP, rel: SKIP, types: SKIP, additional_properties: nil) ⇒ HateoasLink
constructor
A new instance of HateoasLink.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
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) ⇒ HateoasLink
Returns a new instance of HateoasLink.
54 55 56 57 58 59 60 61 62 63 64 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 54 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
#action ⇒ FdxHateoasLinkAction
HTTP Method to use for the request
18 19 20 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 18 def action @action end |
#href ⇒ String
URL to invoke the action on the resource
14 15 16 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 14 def href @href end |
#rel ⇒ String
Relation of this link to its containing entity, as defined by and with many example relation values at [IETF RFC5988](datatracker.ietf.org/doc/html/rfc5988)
24 25 26 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 24 def rel @rel end |
#types ⇒ Array[ContentTypes]
Content-types that can be used in the Accept header
28 29 30 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 28 def types @types end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 67 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. HateoasLink.new(href: href, action: action, rel: rel, types: types, additional_properties: additional_properties) end |
.names ⇒ Object
A mapping from model property names to API property names.
31 32 33 34 35 36 37 38 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 31 def self.names @_hash = {} if @_hash.nil? @_hash['href'] = 'href' @_hash['action'] = 'action' @_hash['rel'] = 'rel' @_hash['types'] = 'types' @_hash end |
.nullables ⇒ Object
An array for nullable fields
50 51 52 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 50 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
41 42 43 44 45 46 47 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 41 def self.optionals %w[ action rel types ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
99 100 101 102 103 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 99 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_s ⇒ Object
Provides a human-readable string representation of the object.
92 93 94 95 96 |
# File 'lib/the_plaid_api/models/hateoas_link.rb', line 92 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 |