Sha256: 1bd1538ab2cb711fa42ac0d0bfd65ab9b70cf745c9d551228ab16ca1f280cd63

Contents?: true

Size: 1.91 KB

Versions: 1

Compression:

Stored size: 1.91 KB

Contents

module MangoPay

  # See http://docs.mangopay.com/api-references/users/
  # See also children classes:
  # - MangoPay::NaturalUser
  # - MangoPay::LegalUser
  class User < Resource
    include HTTPCalls::Create
    include HTTPCalls::Update
    include HTTPCalls::Fetch
    class << self
      # Fetches list of wallets belonging to the given +user_id+.
      # Optional +filters+ is a hash accepting following keys:
      # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
      def wallets(user_id, filters={})
        MangoPay.request(:get, url(user_id) + '/wallets', {}, filters)
      end

      # Fetches list of bank accounts belonging to the given +user_id+.
      # Optional +filters+ is a hash accepting following keys:
      # - +page+, +per_page+, +sort+: pagination and sorting params
      # (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
      def bank_accounts(user_id, filters={})
        MangoPay.request(:get, url(user_id) + '/bankaccounts', {}, filters)
      end

      # Fetches list of cards belonging to the given +user_id+.
      # Optional +filters+ is a hash accepting following keys:
      # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
      def cards(user_id, filters={})
        MangoPay.request(:get, url(user_id) + '/cards', {}, filters)
      end

      # Fetches list of transactions belonging to the given +user_id+.
      # Optional +filters+ is a hash accepting following keys:
      # - +page+, +per_page+, +sort+: pagination and sorting params (see MangoPay::HTTPCalls::Fetch::ClassMethods#fetch)
      # - other keys specific for transactions filtering (see MangoPay::Transaction#fetch)
      def transactions(user_id, filters={})
        MangoPay.request(:get, url(user_id) + '/transactions', {}, filters)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
mangopay-3.0.25 lib/mangopay/user.rb