Class: Seatsio::UsageReportsClient

Inherits:
Object
  • Object
show all
Defined in:
lib/seatsio/usage_reports.rb

Instance Method Summary collapse

Constructor Details

#initialize(http_client) ⇒ UsageReportsClient

Returns a new instance of UsageReportsClient.



9
10
11
# File 'lib/seatsio/usage_reports.rb', line 9

def initialize(http_client)
  @http_client = http_client
end

Instance Method Details

#details_for_event_in_month(eventId, month) ⇒ Object



25
26
27
28
29
30
31
32
33
# File 'lib/seatsio/usage_reports.rb', line 25

def details_for_event_in_month(eventId, month)
  url = "reports/usage/month/" + month.serialize + "/event/" + eventId.to_s
  body = @http_client.get(url)
  if body.empty? or !body[0].key?('usageByReason')
    body.map { |item| UsageForObjectV1.new(item) }
  else
    body.map { |item| UsageForObjectV2.new(item) }
  end
end

#details_for_month(month) ⇒ Object



19
20
21
22
23
# File 'lib/seatsio/usage_reports.rb', line 19

def details_for_month(month)
  url = "reports/usage/month/" + month.serialize
  body = @http_client.get(url)
  body.map { |item| UsageDetails.new(item) }
end

#summary_for_all_monthsObject



13
14
15
16
17
# File 'lib/seatsio/usage_reports.rb', line 13

def summary_for_all_months
  url = "reports/usage?version=2"
  body = @http_client.get(url)
  UsageSummaryForAllMonths.new(body)
end