class EwayRapid::InternalModels::Customer
Attributes
card_details[RW]
card_expiry_month[RW]
card_expiry_year[RW]
card_issue_number[RW]
card_name[RW]
card_number[RW]
card_start_month[RW]
card_start_year[RW]
city[RW]
comments[RW]
company_name[RW]
country[RW]
customer_device_ip[RW]
email[RW]
fax[RW]
first_name[RW]
is_active[RW]
job_description[RW]
last_name[RW]
mobile[RW]
phone[RW]
postal_code[RW]
reference[RW]
state[RW]
street1[RW]
street2[RW]
title[RW]
token_customer_id[RW]
url[RW]
Public Class Methods
from_array(array)
click to toggle source
# File lib/eway_rapid/models/internal_models.rb, line 134 def self.from_array(array) options = [] if array array.each {|option_hash| obj = Customer.from_hash(option_hash) options.push(obj) } end options end
from_hash(hash)
click to toggle source
# File lib/eway_rapid/models/internal_models.rb, line 100 def self.from_hash(hash) customer = Customer.new customer.token_customer_id = hash[Constants::TOKEN_CUSTOMER_ID] customer.reference = hash[Constants::REFERENCE] customer.title = hash[Constants::TITLE] customer.first_name = hash[Constants::FIRST_NAME] customer.last_name = hash[Constants::LAST_NAME] customer.company_name = hash[Constants::COMPANY_NAME] customer.job_description = hash[Constants::JOB_DESCRIPTION] customer.street1 = hash[Constants::STREET1] customer.street2 = hash[Constants::STREET2] customer.city = hash[Constants::CITY] customer.state = hash[Constants::STATE] customer.postal_code = hash[Constants::POSTAL_CODE] customer.country = hash[Constants::COUNTRY] customer.email = hash[Constants::EMAIL] customer.phone = hash[Constants::PHONE] customer.mobile = hash[Constants::MOBILE] customer.comments = hash[Constants::COMMENTS] customer.fax = hash[Constants::FAX] customer.url = hash[Constants::URL] customer.card_number = hash[Constants::CARD_NUMBER] customer.card_start_month = hash[Constants::CARD_START_MONTH] customer.card_start_year = hash[Constants::CARD_START_YEAR] customer.card_issue_number = hash[Constants::CARD_ISSUE_NUMBER] customer.card_name = hash[Constants::CARD_NAME] customer.card_expiry_month = hash[Constants::CARD_EXPIRY_MONTH] customer.card_expiry_year = hash[Constants::CARD_EXPIRY_YEAR] customer.is_active = hash[Constants::IS_ACTIVE] customer.card_details = Models::CardDetails.from_hash(hash[Constants::CARD_DETAILS]) customer.customer_device_ip = hash[Constants::CUSTOMER_DEVICE_IP] customer end
from_json(json)
click to toggle source
# File lib/eway_rapid/models/internal_models.rb, line 95 def self.from_json(json) hash = JSON.parse(json) from_hash(hash) end
to_hash(customer)
click to toggle source
# File lib/eway_rapid/models/internal_models.rb, line 58 def self.to_hash(customer) hash = {} if customer hash[Constants::TOKEN_CUSTOMER_ID] = customer.token_customer_id if customer.token_customer_id hash[Constants::REFERENCE] = customer.reference if customer.reference hash[Constants::TITLE] = customer.title if customer.title hash[Constants::FIRST_NAME] = customer.first_name if customer.first_name hash[Constants::LAST_NAME] = customer.last_name if customer.last_name hash[Constants::COMPANY_NAME] = customer.company_name if customer.company_name hash[Constants::JOB_DESCRIPTION] = customer.job_description if customer.job_description hash[Constants::STREET1] = customer.street1 if customer.street1 hash[Constants::STREET2] = customer.street2 if customer.street2 hash[Constants::CITY] = customer.city if customer.city hash[Constants::STATE] = customer.state if customer.state hash[Constants::POSTAL_CODE] = customer.postal_code if customer.postal_code hash[Constants::COUNTRY] = customer.country if customer.country hash[Constants::EMAIL] = customer.email if customer.email hash[Constants::PHONE] = customer.phone if customer.phone hash[Constants::MOBILE] = customer.mobile if customer.mobile hash[Constants::COMMENTS] = customer.comments if customer.comments hash[Constants::FAX] = customer.fax if customer.fax hash[Constants::URL] = customer.url if customer.url hash[Constants::CARD_DETAILS] = Models::CardDetails.to_hash(customer.card_details) if Models::CardDetails.to_hash(customer.card_details) hash[Constants::IS_ACTIVE] = customer.is_active if customer.is_active hash[Constants::CARD_NUMBER] = customer.card_number if customer.card_number hash[Constants::CARD_START_MONTH] = customer.card_start_month if customer.card_start_month hash[Constants::CARD_START_YEAR] = customer.card_start_year if customer.card_start_year hash[Constants::CARD_ISSUE_NUMBER] = customer.card_issue_number if customer.card_issue_number hash[Constants::CARD_NAME] = customer.card_name if customer.card_name hash[Constants::CARD_EXPIRY_MONTH] = customer.card_expiry_month if customer.card_expiry_month hash[Constants::CARD_EXPIRY_YEAR] = customer.card_expiry_year if customer.card_expiry_year hash[Constants::CUSTOMER_DEVICE_IP] = customer.customer_device_ip if customer.customer_device_ip end hash end