Class: BraintreeAccount
- Inherits:
-
Object
- Object
- BraintreeAccount
- Defined in:
- lib/braintree_account.rb
Constant Summary collapse
- RequiredOptions =
[:environment, :merchant_id, :public_key, :private_key]
Instance Attribute Summary collapse
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#masked ⇒ Object
Returns the value of attribute masked.
-
#merchant_id ⇒ Object
readonly
Returns the value of attribute merchant_id.
-
#private_key ⇒ Object
readonly
Returns the value of attribute private_key.
-
#public_key ⇒ Object
readonly
Returns the value of attribute public_key.
Instance Method Summary collapse
- #_display(string) ⇒ Object
- #activate! ⇒ Object
- #as_json ⇒ Object
-
#initialize(options) ⇒ BraintreeAccount
constructor
A new instance of BraintreeAccount.
Constructor Details
#initialize(options) ⇒ BraintreeAccount
Returns a new instance of BraintreeAccount.
7 8 9 10 11 12 13 |
# File 'lib/braintree_account.rb', line 7 def initialize() @masked = false @environment = [:environment] @merchant_id = [:merchant_id] @public_key = [:public_key] @private_key = [:private_key] end |
Instance Attribute Details
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
2 3 4 |
# File 'lib/braintree_account.rb', line 2 def environment @environment end |
#masked ⇒ Object
Returns the value of attribute masked.
3 4 5 |
# File 'lib/braintree_account.rb', line 3 def masked @masked end |
#merchant_id ⇒ Object (readonly)
Returns the value of attribute merchant_id.
2 3 4 |
# File 'lib/braintree_account.rb', line 2 def merchant_id @merchant_id end |
#private_key ⇒ Object (readonly)
Returns the value of attribute private_key.
2 3 4 |
# File 'lib/braintree_account.rb', line 2 def private_key @private_key end |
#public_key ⇒ Object (readonly)
Returns the value of attribute public_key.
2 3 4 |
# File 'lib/braintree_account.rb', line 2 def public_key @public_key end |
Instance Method Details
#_display(string) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/braintree_account.rb', line 30 def _display(string) if @masked if string.length > 4 string[0..3] + "*" * (string.length - 4) else "*"*string.length end else string end end |
#activate! ⇒ Object
15 16 17 18 19 20 21 |
# File 'lib/braintree_account.rb', line 15 def activate! Braintree::Configuration.environment = @environment.to_sym Braintree::Configuration.merchant_id = @merchant_id Braintree::Configuration.public_key = @public_key Braintree::Configuration.private_key = @private_key Braintree::Configuration.logger = Logger.new("/dev/null") end |
#as_json ⇒ Object
23 24 25 26 27 28 |
# File 'lib/braintree_account.rb', line 23 def as_json { :environment => @environment, :merchant_id => @merchant_id, } end |