Class: PaypalServerSdk::SellerProtection

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/paypal_server_sdk/models/seller_protection.rb

Overview

The level of protection offered as defined by [PayPal Seller Protection for Merchants](www.paypal.com/us/webapps/mpp/security/seller-protection) .

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(status: SKIP, dispute_categories: SKIP) ⇒ SellerProtection

Returns a new instance of SellerProtection.



46
47
48
49
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 46

def initialize(status: SKIP, dispute_categories: SKIP)
  @status = status unless status == SKIP
  @dispute_categories = dispute_categories unless dispute_categories == SKIP
end

Instance Attribute Details

#dispute_categoriesArray[DisputeCategory]

An array of conditions that are covered for the transaction.

Returns:



23
24
25
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 23

def dispute_categories
  @dispute_categories
end

#statusSellerProtectionStatus

Indicates whether the transaction is eligible for seller protection. For information, see [PayPal Seller Protection for Merchants](www.paypal.com/us/webapps/mpp/security/seller-protectio n).



19
20
21
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 19

def status
  @status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
63
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 52

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('status') ? hash['status'] : SKIP
  dispute_categories =
    hash.key?('dispute_categories') ? hash['dispute_categories'] : SKIP

  # Create object from extracted values.
  SellerProtection.new(status: status,
                       dispute_categories: dispute_categories)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'status'
  @_hash['dispute_categories'] = 'dispute_categories'
  @_hash
end

.nullablesObject

An array for nullable fields



42
43
44
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 42

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
39
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 34

def self.optionals
  %w[
    status
    dispute_categories
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



72
73
74
75
76
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 72

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, dispute_categories:"\
  " #{@dispute_categories.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



66
67
68
69
# File 'lib/paypal_server_sdk/models/seller_protection.rb', line 66

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, dispute_categories: #{@dispute_categories}>"
end