Class: Melissa::AddrObjMock
- Defined in:
- lib/melissa/addr_obj_mock.rb
Instance Method Summary collapse
-
#address_key ⇒ Object
Mock The Address Key consists of the nine-digit ZIP + 4 (without any dashes), the Delivery Point Code.
-
#delivery_point_check_digit ⇒ Object
Mock.
-
#delivery_point_code ⇒ Object
Mock.
-
#initialize(opts) ⇒ AddrObjMock
constructor
Mock.
-
#plus4 ⇒ Object
Mock.
-
#valid? ⇒ Boolean
Mock.
Methods inherited from AddrObj
add_callback, #address_struct, #delivery_point, #time_zone_offset
Constructor Details
#initialize(opts) ⇒ AddrObjMock
Mock
16 17 18 19 20 21 22 23 24 25 |
# File 'lib/melissa/addr_obj_mock.rb', line 16 def initialize(opts) @opts = opts #@urbanization = opts[:urbanization] || '' @resultcodes = ['AS01'] @address_type_string = 'Street' @time_zone_code = '05' @@callbacks.each do |callback| callback.call end end |
Instance Method Details
#address_key ⇒ Object
Mock The Address Key consists of the nine-digit ZIP + 4 (without any dashes), the Delivery Point Code
52 53 54 |
# File 'lib/melissa/addr_obj_mock.rb', line 52 def address_key "#{zip}#{plus4}#{delivery_point_code}" end |
#delivery_point_check_digit ⇒ Object
Mock
35 36 37 |
# File 'lib/melissa/addr_obj_mock.rb', line 35 def delivery_point_check_digit self.city && (self.city.sum % 10).to_s end |
#delivery_point_code ⇒ Object
Mock
28 29 30 31 32 |
# File 'lib/melissa/addr_obj_mock.rb', line 28 def delivery_point_code point_code = nil point_code = self.zip[3..5] if self.zip.present? return point_code end |
#plus4 ⇒ Object
Mock
40 41 42 |
# File 'lib/melissa/addr_obj_mock.rb', line 40 def plus4 return '1234' end |
#valid? ⇒ Boolean
Mock
45 46 47 48 |
# File 'lib/melissa/addr_obj_mock.rb', line 45 def valid? #we will mock delivery point if zip code is present. return self.zip.present? end |