Module: PayPal::SDK::REST::RequestDataType

Class Method Summary collapse

Instance Method Summary collapse

Methods included from SetAPI

client_id=, client_secret=, set_config, token=

Class Method Details

.apiObject

Global API object

Example

RequestDataType.api


24
25
26
# File 'lib/paypal-sdk/rest/request_data_type.rb', line 24

def api
  @api ||= API.new
end

.included(klass) ⇒ Object

Configure depended module, when RequestDataType is include.

Example

class Payment < DataTypes
  include RequestDataType
end
Payment.set_config(..)
payment.set_config(..)
Payment.api
payment.api


42
43
44
45
46
47
48
# File 'lib/paypal-sdk/rest/request_data_type.rb', line 42

def included(klass)
  klass.class_eval do
    extend GetAPI
    extend SetAPI
    include SetAPI
  end
end

Instance Method Details

#apiObject

Get a local API object or Class level API object



6
7
8
# File 'lib/paypal-sdk/rest/request_data_type.rb', line 6

def api
  @api || self.class.api
end

#error=(hash) ⇒ Object

Convert Hash object to ErrorHash object



11
12
13
14
15
16
17
18
# File 'lib/paypal-sdk/rest/request_data_type.rb', line 11

def error=(hash)
  @error =
    if hash.is_a? Hash
      ErrorHash.convert(hash)
    else
      hash
    end
end