Class: KaChing::ApiV1::AuditLogs

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/ka_ching/api_v1/audit_logs.rb

Overview

AuditLog Endpoint for the KaChing API V1

Instance Method Summary collapse

Constructor Details

#initialize(conn:, api_url:) ⇒ AuditLogs

Returns a new instance of AuditLogs.



13
14
15
16
# File 'lib/ka_ching/api_v1/audit_logs.rb', line 13

def initialize(conn:, api_url:)
  @conn = conn
  @api_url = api_url
end

Instance Method Details

#of_year(tenant_account_id:, year:) {|Faraday::Response| ... } ⇒ Hash

Get all bookings for the current tenant of a specific year

Parameters:

  • tenant_account_id (String)
  • year (Integer)

Yields:

  • (Faraday::Response)

    The response from the server

Returns:

  • (Hash)

    containing the bookings as array



27
28
29
30
31
32
33
# File 'lib/ka_ching/api_v1/audit_logs.rb', line 27

def of_year(tenant_account_id:, year:)
  res = get(build_url(tenant_account_id: ),
            { year: year })

  yield res if block_given?
  JSON.parse(res.body)['audit_logs']
end

#of_year_month(tenant_account_id:, year:, month:) {|Faraday::Response| ... } ⇒ Hash

Get all bookings for the current tenant of a specific year, month

Parameters:

  • tenant_account_id (String)
  • year (Integer)
  • month (Integer)

Yields:

  • (Faraday::Response)

    The response from the server

Returns:

  • (Hash)

    containing the bookings as array



45
46
47
48
49
50
# File 'lib/ka_ching/api_v1/audit_logs.rb', line 45

def of_year_month(tenant_account_id:, year:, month:)
  res = get(build_url(tenant_account_id: ),
            { year: year, month: month })
  yield res if block_given?
  JSON.parse(res.body)['audit_logs']
end

#of_year_month_day(tenant_account_id:, year:, month:, day:) {|Faraday::Response| ... } ⇒ Hash

Get all bookings for the current tenant of a specific year, month, day

Parameters:

  • tenant_account_id (String)
  • year (Integer)
  • month (Integer)
  • day (Integer)

Yields:

  • (Faraday::Response)

    The response from the server

Returns:

  • (Hash)

    containing the bookings as array



63
64
65
66
67
68
# File 'lib/ka_ching/api_v1/audit_logs.rb', line 63

def of_year_month_day(tenant_account_id:, year:, month:, day:)
  res = get(build_url(tenant_account_id: ),
            { year: year, month: month, day: day })
  yield res if block_given?
  JSON.parse(res.body)['audit_logs']
end