Class: JSB::Statistics

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

Overview

Group of statistics methods.

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ Statistics

Returns a new instance of Statistics.



167
168
169
# File 'lib/jsb.rb', line 167

def initialize(parent)
    @parent = parent
end

Instance Method Details

#register(params = {}) ⇒ Object

Register statistics for specific resource.

Arguments:

params: (Hash)
    journal_id: (Integer) id of journal.
    issue_id: (Integer) id of issue.
    article_id: (Integer) id of article.


178
179
180
181
182
# File 'lib/jsb.rb', line 178

def register(params = {})
    url_params = params_to_url(params)

    @parent.api["/statistics/register?#{url_params}"].put :accept => :json
end

#view(params = {}) ⇒ Object

View statistics for specifc resource.

Arguments:

params: (Hash)
    journal_id: (Integer) id of journal.
    issue_id: (Integer) id of issue.
    article_id: (Integer) id of article.


191
192
193
194
195
# File 'lib/jsb.rb', line 191

def view(params = {})
    url_params = params_to_url(params)

    @parent.parse(@parent.api["/statistics/view?#{url_params}"].get(:accept => :json))
end