Module: Braintree::ClientToken

Defined in:
lib/braintree/client_token.rb

Constant Summary collapse

DEFAULT_VERSION =
2

Class Method Summary collapse

Class Method Details

._validate_options(options) ⇒ Object



15
16
17
18
19
20
21
# File 'lib/braintree/client_token.rb', line 15

def self._validate_options(options)
  [:make_default, :fail_on_duplicate_payment_method, :verify_card].each do |credit_card_option|
    if options[credit_card_option]
      raise ArgumentError.new("cannot specify #{credit_card_option} without a customer_id") unless options[:customer_id]
    end
  end
end

.generate(options = {}) ⇒ Object



7
8
9
10
11
12
13
# File 'lib/braintree/client_token.rb', line 7

def self.generate(options={})
  _validate_options(options)

  options[:version] ||= DEFAULT_VERSION

  Configuration.gateway.client_token.generate(options)
end