Sha256: c1c5cf718a10a5e47817e056e8e4ea780f29b2c908efa6b7369a14885d923764

Contents?: true

Size: 1017 Bytes

Versions: 2

Compression:

Stored size: 1017 Bytes

Contents

require 'active_model'
require 'json'

module Xpanse2go
  class Address
    include ActiveModel::Model

    attr_accessor :customer_name, :line1, :barangay, :city, :country, :zip_code
    attr_accessor :mobile_number, :email_address

    validates_presence_of :customer_name, :line1, :barangay, :city, :country, :zip_code

    def initialize(options = {})
      @customer_name  = options[:customer_name]
      @line1          = options[:line1]
      @barangay       = options[:barangay]
      @city           = options[:city]
      @country        = options[:customer_name] || 'Philippines'
      @zip_code       = options[:zip_code]
      @mobile_number  = options[:mobile_number]
      @email_address  = options[:email_address]
    end

    def attributes
      {
        "name": @customer_name,
        "street": @line1,
        "barangay": @barangay,
        'city': @city,
        'area_code': @zip_code,
        'mobile_number': @mobile_number,
        'email_address': @email_address
      }
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xpanse_2go-0.1.2 lib/xpanse_2go/address.rb
xpanse_2go-0.1.0 lib/xpanse_2go/address.rb