Class: Braintree::CreateCustomerSessionInput
- Inherits:
-
Object
- Object
- Braintree::CreateCustomerSessionInput
- Includes:
- BaseModule
- Defined in:
- lib/braintree/graphql/inputs/create_customer_session_input.rb
Instance Attribute Summary collapse
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#customer ⇒ Object
readonly
Returns the value of attribute customer.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#merchant_account_id ⇒ Object
readonly
Returns the value of attribute merchant_account_id.
-
#purchase_units ⇒ Object
readonly
Returns the value of attribute purchase_units.
-
#session_id ⇒ Object
readonly
Returns the value of attribute session_id.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ CreateCustomerSessionInput
constructor
A new instance of CreateCustomerSessionInput.
- #inspect ⇒ Object
- #to_graphql_variables ⇒ Object
Methods included from BaseModule
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) ⇒ CreateCustomerSessionInput
Returns a new instance of CreateCustomerSessionInput.
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 16 def initialize(attributes) @attrs = attributes.keys set_instance_variables_from_hash(attributes) @customer = attributes[:customer] ? CustomerSessionInput.new(attributes[:customer]) : nil if attributes[:purchase_units] @purchase_units = attributes[:purchase_units].map do |unit| PayPalPurchaseUnitInput.new(unit) end end end |
Instance Attribute Details
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
9 10 11 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 9 def attrs @attrs end |
#customer ⇒ Object (readonly)
Returns the value of attribute customer.
12 13 14 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 12 def customer @customer end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
13 14 15 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 13 def domain @domain end |
#merchant_account_id ⇒ Object (readonly)
Returns the value of attribute merchant_account_id.
10 11 12 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 10 def merchant_account_id @merchant_account_id end |
#purchase_units ⇒ Object (readonly)
Returns the value of attribute purchase_units.
14 15 16 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 14 def purchase_units @purchase_units end |
#session_id ⇒ Object (readonly)
Returns the value of attribute session_id.
11 12 13 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 11 def session_id @session_id end |
Instance Method Details
#inspect ⇒ Object
27 28 29 30 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 27 def inspect inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" } "#<#{self.class} #{inspected_attributes.join(" ")}>" end |
#to_graphql_variables ⇒ Object
32 33 34 35 36 37 38 39 40 |
# File 'lib/braintree/graphql/inputs/create_customer_session_input.rb', line 32 def to_graphql_variables variables = {} variables["merchantAccountId"] = merchant_account_id if merchant_account_id variables["sessionId"] = session_id if session_id variables["domain"] = domain if domain variables["customer"] = customer.to_graphql_variables if customer variables["purchaseUnits"] = purchase_units.map(&:to_graphql_variables) if purchase_units variables end |