Class: Braintree::CustomerSessionInput

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/graphql/inputs/customer_session_input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(attributes) ⇒ CustomerSessionInput

Returns a new instance of CustomerSessionInput.



15
16
17
18
19
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 15

def initialize(attributes)
    @attrs = attributes.keys
    set_instance_variables_from_hash(attributes)
    @phone = attributes[:phone] ? PhoneInput.new(attributes[:phone]) : nil
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



7
8
9
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 7

def attrs
  @attrs
end

#device_fingerprint_idObject (readonly)

Returns the value of attribute device_fingerprint_id.



10
11
12
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 10

def device_fingerprint_id
  @device_fingerprint_id
end

#emailObject (readonly)

Returns the value of attribute email.



8
9
10
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 8

def email
  @email
end

#paypal_app_installedObject (readonly)

Returns the value of attribute paypal_app_installed.



11
12
13
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 11

def paypal_app_installed
  @paypal_app_installed
end

#phoneObject (readonly)

Returns the value of attribute phone.



9
10
11
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 9

def phone
  @phone
end

#user_agentObject (readonly)

Returns the value of attribute user_agent.



13
14
15
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 13

def user_agent
  @user_agent
end

#venmo_app_installedObject (readonly)

Returns the value of attribute venmo_app_installed.



12
13
14
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 12

def venmo_app_installed
  @venmo_app_installed
end

Instance Method Details

#inspectObject



21
22
23
24
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 21

def inspect
    inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" }
    "#<#{self.class} #{inspected_attributes.join(" ")}>"
end

#to_graphql_variablesObject



26
27
28
29
30
31
32
33
34
35
# File 'lib/braintree/graphql/inputs/customer_session_input.rb', line 26

def to_graphql_variables
    variables = {}
    variables["email"] = email if email
    variables["phone"] = phone.to_graphql_variables if phone
    variables["deviceFingerprintId"] = device_fingerprint_id if device_fingerprint_id
    variables["paypalAppInstalled"] = paypal_app_installed if paypal_app_installed
    variables["venmoAppInstalled"] = venmo_app_installed if venmo_app_installed
    variables["userAgent"] = user_agent if user_agent
    variables
end