Class: Xpost::Address
- Inherits:
-
Object
- Object
- Xpost::Address
- Includes:
- ActiveModel::Model
- Defined in:
- lib/xpost/address.rb
Constant Summary collapse
- REQUIRED_ADDRESS_PARAMETERS =
Set[:name, :line_1, :city, :state, :postal_code, :country]
- OPTIONAL_ADDRESS_PARAMETERS =
Set[:company, :title, :email, :phone_number, :mobile_number, :fax_number, :district, :line_2, :remarks]
Instance Attribute Summary collapse
-
#city ⇒ Object
Returns the value of attribute city.
-
#company ⇒ Object
Returns the value of attribute company.
-
#country ⇒ Object
Returns the value of attribute country.
-
#district ⇒ Object
Returns the value of attribute district.
-
#email ⇒ Object
Returns the value of attribute email.
-
#fax_number ⇒ Object
Returns the value of attribute fax_number.
-
#line_1 ⇒ Object
Returns the value of attribute line_1.
-
#line_2 ⇒ Object
Returns the value of attribute line_2.
-
#mobile_number ⇒ Object
Returns the value of attribute mobile_number.
-
#name ⇒ Object
Returns the value of attribute name.
-
#phone_number ⇒ Object
Returns the value of attribute phone_number.
-
#postal_code ⇒ Object
Returns the value of attribute postal_code.
-
#remarks ⇒ Object
Returns the value of attribute remarks.
-
#state ⇒ Object
Returns the value of attribute state.
-
#title ⇒ Object
Returns the value of attribute title.
Class Method Summary collapse
Instance Method Summary collapse
- #attributes ⇒ Object
-
#initialize(options = {}) ⇒ Address
constructor
A new instance of Address.
Constructor Details
#initialize(options = {}) ⇒ Address
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'lib/xpost/address.rb', line 17 def initialize( = {}) # (?) Mr., Mrs., Ms., etc. @title = [:title] @name = [:name] @email = [:email] @phone_number = [:phone_number] @mobile_number = [:mobile_number] @fax_number = [:fax_number] @company = [:company] # Address Line 1 @line_1 = [:line_1] # Address Line 1 @line_2 = [:line_2] # City @city = [:city] # District (NCR's Four Districts) (Optional) @district = [:district] # State / Province @state = [:state] # Postal Code / ZIP Code @postal_code = [:postal_code] # Country @country = [:country] @remarks = [:remarks] end |
Instance Attribute Details
#city ⇒ Object
Returns the value of attribute city.
12 13 14 |
# File 'lib/xpost/address.rb', line 12 def city @city end |
#company ⇒ Object
Returns the value of attribute company.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def company @company end |
#country ⇒ Object
Returns the value of attribute country.
12 13 14 |
# File 'lib/xpost/address.rb', line 12 def country @country end |
#district ⇒ Object
Returns the value of attribute district.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def district @district end |
#email ⇒ Object
Returns the value of attribute email.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def email @email end |
#fax_number ⇒ Object
Returns the value of attribute fax_number.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def fax_number @fax_number end |
#line_1 ⇒ Object
Returns the value of attribute line_1.
12 13 14 |
# File 'lib/xpost/address.rb', line 12 def line_1 @line_1 end |
#line_2 ⇒ Object
Returns the value of attribute line_2.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def line_2 @line_2 end |
#mobile_number ⇒ Object
Returns the value of attribute mobile_number.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def mobile_number @mobile_number end |
#name ⇒ Object
Returns the value of attribute name.
12 13 14 |
# File 'lib/xpost/address.rb', line 12 def name @name end |
#phone_number ⇒ Object
Returns the value of attribute phone_number.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def phone_number @phone_number end |
#postal_code ⇒ Object
Returns the value of attribute postal_code.
12 13 14 |
# File 'lib/xpost/address.rb', line 12 def postal_code @postal_code end |
#remarks ⇒ Object
Returns the value of attribute remarks.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def remarks @remarks end |
#state ⇒ Object
Returns the value of attribute state.
12 13 14 |
# File 'lib/xpost/address.rb', line 12 def state @state end |
#title ⇒ Object
Returns the value of attribute title.
13 14 15 |
# File 'lib/xpost/address.rb', line 13 def title @title end |
Class Method Details
.sample_address ⇒ Object
65 66 67 68 69 70 71 72 73 74 75 |
# File 'lib/xpost/address.rb', line 65 def self.sample_address address = Xpost::Address.new( name: "Bobby Axelrod", line_1: "EDSA Shangri-La", city: "Mandaluyong", state: "Metro Manila", postal_code: "1650", country: "PH" ) address end |
Instance Method Details
#attributes ⇒ Object
45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/xpost/address.rb', line 45 def attributes { title: self.title, name: self.name, email: self.email, phone_number: self.phone_number, mobile_number: self.mobile_number, fax_number: self.fax_number, company: self.company, line_1: self.line_1, line_2: self.line_2, city: self.city, district: self.district, state: self.state, postal_code: self.postal_code, country: self.country, remarks: self.remarks } end |