Sha256: b3267843255b19568d6eded5cd853c1bcb037a83bda8a21c539ae1658c1fb209

Contents?: true

Size: 969 Bytes

Versions: 2

Compression:

Stored size: 969 Bytes

Contents

module Braintree
  class MerchantAccount
    include BaseModule

    module Status
      Pending = "pending"
      Active = "active"
      Suspended = "suspended"
    end

    attr_reader :status, :id, :master_merchant_account

    def self.create(attributes)
      Configuration.gateway.merchant_account.create(attributes)
    end

    def initialize(gateway, attributes) # :nodoc
      @gateway = gateway
      @master_merchant_account = MerchantAccount._new(@gateway, attributes.delete(:master_merchant_account)) if attributes[:master_merchant_account]
      set_instance_variables_from_hash(attributes)
    end

    class << self
      protected :new
      def _new(*args) # :nodoc:
        self.new *args
      end
    end

    def inspect
      order = [:id, :status, :master_merchant_account]
      nice_attributes = order.map do |attr|
        "#{attr}: #{send(attr).inspect}"
      end
      "#<#{self.class}: #{nice_attributes.join(', ')}>"
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
braintree-2.26.0 lib/braintree/merchant_account.rb
braintree-2.25.0 lib/braintree/merchant_account.rb