Class: PayPal::SDK::REST::DataTypes::WebProfile

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)

2440
2441
2442
2443
2444
# File 'lib/paypal-sdk/rest/data_types.rb', line 2440

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

.get_list(options = {}) ⇒ Object


2446
2447
2448
2449
2450
2451
2452
2453
2454
2455
2456
2457
# File 'lib/paypal-sdk/rest/data_types.rb', line 2446

def get_list(options = {})
  path = "v1/payment-experience/web-profiles/"
  l = api.get(path, options)
  # The API is inconsistent in that it returns an array of WebProfiles
  # instead of a JSON object with a property which should be a list
  # of WebProfiles.
  #
  # Note that the WebProfileList is technically incorrect. It should
  # be a WebProfile.new() here, but due to backwards-compatibility,
  # may need to leave it as WebProfileList.
  l.map { |x| WebProfileList.new(x) }
end

.load_membersObject


2397
2398
2399
2400
2401
2402
2403
2404
# File 'lib/paypal-sdk/rest/data_types.rb', line 2397

def self.load_members
  object_of :id, String
  object_of :name, String
  object_of :temporary, Boolean
  object_of :flow_config, FlowConfig
  object_of :input_fields, InputFields
  object_of :presentation, Presentation
end

Instance Method Details

#createObject


2408
2409
2410
2411
2412
2413
# File 'lib/paypal-sdk/rest/data_types.rb', line 2408

def create()
  path = "v1/payment-experience/web-profiles/"
  response = api.post(path, self.to_hash, http_header)
  self.merge!(response)
  WebProfile.new(response)
end

#deleteObject


2430
2431
2432
2433
2434
2435
# File 'lib/paypal-sdk/rest/data_types.rb', line 2430

def delete()
  path = "v1/payment-experience/web-profiles/#{self.id}"
  response = api.delete(path, {})
  self.merge!(response)
  success?
end

#partial_update(patch_request) ⇒ Object


2422
2423
2424
2425
2426
2427
2428
# File 'lib/paypal-sdk/rest/data_types.rb', line 2422

def partial_update(patch_request)
  patch_request = PatchRequest.new(patch_request) unless patch_request.is_a? PatchRequest
  path = "v1/payment-experience/web-profiles/#{self.id}"
  response = api.patch(path, patch_request.to_hash, http_header)
  self.merge!(response)
  success?
end

#updateObject


2415
2416
2417
2418
2419
2420
# File 'lib/paypal-sdk/rest/data_types.rb', line 2415

def update()
  path = "v1/payment-experience/web-profiles/#{self.id}"
  response = api.put(path, self.to_hash, http_header)
  self.merge!(response)
  success?
end