Class: ModernTreasury::Resources::JournalSources

Inherits:
Object
  • Object
show all
Defined in:
lib/modern_treasury/resources/journal_sources.rb,
sig/modern_treasury/resources/journal_sources.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ JournalSources

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of JournalSources.

Parameters:



62
63
64
# File 'lib/modern_treasury/resources/journal_sources.rb', line 62

def initialize(client:)
  @client = client
end

Instance Method Details

#list(journal_entry_id: nil, journal_report_id: nil, page: nil, per_page: nil, source_id: nil, source_type: nil, request_options: {}) ⇒ nil

Retrieve a list of journal sources

Parameters:

  • journal_entry_id (String) —

    The ID of the journal entry

  • journal_report_id (String) —

    The ID of the journal report

  • page (Integer) —

    Page number for pagination

  • per_page (Integer) —

    Number of items per page

  • source_id (String) —

    The ID of the source object

  • source_type (String) —

    The type of the source object

  • request_options (ModernTreasury::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

  • (nil)

See Also:



47
48
49
50
51
52
53
54
55
56
57
# File 'lib/modern_treasury/resources/journal_sources.rb', line 47

def list(params = {})
  parsed, options = ModernTreasury::JournalSourceListParams.dump_request(params)
  query = ModernTreasury::Internal::Util.encode_query_params(parsed)
  @client.request(
    method: :get,
    path: "api/journal_sources",
    query: query,
    model: NilClass,
    options: options
  )
end

#retrieve(id, request_options: {}) ⇒ nil

Retrieve a specific journal source

Parameters:

Returns:

  • (nil)

See Also:



17
18
19
20
21
22
23
24
# File 'lib/modern_treasury/resources/journal_sources.rb', line 17

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["api/journal_sources/%1$s", id],
    model: NilClass,
    options: params[:request_options]
  )
end