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.



172
173
174
# File 'lib/jsb.rb', line 172

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.


183
184
185
186
187
# File 'lib/jsb.rb', line 183

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.


196
197
198
199
200
# File 'lib/jsb.rb', line 196

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

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