class Moka::Card
Attributes
bank_name[RW]
card_holder_full_name[RW]
card_name[RW]
card_number[RW]
card_number_first_six[RW]
card_number_last_four[RW]
card_token[RW]
customer[RW]
customer_code[RW]
dealer_customer_id[RW]
exp_month[RW]
exp_year[RW]
response[RW]
Public Class Methods
new(opts = {})
click to toggle source
# File lib/moka/model/card.rb, line 8 def initialize(opts = {}) opts.each do |o| send("#{o.first.to_s}=".to_sym, o.last) end end
Public Instance Methods
create()
click to toggle source
# File lib/moka/model/card.rb, line 14 def create response = RestClient.post Moka.endpoints.add_card, create_hash self.response = JSON.parse(response) end
delete()
click to toggle source
# File lib/moka/model/card.rb, line 29 def delete response = RestClient.post Moka.endpoints.get_card, get_and_delete_hash self.response = JSON.parse(response) end
get()
click to toggle source
# File lib/moka/model/card.rb, line 24 def get response = RestClient.post Moka.endpoints.get_card, get_and_delete_hash self.response = JSON.parse(response) end
success?()
click to toggle source
# File lib/moka/model/card.rb, line 34 def success? response && response['ResultCode'] == 'Success' end
update()
click to toggle source
# File lib/moka/model/card.rb, line 19 def update response = RestClient.post Moka.endpoints.update_card, update_hash self.response = JSON.parse(response) end
Private Instance Methods
create_hash()
click to toggle source
# File lib/moka/model/card.rb, line 39 def create_hash { "DealerCustomerAuthentication": Moka.configuration.config_hash, "DealerCustomerRequest": { "DealerCustomerId": dealer_customer_id, "CustomerCode": customer_code, "CardHolderFullName": card_holder_full_name, "CardNumber": card_number, "ExpMonth": exp_month, "ExpYear": exp_year, "CardName": card_name } } end
get_and_delete_hash()
click to toggle source
# File lib/moka/model/card.rb, line 64 def get_and_delete_hash { "DealerCustomerAuthentication": Moka.configuration.config_hash, "DealerCustomerRequest": { "CardToken": card_token } } end
update_hash()
click to toggle source
# File lib/moka/model/card.rb, line 54 def update_hash { "DealerCustomerAuthentication": Moka.configuration.config_hash, "DealerCustomerRequest": { "CardToken": card_token, "CardName": card_name } } end