Class: Braintree::PhoneInput

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

Returns a new instance of PhoneInput.



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

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/phone_input.rb', line 7

def attrs
  @attrs
end

#country_phone_codeObject (readonly)

Returns the value of attribute country_phone_code.



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

def country_phone_code
  @country_phone_code
end

#extension_numberObject (readonly)

Returns the value of attribute extension_number.



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

def extension_number
  @extension_number
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



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

def phone_number
  @phone_number
end

Instance Method Details

#inspectObject



17
18
19
20
# File 'lib/braintree/graphql/inputs/phone_input.rb', line 17

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

#to_graphql_variablesObject



22
23
24
25
26
27
28
# File 'lib/braintree/graphql/inputs/phone_input.rb', line 22

def to_graphql_variables
    variables = {}
    variables["countryPhoneCode"] = country_phone_code if country_phone_code
    variables["phoneNumber"] = phone_number if phone_number
    variables["extensionNumber"] = extension_number if extension_number
    variables
end