Class: PaypalServerSdk::LinkDescription

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

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#to_hash, #to_json

Constructor Details

#initialize(href:, rel:, method: SKIP) ⇒ LinkDescription

Returns a new instance of LinkDescription.



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

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)


19
20
21
# File 'lib/paypal_server_sdk/models/link_description.rb', line 19

def href
  @href
end

#methodLinkHttpMethod

The HTTP method required to make the related call.

Returns:



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

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)


27
28
29
# File 'lib/paypal_server_sdk/models/link_description.rb', line 27

def rel
  @rel
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/paypal_server_sdk/models/link_description.rb', line 61

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.



34
35
36
37
38
39
40
# File 'lib/paypal_server_sdk/models/link_description.rb', line 34

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



43
44
45
46
47
# File 'lib/paypal_server_sdk/models/link_description.rb', line 43

def self.optionals
  %w[
    method
  ]
end