Class: PaypalServerSdk::LinkDescription

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/link_description.rb

Overview

The request-related [HATEOAS link](developer.paypal.com/api/rest/responses/#hateoas-links) information., The request-related [HATEOAS link](/api/rest/responses/#hateoas-links) information., The request-related [HATEOAS link](developer.paypal.com/api/rest/responses/#hateoas-links) information.

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:, rel:, method: SKIP) ⇒ LinkDescription

Returns a new instance of LinkDescription.



59
60
61
62
63
# File 'lib/paypal_server_sdk/models/link_description.rb', line 59

def initialize(href:, rel:, method: SKIP)
  @href = href
  @rel = rel
  @method = method unless method == SKIP
end

Instance Attribute Details

#hrefString

The complete target URL. To make the related call, combine the method with this [URI Template-formatted](tools.ietf.org/html/rfc6570) link. For pre-processing, include the ‘$`, `(`, and `)` characters. The `href` is the key HATEOAS component that links a completed call with a subsequent call.

Returns:

  • (String)


24
25
26
# File 'lib/paypal_server_sdk/models/link_description.rb', line 24

def href
  @href
end

#methodLinkHttpMethod

The HTTP method required to make the related call.

Returns:



36
37
38
# File 'lib/paypal_server_sdk/models/link_description.rb', line 36

def method
  @method
end

#relString

The [link relation type](tools.ietf.org/html/rfc5988#section-4), which serves as an ID for a link that unambiguously describes the semantics of the link. See [Link Relations](www.iana.org/assignments/link-relations/link-relations. xhtml).

Returns:

  • (String)


32
33
34
# File 'lib/paypal_server_sdk/models/link_description.rb', line 32

def rel
  @rel
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
# File 'lib/paypal_server_sdk/models/link_description.rb', line 66

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  href = hash.key?('href') ? hash['href'] : nil
  rel = hash.key?('rel') ? hash['rel'] : nil
  method = hash.key?('method') ? hash['method'] : SKIP

  # Create object from extracted values.
  LinkDescription.new(href: href,
                      rel: rel,
                      method: method)
end

.namesObject

A mapping from model property names to API property names.



39
40
41
42
43
44
45
# File 'lib/paypal_server_sdk/models/link_description.rb', line 39

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

.nullablesObject

An array for nullable fields



55
56
57
# File 'lib/paypal_server_sdk/models/link_description.rb', line 55

def self.nullables
  []
end

.optionalsObject

An array for optional fields



48
49
50
51
52
# File 'lib/paypal_server_sdk/models/link_description.rb', line 48

def self.optionals
  %w[
    method
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



87
88
89
90
# File 'lib/paypal_server_sdk/models/link_description.rb', line 87

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

#to_sObject

Provides a human-readable string representation of the object.



81
82
83
84
# File 'lib/paypal_server_sdk/models/link_description.rb', line 81

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