Class: ChannelAdvisor::Address

Inherits:
Object
  • Object
show all
Defined in:
lib/channeladvisor/address.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(attrs = {}) ⇒ Address

Returns a new instance of Address.



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/channeladvisor/address.rb', line 6

def initialize(attrs={})
  @line1              = attrs[:address_line1]
  @line2              = attrs[:address_line2]
  @city               = attrs[:city]
  @region             = attrs[:region]
  @region_description = attrs[:region_description]
  @postal_code        = attrs[:postal_code]
  @country_code       = attrs[:country_code]
  @company_name       = attrs[:company_name]
  @job_title          = attrs[:job_title]
  @title              = attrs[:title]
  @first_name         = attrs[:first_name]
  @last_name          = attrs[:last_name]
  @suffix             = attrs[:suffix]
  @daytime_phone      = attrs[:phone_number_day]
  @evening_phone      = attrs[:phone_number_evening]
end

Instance Attribute Details

#cityObject

Returns the value of attribute city.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def city
  @city
end

#company_nameObject

Returns the value of attribute company_name.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def company_name
  @company_name
end

#country_codeObject

Returns the value of attribute country_code.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def country_code
  @country_code
end

#daytime_phoneObject

Returns the value of attribute daytime_phone.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def daytime_phone
  @daytime_phone
end

#evening_phoneObject

Returns the value of attribute evening_phone.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def evening_phone
  @evening_phone
end

#first_nameObject

Returns the value of attribute first_name.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def first_name
  @first_name
end

#job_titleObject

Returns the value of attribute job_title.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def job_title
  @job_title
end

#last_nameObject

Returns the value of attribute last_name.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def last_name
  @last_name
end

#line1Object

Returns the value of attribute line1.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def line1
  @line1
end

#line2Object

Returns the value of attribute line2.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def line2
  @line2
end

#postal_codeObject

Returns the value of attribute postal_code.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def postal_code
  @postal_code
end

#regionObject

Returns the value of attribute region.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def region
  @region
end

#region_descriptionObject

Returns the value of attribute region_description.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def region_description
  @region_description
end

#suffixObject

Returns the value of attribute suffix.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def suffix
  @suffix
end

#titleObject

Returns the value of attribute title.



3
4
5
# File 'lib/channeladvisor/address.rb', line 3

def title
  @title
end

Instance Method Details

#formattedObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/channeladvisor/address.rb', line 28

def formatted
  <<-EOF
    #{full_name}
    #{job_title}
    #{@line1}
    #{@line2}
    #{@city}, #{@region} #{@postal_code}
    #{@country_code}
  EOF
end

#full_nameObject



24
25
26
# File 'lib/channeladvisor/address.rb', line 24

def full_name
  [@title, @first_name, @last_name].join(" ") + ", #{@suffix}"
end