Class: Afterpay::Address
- Inherits:
-
Object
- Object
- Afterpay::Address
- Defined in:
- lib/afterpay/address.rb
Instance Attribute Summary collapse
-
#country ⇒ Object
Returns the value of attribute country.
-
#line_1 ⇒ Object
Returns the value of attribute line_1.
-
#line_2 ⇒ Object
Returns the value of attribute line_2.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone ⇒ Object
Returns the value of attribute phone.
-
#postcode ⇒ Object
Returns the value of attribute postcode.
-
#state ⇒ Object
Returns the value of attribute state.
-
#suburb ⇒ Object
Returns the value of attribute suburb.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(total: , items: , consumer: , success_url: , cancel_url: , payment_type: ) ⇒ Address
constructor
Initializes an Order object.
- #to_hash ⇒ Object
Constructor Details
#initialize(total: , items: , consumer: , success_url: , cancel_url: , payment_type: ) ⇒ Address
Initializes an Order object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/afterpay/address.rb', line 18 def initialize(attributes = {}) @name = attributes[:name] @line_1 = attributes[:line_1] || "" @line_2 = attributes[:line_2] || "" @suburb = attributes[:suburb] || "" @state = attributes[:state] || "" @postcode = attributes[:postcode] @country = attributes[:country] || "AU" @phone = attributes[:phone] end |
Instance Attribute Details
#country ⇒ Object
Returns the value of attribute country.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def country @country end |
#line_1 ⇒ Object
Returns the value of attribute line_1.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def line_1 @line_1 end |
#line_2 ⇒ Object
Returns the value of attribute line_2.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def line_2 @line_2 end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def name @name end |
#phone ⇒ Object
Returns the value of attribute phone.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def phone @phone end |
#postcode ⇒ Object
Returns the value of attribute postcode.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def postcode @postcode end |
#state ⇒ Object
Returns the value of attribute state.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def state @state end |
#suburb ⇒ Object
Returns the value of attribute suburb.
5 6 7 |
# File 'lib/afterpay/address.rb', line 5 def suburb @suburb end |
Class Method Details
.from_response(response) ⇒ Object
42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/afterpay/address.rb', line 42 def self.from_response(response) return nil if response.nil? new( name: response[:name], line_1: response[:line1], line_2: response[:line2], suburb: response[:suburb], state: response[:state], postcode: response[:postcode], country: response[:countryCode], phone: response[:phoneNumber] ) end |
Instance Method Details
#to_hash ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/afterpay/address.rb', line 29 def to_hash { name: name, line1: line_1, line2: line_2, suburb: suburb, state: state, postcode: postcode.to_s, countryCode: country, phoneNumber: phone.to_s } end |