Class: Braintree::MonetaryAmountInput

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

Returns a new instance of MonetaryAmountInput.



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

def initialize(attributes)
    @attrs = attributes.keys
    set_instance_variables_from_hash(attributes)
end

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



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

def attrs
  @attrs
end

#currency_codeObject (readonly)

Returns the value of attribute currency_code.



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

def currency_code
  @currency_code
end

#valueObject (readonly)

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#inspectObject



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

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

#to_graphql_variablesObject



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

def to_graphql_variables
    variables = {}
    variables["value"] = value if value
    variables["currencyCode"] = currency_code if currency_code
    variables
end