Class: PayPal::SDK::REST::DataTypes::Authorization

Inherits:
Base show all
Includes:
RequestDataType
Defined in:
lib/paypal-sdk/rest/data_types.rb

Constant Summary

Constants inherited from Core::API::DataTypes::Base

Core::API::DataTypes::Base::ContentKey, Core::API::DataTypes::Base::HashOptions

Instance Attribute Summary

Attributes inherited from Base

#error, #header, #request_id

Class Method Summary collapse

Instance Method Summary collapse

Methods included from RequestDataType

#api, api, #error=, included

Methods included from SetAPI

#client_id=, #client_secret=, #set_config, #token=

Methods inherited from Base

#http_header, #merge!, #raise_error!, raise_on_api_error, #success?

Methods inherited from Core::API::DataTypes::Base

add_attribute, add_member, array_of, #convert_array, #convert_object, define_alias_methods, #hash_key, #initialize, #member_names, members, #members, #merge!, object_of, #set, #skip_value?, snakecase, #to_hash, #value_to_hash

Methods included from Core::Logging

#log_event, #logger, logger, logger=

Constructor Details

This class inherits a constructor from PayPal::SDK::Core::API::DataTypes::Base

Class Method Details

.find(resource_id) ⇒ Object

Raises:

  • (ArgumentError)


871
872
873
874
875
# File 'lib/paypal-sdk/rest/data_types.rb', line 871

def find(resource_id)
  raise ArgumentError.new("id required") if resource_id.to_s.strip.empty?
  path = "v1/payments/authorization/#{resource_id}"
  self.new(api.get(path))
end

.load_membersObject



850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
# File 'lib/paypal-sdk/rest/data_types.rb', line 850

def self.load_members
  object_of :id, String
  object_of :amount, Amount
  object_of :payment_mode, String
  object_of :state, String
  object_of :reason_code, String
  object_of :protection_eligibility, String
  object_of :protection_eligibility_type, String
  object_of :fmf_details, FmfDetails
  object_of :parent_payment, String
  object_of :valid_until, String
  object_of :create_time, String
  object_of :update_time, String
  object_of :reference_id, String
  object_of :receipt_id, String
  array_of  :links, Links
end

Instance Method Details

#capture(capture) ⇒ Object



878
879
880
881
882
883
# File 'lib/paypal-sdk/rest/data_types.rb', line 878

def capture(capture)
  capture = Capture.new(capture) unless capture.is_a? Capture
  path = "v1/payments/authorization/#{self.id}/capture"
  response = api.post(path, capture.to_hash, http_header)
  Capture.new(response)
end

#reauthorizeObject



892
893
894
895
896
897
# File 'lib/paypal-sdk/rest/data_types.rb', line 892

def reauthorize()
  path = "v1/payments/authorization/#{self.id}/reauthorize"
  response = api.post(path, self.to_hash, http_header)
  self.merge!(response)
  success?
end

#voidObject



885
886
887
888
889
890
# File 'lib/paypal-sdk/rest/data_types.rb', line 885

def void()
  path = "v1/payments/authorization/#{self.id}/void"
  response = api.post(path, {}, http_header)
  self.merge!(response)
  success?
end