class Moka::Update::Customer
Attributes
address[RW]
birth_date[RW]
check_key[RW]
customer_code[RW]
customer_password[RW]
dealer_code[RW]
dealer_customer_id[RW]
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/update/customer.rb, line 31 def self.details @@response = nil @@customer_details = Moka::Update::Customer.new yield @@customer_details if block_given? return @@customer_details end
new(details = {})
click to toggle source
# File lib/moka/update/customer.rb, line 12 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] @dealer_customer_id = 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] @card_list_count = nil @card_list = nil end
Public Instance Methods
error()
click to toggle source
# File lib/moka/update/customer.rb, line 66 def error end
request_details()
click to toggle source
# File lib/moka/update/customer.rb, line 55 def request_details @@customer_details end
response()
click to toggle source
# File lib/moka/update/customer.rb, line 51 def response @@response end
success?()
click to toggle source
# File lib/moka/update/customer.rb, line 59 def success? if @@response["ResultCode"] == "Success" return true end if @@response return false end
update()
click to toggle source
# File lib/moka/update/customer.rb, line 38 def update raise Moka::Error::NullRequiredParameter if [@customer_code, @dealer_customer_id].all? { |d| d.nil? } @@response = Moka::Request.update_customer(@@customer_details) #TODO if success? @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