Class: Roistat::Resources::Projects

Inherits:
Base
  • Object
show all
Defined in:
lib/roistat/resources/projects.rb,
sig/roistat.rbs

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from Roistat::Resources::Base

Instance Method Details

#counter_listObject

POST /project/settings/counter/list — same product idea as modules_list; listed on help-en.

Returns:

  • (Object)


27
28
29
# File 'lib/roistat/resources/projects.rb', line 27

def counter_list
  client.post("project/settings/counter/list")
end

#create(name:, currency:) ⇒ Object

POST /account/project/create — API key only.

Parameters:

  • name: (String)
  • currency: (String)

Returns:

  • (Object)


10
11
12
# File 'lib/roistat/resources/projects.rb', line 10

def create(name:, currency:)
  api_key_client.post("account/project/create", body: {name: name, currency: currency})
end

#listObject

GET /user/projects — API key only.

Returns:

  • (Object)


5
6
7
# File 'lib/roistat/resources/projects.rb', line 5

def list
  api_key_client.get("user/projects")
end

#modules_list(method: :get) ⇒ Object

GET|POST /project/settings/module/list — project-scoped (help-ru).

Parameters:

  • method: (Symbol) (defaults to: :get)

Returns:

  • (Object)


15
16
17
18
19
20
21
22
23
24
# File 'lib/roistat/resources/projects.rb', line 15

def modules_list(method: :get)
  case method.to_sym
  when :get
    client.get("project/settings/module/list")
  when :post
    client.post("project/settings/module/list")
  else
    raise ArgumentError, "method must be :get or :post"
  end
end