Module: SpreedlyCore
- Defined in:
- lib/spreedly_core.rb,
lib/spreedly_core/base.rb,
lib/spreedly_core/gateway.rb,
lib/spreedly_core/version.rb,
lib/spreedly_core/transactions.rb,
lib/spreedly_core/payment_method.rb,
lib/spreedly_core/test_extensions.rb
Defined Under Namespace
Modules: HasIpAddress, NullifiableTransaction, TestHelper Classes: AuthorizeTransaction, Base, CaptureTransaction, CreditTransaction, Error, Gateway, InvalidResponse, PaymentMethod, PurchaseTransaction, RedactTransaction, Response, RetainTransaction, TimeOutError, Transaction, VoidedTransaction
Constant Summary collapse
- CARD_TYPES =
Hash of user friendly credit card name to SpreedlyCore API name
{ "Visa" => "visa", "MasterCard" => "master", "American Express" => "american_express", "Discover" => "discover" }
- Version =
VERSION = "0.1.3"
Class Method Summary collapse
-
.configure(*args) ⇒ Object
Configure SpreedlyCore with a particular account and default gateway If the first argume is a hash, ‘login’, ‘secret’, and ‘gateway_token’ keys are expected.
-
.login ⇒ Object
returns the configured SpreedlyCore login.
Class Method Details
.configure(*args) ⇒ Object
Configure SpreedlyCore with a particular account and default gateway If the first argume is a hash, ‘login’, ‘secret’, and ‘gateway_token’ keys are expected. Otherwise *args is expected to be login, secret, and gateway_token
33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/spreedly_core.rb', line 33 def self.configure(*args) login_or_hash, secret, gateway_token, *rest = args if login_or_hash.is_a?(Hash) # convert symbols to strings login_or_hash.each{|k,v| login_or_hash[k.to_s] = v } login = login_or_hash['login'] secret = login_or_hash['secret'] gateway_token = login_or_hash['gateway_token'] else login = login_or_hash end if login.nil? || secret.nil? || gateway_token.nil? raise ArgumentError.new("You must provide a login, secret, and gateway_token") end Base.configure(login, secret, gateway_token) end |