Class: PayPal::SDK::Subscriptions::RequestAPIBase
- Inherits:
-
Core::API::DataTypes::Base
- Object
- Core::API::DataTypes::Base
- PayPal::SDK::Subscriptions::RequestAPIBase
- Includes:
- RequestDataType
- Defined in:
- lib/paypal-sdk/subscriptions/request_base.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#error ⇒ Object
Returns the value of attribute error.
- #header ⇒ Object
- #request_id ⇒ Object
Class Method Summary collapse
Instance Method Summary collapse
Methods included from RequestDataType
Instance Attribute Details
#error ⇒ Object
Returns the value of attribute error.
25 26 27 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 25 def error @error end |
#header ⇒ Object
28 29 30 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 28 def header @header ||= {} end |
#request_id ⇒ Object
32 33 34 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 32 def request_id @request_id ||= SecureRandom.uuid end |
Class Method Details
.raise_on_api_error(*methods) ⇒ Object
53 54 55 56 57 58 59 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 53 def self.raise_on_api_error(*methods) methods.each do |symbol| define_method("#{symbol}!") {|*arg| raise_error! unless send(symbol, *arg) } end end |
Instance Method Details
#http_header ⇒ Object
36 37 38 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 36 def http_header { "PayPal-Request-Id" => request_id.to_s }.merge(header) end |
#merge!(values) ⇒ Object
44 45 46 47 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 44 def merge!(values) @error = nil super end |
#raise_error! ⇒ Object
49 50 51 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 49 def raise_error! raise UnsuccessfulApiCall, error if error end |
#success? ⇒ Boolean
40 41 42 |
# File 'lib/paypal-sdk/subscriptions/request_base.rb', line 40 def success? @error.nil? end |