Class: PaypalServerSdk::AppSwitchContext

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

Overview

Merchant provided details of the native app or mobile web browser to facilitate buyer’s 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(native_app: SKIP, mobile_web: SKIP) ⇒ AppSwitchContext

Returns a new instance of AppSwitchContext.



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

def initialize(native_app: SKIP, mobile_web: SKIP)
  @native_app = native_app unless native_app == SKIP
  @mobile_web = mobile_web unless mobile_web == SKIP
end

Instance Attribute Details

#mobile_webMobileWebContext

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

Returns:



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

def mobile_web
  @mobile_web
end

#native_appNativeAppContext

Merchant provided, buyer’s native app preferences to app switch to the PayPal consumer app.

Returns:



16
17
18
# File 'lib/paypal_server_sdk/models/app_switch_context.rb', line 16

def native_app
  @native_app
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
# File 'lib/paypal_server_sdk/models/app_switch_context.rb', line 50

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  native_app = NativeAppContext.from_hash(hash['native_app']) if hash['native_app']
  mobile_web = MobileWebContext.from_hash(hash['mobile_web']) if hash['mobile_web']

  # Create object from extracted values.
  AppSwitchContext.new(native_app: native_app,
                       mobile_web: mobile_web)
end

.namesObject

A mapping from model property names to API property names.



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

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

.nullablesObject

An array for nullable fields



40
41
42
# File 'lib/paypal_server_sdk/models/app_switch_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/app_switch_context.rb', line 32

def self.optionals
  %w[
    native_app
    mobile_web
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



69
70
71
72
# File 'lib/paypal_server_sdk/models/app_switch_context.rb', line 69

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

#to_sObject

Provides a human-readable string representation of the object.



63
64
65
66
# File 'lib/paypal_server_sdk/models/app_switch_context.rb', line 63

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