Class: Braintree::BillingAddressInput

Inherits:
Object
  • Object
show all
Includes:
BaseModule
Defined in:
lib/braintree/graphql/inputs/billing_address_input.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from BaseModule

included

Methods included from Braintree::BaseModule::Methods

#copy_instance_variables_from_object, #return_object_or_raise, #set_instance_variables_from_hash, #singleton_class

Constructor Details

#initialize(attributes) ⇒ BillingAddressInput

Returns a new instance of BillingAddressInput.



13
14
15
16
# File 'lib/braintree/graphql/inputs/billing_address_input.rb', line 13

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

Instance Attribute Details

#attrsObject (readonly)

Returns the value of attribute attrs.



5
6
7
# File 'lib/braintree/graphql/inputs/billing_address_input.rb', line 5

def attrs
  @attrs
end

#country_code_alpha2Object (readonly)

Returns the value of attribute country_code_alpha2.



6
7
8
# File 'lib/braintree/graphql/inputs/billing_address_input.rb', line 6

def country_code_alpha2
  @country_code_alpha2
end

#extended_addressObject (readonly)

Returns the value of attribute extended_address.



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

def extended_address
  @extended_address
end

#localityObject (readonly)

Returns the value of attribute locality.



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

def locality
  @locality
end

#postal_codeObject (readonly)

Returns the value of attribute postal_code.



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

def postal_code
  @postal_code
end

#regionObject (readonly)

Returns the value of attribute region.



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

def region
  @region
end

#street_addressObject (readonly)

Returns the value of attribute street_address.



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

def street_address
  @street_address
end

Instance Method Details

#inspectObject



18
19
20
21
# File 'lib/braintree/graphql/inputs/billing_address_input.rb', line 18

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

#to_graphql_variablesObject



23
24
25
26
27
28
29
30
31
32
# File 'lib/braintree/graphql/inputs/billing_address_input.rb', line 23

def to_graphql_variables
  {
    "countryCode" => country_code_alpha2,
    "extendedAddress" => extended_address,
    "locality" => locality,
    "postalCode" => postal_code,
    "region" => region,
    "streetAddress" => street_address
  }.compact
end