Module: MangoApi::Reports

Extended by:
UriProvider
Defined in:
lib/mangopay/api/service/reports.rb

Overview

Provides API method delegates concerning the Report entity

Class Method Summary collapse

Methods included from UriProvider

provide_uri

Class Method Details

.all {|filter_request = FilterRequest.new| ... } ⇒ Array

Retrieves report entities. Allows configuration of paging and sorting parameters by yielding a filtering object to a provided block. When no filters are specified, will retrieve the first page of 10 newest results.

Allowed FilterRequest params:

  • page

  • per_page

  • sort_field and sort_direction

  • before_date

  • after_date

Yields:

Returns:

  • (Array)

    corresponding Report entity objects



120
121
122
123
124
125
126
# File 'lib/mangopay/api/service/reports.rb', line 120

def all
  uri = provide_uri(:get_reports)
  filter_request = nil
  yield filter_request = FilterRequest.new if block_given?
  results = HttpClient.get(uri, filter_request)
  parse_results results
end

.create_for_transactions(report) {|report.filters| ... } ⇒ Report

Requests creation of a transaction report. Yields a ReportFilter object for caller to specify filtering parameters in a provided block.

Report properties:

  • Optional

    • tag

    • callback_url

    • download_format

    • sort

    • preview

    • columns

Available columns values: Alias, AuthorId, BankAccountId, BankWireRef, CardId, CardType, Country, CreationDate, CreditedFundsAmount, CreditedFundsCurrency, CreditedUserId, CreditedWalletId, Culture, DebitedFundsAmount, DebitedFundsCurrency, DebitedWalletId, DeclaredDebitedFundsAmount, DeclaredDebitedFundsCurrency, DeclaredFeesAmount, DeclaredFeesCurrency, ExecutionDate, ExecutionType, ExpirationDate, FeesAmount, FeesCurrency, Id, Nature, PaymentType, PreauthorizationId, ResultCode, ResultMessage, Status, Tag, Type, WireReference

Allowed ReportFilter params:

  • after_date

  • before_date

  • type

  • status

  • nature

  • min_debited_funds_amount

  • min_debited_funds_currency

  • max_debited_funds_amount

  • max_debited_funds_currency

  • min_fees_amount

  • min_fees_currency

  • max_fees_amount

  • max_fees_currency

  • author_id

  • wallet_id

Parameters:

  • +report+ (Report)

    model object of the report to be created

Yields:

  • (report.filters)

Returns:

  • (Report)

    the newly-created Report entity object



53
54
55
56
57
58
59
# File 'lib/mangopay/api/service/reports.rb', line 53

def create_for_transactions(report)
  uri = provide_uri(:create_transaction_report)
  report.filters = ReportFilter.new unless report.filters
  yield report.filters if block_given?
  response = HttpClient.post(uri, report)
  parse response
end

.create_for_wallets(report) {|report.filters| ... } ⇒ Report

Requests creation of a wallet report. Yields a ReportFilter object for caller to specify filtering parameters in a provided block.

Report properties:

  • Optional

    • tag

    • callback_url

    • download_format

    • sort

    • preview

    • columns

Available columns values: Id, Tag, CreationDate, Owners, Description, BalanceAmount, BalanceCurrency, Currency, FundsType

Allowed FilterRequest params:

  • after_date

  • before_date

  • owner_id

  • currency

  • min_balance_amount

  • min_balance_currency

  • max_balance_amount

  • max_balance_currency

Parameters:

  • +report+ (Report)

    model object of the report to be created

Yields:

  • (report.filters)

Returns:

  • (Report)

    the newly-created Report entity object



89
90
91
92
93
94
95
# File 'lib/mangopay/api/service/reports.rb', line 89

def create_for_wallets(report)
  uri = provide_uri(:create_wallet_report)
  report.filters = ReportFilter.new unless report.filters
  yield report.filters if block_given?
  response = HttpClient.post(uri, report)
  parse response
end

.get(id) ⇒ Report

Retrieves a report entity.

Parameters:

  • +id+ (String)

    ID of the report to retrieve

Returns:

  • (Report)

    the requested Report entity object



101
102
103
104
105
# File 'lib/mangopay/api/service/reports.rb', line 101

def get(id)
  uri = provide_uri(:get_report, id)
  response = HttpClient.get(uri)
  parse response
end