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)


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

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



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

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



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

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



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

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



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

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

#partial_update(patch_request) ⇒ Object



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

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



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

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