Class: Roistat::Resources::Widgets

Inherits:
Base
  • Object
show all
Defined in:
lib/roistat/resources/widgets.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

#data(widget_id:, method: :post, **body) ⇒ Object

GET|POST /project/widget/widgetId/data — help-en; curl usually POSTs.

Parameters:

  • widget_id: (Integer, String)
  • method: (Symbol) (defaults to: :post)
  • (Object)

Returns:

  • (Object)


5
6
7
8
9
10
11
12
13
14
15
16
# File 'lib/roistat/resources/widgets.rb', line 5

def data(widget_id:, method: :post, **body)
  path = "project/widget/#{widget_id}/data"

  case method.to_sym
  when :get
    client.get(path)
  when :post
    post_optional_body(path, body)
  else
    raise ArgumentError, "method must be :get or :post"
  end
end