Module: Judopay

Defined in:
lib/judopay.rb,
lib/judopay/api.rb,
lib/judopay/mash.rb,
lib/judopay/error.rb,
lib/judopay/model.rb,
lib/judopay/request.rb,
lib/judopay/version.rb,
lib/judopay/response.rb,
lib/judopay/connection.rb,
lib/judopay/serializer.rb,
lib/judopay/models/void.rb,
lib/judopay/null_logger.rb,
lib/judopay/models/refund.rb,
lib/judopay/models/payment.rb,
lib/judopay/models/preauth.rb,
lib/judopay/models/save_card.rb,
lib/judopay/models/collection.rb,
lib/judopay/models/transaction.rb,
lib/judopay/models/card_address.rb,
lib/judopay/models/card_payment.rb,
lib/judopay/models/card_preauth.rb,
lib/judopay/models/inner/wallet.rb,
lib/judopay/models/apple_payment.rb,
lib/judopay/models/apple_preauth.rb,
lib/judopay/models/market/refund.rb,
lib/judopay/models/register_card.rb,
lib/judopay/models/token_payment.rb,
lib/judopay/models/token_preauth.rb,
lib/judopay/models/market/payment.rb,
lib/judopay/models/market/preauth.rb,
lib/judopay/models/android_payment.rb,
lib/judopay/models/android_preauth.rb,
lib/judopay/models/encrypt_details.rb,
lib/judopay/models/inner/pk_payment.rb,
lib/judopay/models/market/collection.rb,
lib/judopay/models/market/transaction.rb,
lib/judopay/models/web_payments/payment.rb,
lib/judopay/models/web_payments/preauth.rb,
lib/judopay/models/one_use_token_payment.rb,
lib/judopay/models/inner/pk_payment_token.rb,
lib/judopay/models/inner/transmitted_field.rb,
lib/judopay/models/web_payments/transaction.rb,
lib/judopay/models/web_payments/web_payment_operation.rb

Defined Under Namespace

Modules: Connection, Market, Request, Response, WebPayments Classes: API, APIError, AndroidPayment, AndroidPreauth, ApplePayment, ApplePreauth, CardAddress, CardPayment, CardPreauth, Collection, Configuration, EncryptDetails, FieldError, Mash, Model, NullLogger, OneUseTokenPayment, Payment, PkPayment, PkPaymentToken, Preauth, Refund, RegisterCard, SaveCard, Serializer, TokenPayment, TokenPreauth, Transaction, TransmittedField, ValidationError, Void, Wallet

Constant Summary collapse

SDK_VERSION =
'2.1.3'.freeze
API_VERSION =
'5.2.0'.freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configurationObject

Returns the value of attribute configuration.



10
11
12
# File 'lib/judopay.rb', line 10

def configuration
  @configuration
end

Class Method Details

.configure {|configuration| ... } ⇒ Object

Configure the gem by passing a block

Yields:



14
15
16
17
18
# File 'lib/judopay.rb', line 14

def self.configure
  self.configuration ||= Configuration.new
  yield(configuration) if block_given?
  configure_endpoint_for_environment
end

.configure_endpoint_for_environmentObject

Based on the use_production flag, which endpoint should we use?



29
30
31
32
33
34
35
# File 'lib/judopay.rb', line 29

def self.configure_endpoint_for_environment
  self.configuration.endpoint_url = if self.configuration.use_production
                                      self.configuration.api_endpoints[:production]
                                    else
                                      self.configuration.api_endpoints[:sandbox]
                                    end
end

.log(log_level, message) ⇒ Object

Record a new log message if a logger is configured



21
22
23
24
25
26
# File 'lib/judopay.rb', line 21

def self.log(log_level, message)
  logger = self.configuration.logger
  return unless logger.is_a?(Logger)
  logger.progname = 'judopay'
  logger.add(log_level) { message }
end