Class: PaypalServerSdk::MobileWebContext

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

Overview

Buyer’s mobile web browser context to app switch to the PayPal consumer app.

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(return_flow: MobileReturnFlow::AUTO, buyer_user_agent: SKIP) ⇒ MobileWebContext

Returns a new instance of MobileWebContext.



44
45
46
47
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 44

def initialize(return_flow: MobileReturnFlow::AUTO, buyer_user_agent: SKIP)
  @return_flow = return_flow unless return_flow == SKIP
  @buyer_user_agent = buyer_user_agent unless buyer_user_agent == SKIP
end

Instance Attribute Details

#buyer_user_agentString

User agent from the request originating from the buyer’s device. This will be used to identify the buyer’s operating system and browser versions. NOTE: Merchants must not alter or modify the buyer’s device user agent.

Returns:

  • (String)


21
22
23
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 21

def buyer_user_agent
  @buyer_user_agent
end

#return_flowMobileReturnFlow

Merchant preference on how the buyer can navigate back to merchant website post approving the transaction on the PayPal App.

Returns:



15
16
17
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 15

def return_flow
  @return_flow
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  return_flow = hash['return_flow'] ||= MobileReturnFlow::AUTO
  buyer_user_agent =
    hash.key?('buyer_user_agent') ? hash['buyer_user_agent'] : SKIP

  # Create object from extracted values.
  MobileWebContext.new(return_flow: return_flow,
                       buyer_user_agent: buyer_user_agent)
end

.namesObject

A mapping from model property names to API property names.



24
25
26
27
28
29
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 24

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

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 40

def self.nullables
  []
end

.optionalsObject

An array for optional fields



32
33
34
35
36
37
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 32

def self.optionals
  %w[
    return_flow
    buyer_user_agent
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



70
71
72
73
74
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 70

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

#to_sObject

Provides a human-readable string representation of the object.



64
65
66
67
# File 'lib/paypal_server_sdk/models/mobile_web_context.rb', line 64

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