Class: Braintree::UpdateCustomerSessionInput

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/graphql/inputs/update_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) ⇒ UpdateCustomerSessionInput

Returns a new instance of UpdateCustomerSessionInput.



12
13
14
15
16
17
18
19
# File 'lib/braintree/graphql/inputs/update_customer_session_input.rb', line 12

def initialize(attributes)
    unless attributes[:session_id]
        raise ArgumentError, "Expected hash to contain a :session_id"
    end
    @attrs = attributes.keys
    set_instance_variables_from_hash(attributes)
    @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



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

def attrs
  @attrs
end

#customerObject (readonly)

Returns the value of attribute customer.



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

def customer
  @customer
end

#merchant_account_idObject (readonly)

Returns the value of attribute merchant_account_id.



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

def 
  @merchant_account_id
end

#session_idObject (readonly)

Returns the value of attribute session_id.



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

def session_id
  @session_id
end

Instance Method Details

#inspectObject



21
22
23
24
# File 'lib/braintree/graphql/inputs/update_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
# File 'lib/braintree/graphql/inputs/update_customer_session_input.rb', line 26

def to_graphql_variables
    variables = {}
    variables["merchantAccountId"] =  if 
    variables["sessionId"] = session_id if session_id
    variables["customer"] = customer.to_graphql_variables if customer
    variables
end