Class: Api2Convert::Resource::Stats

Inherits:
Object
  • Object
show all
Defined in:
lib/api2convert/resource/stats.rb

Overview

API usage statistics. The response shape is free-form (returned as-is).

filter is "single" (only the calling API key) or "all" (every key on the account, the default). The request is scoped by the X-Api2convert-Api-Key header, so never pass a key as filter.

Instance Method Summary collapse

Constructor Details

#initialize(transport) ⇒ Stats

Returns a new instance of Stats.



10
11
12
# File 'lib/api2convert/resource/stats.rb', line 10

def initialize(transport)
  @transport = transport
end

Instance Method Details

#day(day, filter = "all") ⇒ Object

day format yyyy-mm-dd.



15
16
17
# File 'lib/api2convert/resource/stats.rb', line 15

def day(day, filter = "all")
  @transport.request("GET", "/stats/day/#{seg(day)}/#{seg(filter)}")
end

#month(month, filter = "all") ⇒ Object

month format yyyy-mm.



20
21
22
# File 'lib/api2convert/resource/stats.rb', line 20

def month(month, filter = "all")
  @transport.request("GET", "/stats/month/#{seg(month)}/#{seg(filter)}")
end

#year(year, filter = "all") ⇒ Object

year format yyyy.



25
26
27
# File 'lib/api2convert/resource/stats.rb', line 25

def year(year, filter = "all")
  @transport.request("GET", "/stats/year/#{seg(year)}/#{seg(filter)}")
end