class Moka::Add::Customer
Attributes
address[RW]
birth_date[RW]
card_list[R]
card_list_count[R]
check_key[RW]
customer_code[RW]
customer_password[RW]
dealer_code[RW]
dealer_customer_id[R]
email[RW]
first_name[RW]
gender[RW]
gsm_number[RW]
last_name[RW]
password[RW]
username[RW]
Public Class Methods
details() { |customer_details| ... }
click to toggle source
# File lib/moka/add/customer.rb, line 33 def self.details @@response = nil @@customer_details = Moka::Add::Customer.new yield @@customer_details if block_given? return @@customer_details end
new(details = {})
click to toggle source
# File lib/moka/add/customer.rb, line 14 def initialize(details = {}) @dealer_code = Moka.config.dealer_code @username = Moka.config.username @password = Moka.config.password @check_key = Moka.config.check_key @customer_code = details[:customer_code] @customer_password = details[:customer_password] @first_name = details[:first_name] @last_name = details[:last_name] @gender = details[:gender] @birth_date = details[:birth_date] @gsm_number = details[:gsm_number] @email = details[:email] @address = details[:address] @dealer_customer_id = nil @card_list_count = nil @card_list = nil end
Public Instance Methods
add()
click to toggle source
# File lib/moka/add/customer.rb, line 40 def add raise Moka::Error::NullRequiredParameter if [@customer_code, @first_name].any? { |d| d.nil? } @@response = Moka::Request.add_customer(@@customer_details) if success? @dealer_customer_id = @@response["Data"]["DealerCustomer"]["DealerCustomerId"] @card_list_count = @@response["Data"]["CardListCount"] @card_list = @@response["Data"]["CardList"] else @error = Moka::Error::RequestError.new @error = @@response["ResultCode"] unless @@response["Data"] end return @@response end
error()
click to toggle source
# File lib/moka/add/customer.rb, line 69 def error @error end
request_details()
click to toggle source
# File lib/moka/add/customer.rb, line 58 def request_details @@customer_details end
response()
click to toggle source
# File lib/moka/add/customer.rb, line 54 def response @@response end
success?()
click to toggle source
# File lib/moka/add/customer.rb, line 62 def success? if @@response["ResultCode"] == "Success" return true end if @@response return false end