ePages-de/epages-rest-ruby

View on GitHub
lib/epages/address.rb

Summary

Maintainability
A
0 mins
Test Coverage
require 'epages/utils'

module Epages
  class Address
    include Epages::Utils

    KEYS = %w(company salutation title first_name last_name street street_details zip_code
              city state country vat_id birthday email_address).collect(&:to_sym).freeze

    attr_accessor *KEYS

    def initialize(data)
      parse_attributes(data)
    end

    def to_json
      {
        firstName: first_name,
        lastName: last_name,
        street: street,
        zipCode: zip_code,
        city: city,
        country: country,
        birthday: birthday,
        emailAddress: email_address,
      }
    end
  end
end