Class: Epom::Analytic

Inherits:
EpomElement show all
Defined in:
lib/epom/analytic.rb

Class Method Summary collapse

Methods inherited from EpomElement

generic_method, login, method_missing, params_validation, respond_to?

Class Method Details

.extended_methodsObject



6
7
8
9
10
11
12
13
14
15
16
# File 'lib/epom/analytic.rb', line 6

def self.extended_methods
  {
    :analytics => {
      :url => '/rest-api/analytics/FORMAT/LOGIN/HASH/TIMESTAMP.do',
      :url_parameters => [:format, :login, :hash, :timestamp],
      :body_parameters => [:customFrom, :customTo, :hourFrom, :hourTo, :groupRange, :displayIds, :statisticType, :range, :groupBy, :filterBy, :eqStr, :eqLong],
      :method => :get,
      :format => nil
    }
  }
end

.replace_params_in_url(url, url_params) ⇒ Object



18
19
20
21
22
23
24
# File 'lib/epom/analytic.rb', line 18

def self.replace_params_in_url(url, url_params)
  url.gsub!('FORMAT', url_params[:format]) if url.include?('FORMAT')
  url.gsub!('LOGIN', url_params[:login]) if url.include?('LOGIN')
  url.gsub!('HASH', url_params[:hash]) if url.include?('HASH')
  url.gsub!('TIMESTAMP', url_params[:timestamp].to_s) if url.include?('TIMESTAMP')
  url
end