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.



139
140
141
# File 'lib/jsb.rb', line 139

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.


150
151
152
153
154
# File 'lib/jsb.rb', line 150

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.


163
164
165
166
167
# File 'lib/jsb.rb', line 163

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

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