Sha256: 447ce039a7175b670a27fc68759e7807f2377d1911cb6e77d3e5a06f65f021b6

Contents?: true

Size: 1.64 KB

Versions: 10

Compression:

Stored size: 1.64 KB

Contents

module FinApps
  module REST

    class Accounts < FinApps::REST::Resources
      include FinApps::REST::Defaults

      def show(account_id)
        logger.debug "##{__method__.to_s} => Started"

        raise MissingArgumentsError.new 'Missing argument: account_id.' if account_id.blank?
        logger.debug "##{__method__.to_s} => site_id: #{site_id}"

        end_point = Defaults::END_POINTS[:accounts_show]
        logger.debug "##{__method__.to_s} => end_point: #{end_point}"

        path = end_point.sub ':account_id', ERB::Util.url_encode(account_id)
        logger.debug "##{__method__.to_s} => path: #{path}"

        account, error_messages = @client.send(path, :get) do |r|
          Account.new(r.body)
        end

        logger.debug "##{__method__.to_s} => Completed"
        return account, error_messages
      end

    end

    class Account < FinApps::REST::Resource
      attr_accessor :_id, :account_type, :account_name, :account_holder, :account_display_name, :details

      def initialize(hash)
        super
        @details = AccountDetails.new hash[:details]
      end
    end

    class AccountDetails < FinApps::REST::Resource
      attr_accessor :available_balance, :current_balance, :routing_number,
                    :min_payment, :account_close_date, :account_number, :account_open_date,
                    :account_type, :amount_due, :apr, :as_of_date,
                    :available_credit, :available_cash, :card_type, :cash_apr,
                    :due_date, :last_payment, :last_payment_date, :new_charges, :payments, :pending_charges,
                    :running_balance, :total_cash_limit, :total_credit_line
    end

  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
finapps-0.2.10.pre lib/finapps/rest/accounts.rb
finapps-0.2.9.pre lib/finapps/rest/accounts.rb
finapps-0.2.8.pre lib/finapps/rest/accounts.rb
finapps-0.2.7.pre lib/finapps/rest/accounts.rb
finapps-0.2.6.pre lib/finapps/rest/accounts.rb
finapps-0.2.5.pre lib/finapps/rest/accounts.rb
finapps-0.2.4.pre lib/finapps/rest/accounts.rb
finapps-0.2.3.pre lib/finapps/rest/accounts.rb
finapps-0.2.2.pre lib/finapps/rest/accounts.rb
finapps-0.2.1.pre lib/finapps/rest/accounts.rb