Class: Rerout::Resources::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/rerout/project.rb

Overview

Project-level operations namespace.

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Project

Returns a new instance of Project.

Parameters:



8
9
10
# File 'lib/rerout/project.rb', line 8

def initialize(client)
  @client = client
end

Instance Method Details

#meRerout::Models::Project

Info about the project that owns the current API key.



28
29
30
31
# File 'lib/rerout/project.rb', line 28

def me
  response = @client.request(method: :get, path: '/v1/projects/me')
  Models::Project.from_hash(response)
end

#stats(days: 30) ⇒ Rerout::Models::ProjectStats

Aggregate stats across every link in the project. Defaults to 30 days.

Parameters:

  • days (Integer) (defaults to: 30)

Returns:



16
17
18
19
20
21
22
23
# File 'lib/rerout/project.rb', line 16

def stats(days: 30)
  response = @client.request(
    method: :get,
    path: '/v1/projects/me/stats',
    query: { 'days' => days }
  )
  Models::ProjectStats.from_hash(response)
end