Module: AlphaCard
- Defined in:
- lib/alpha_card.rb,
lib/alpha_card/sale.rb,
lib/alpha_card/order.rb,
lib/alpha_card/account.rb,
lib/alpha_card/billing.rb,
lib/alpha_card/shipping.rb,
lib/alpha_card/alpha_card_error.rb,
lib/alpha_card/alpha_card_object.rb,
lib/alpha_card/alpha_card_response.rb
Defined Under Namespace
Classes: Account, AlphaCardError, AlphaCardObject, AlphaCardResponse, Billing, Order, Sale, Shipping
Constant Summary collapse
- CREDIT_CARD_CODES =
Global Payment Systems (NDC) Credit Card Authorization Codes
YAML.load_file(File.('../alpha_card/data/codes.yml', __FILE__))
Class Attribute Summary collapse
-
.api_base ⇒ Object
Returns the value of attribute api_base.
Class Method Summary collapse
-
.request(params = {}, account) ⇒ Object
AlphaCard.request(params, account) -> AlphaCardResponse.
Class Attribute Details
.api_base ⇒ Object
Returns the value of attribute api_base.
25 26 27 |
# File 'lib/alpha_card.rb', line 25 def api_base @api_base end |
Class Method Details
.request(params = {}, account) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/alpha_card.rb', line 36 def self.request(params = {}, account) unless account.filled? raise AlphaCardError.new('You must set credentials to create the sale!') end begin response = RestClient.post(@api_base, params.merge(account.attributes)) rescue => e handle_connection_errors(e) end alpha_card_response = AlphaCardResponse.new(response.to_str) handle_alpha_card_errors(alpha_card_response) alpha_card_response end |