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.



14
15
16
17
# File 'lib/braintree/graphql/inputs/phone_input.rb', line 14

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

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



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

def attrs
  @attrs
end

#country_phone_codeObject (readonly)

Returns the value of attribute country_phone_code.



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

def country_phone_code
  @country_phone_code
end

#extension_numberObject (readonly)

Returns the value of attribute extension_number.



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

def extension_number
  @extension_number
end

#phone_numberObject (readonly)

Returns the value of attribute phone_number.



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

def phone_number
  @phone_number
end

Instance Method Details

#inspectObject



19
20
21
22
# File 'lib/braintree/graphql/inputs/phone_input.rb', line 19

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

#to_graphql_variablesObject



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

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