Class: Braintree::PayPalPurchaseUnitInput
- Inherits:
-
Object
- Object
- Braintree::PayPalPurchaseUnitInput
- Includes:
- BaseModule
- Defined in:
- lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb
Instance Attribute Summary collapse
-
#amount ⇒ Object
readonly
Returns the value of attribute amount.
-
#attrs ⇒ Object
readonly
Returns the value of attribute attrs.
-
#payee ⇒ Object
readonly
Returns the value of attribute payee.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ PayPalPurchaseUnitInput
constructor
A new instance of PayPalPurchaseUnitInput.
- #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) ⇒ PayPalPurchaseUnitInput
Returns a new instance of PayPalPurchaseUnitInput.
11 12 13 14 15 16 17 18 19 |
# File 'lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb', line 11 def initialize(attributes) @attrs = attributes.keys unless attributes[:amount] raise ArgumentError, "Expected hash to contain a :amount" end set_instance_variables_from_hash(attributes) @payee = attributes[:payee] ? PayPalPayeeInput.new(attributes[:payee]) : nil @amount = attributes[:amount] ? MonetaryAmountInput.new(attributes[:amount]) : nil end |
Instance Attribute Details
#amount ⇒ Object (readonly)
Returns the value of attribute amount.
8 9 10 |
# File 'lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb', line 8 def amount @amount end |
#attrs ⇒ Object (readonly)
Returns the value of attribute attrs.
7 8 9 |
# File 'lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb', line 7 def attrs @attrs end |
#payee ⇒ Object (readonly)
Returns the value of attribute payee.
9 10 11 |
# File 'lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb', line 9 def payee @payee end |
Instance Method Details
#inspect ⇒ Object
20 21 22 23 |
# File 'lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb', line 20 def inspect inspected_attributes = @attrs.map { |attr| "#{attr}:#{send(attr).inspect}" } "#<#{self.class} #{inspected_attributes.join(" ")}>" end |
#to_graphql_variables ⇒ Object
24 25 26 27 28 29 |
# File 'lib/braintree/graphql/inputs/paypal_purchase_unit_input.rb', line 24 def to_graphql_variables variables = {} variables["amount"] = amount.to_graphql_variables if amount variables["payee"] = payee.to_graphql_variables if payee variables end |