Class: Awesm::Stats

Inherits:
Hashie::Mash
  • Object
show all
Defined in:
lib/awesm/stats.rb

Constant Summary collapse

PATH =
'/stats'

Class Method Summary collapse

Class Method Details

.range(options) ⇒ Object


5
6
7
8
9
# File 'lib/awesm/stats.rb', line 5

def self.range(options)
  response = Awesm.http_client.get "#{Awesm::HOST}#{PATH}/range.json", { :v => 3 }.merge(options)
  json = JSON.parse response.content
  new(json)
end

.totals(options) ⇒ Object


11
12
13
14
15
# File 'lib/awesm/stats.rb', line 11

def self.totals(options)
  response = Awesm.http_client.get "#{Awesm::HOST}#{PATH}/totals.json", { :v => 3 }.merge(options)
  json = JSON.parse response.content
  new(json)
end

.url(options) ⇒ Object


17
18
19
20
21
22
# File 'lib/awesm/stats.rb', line 17

def self.url(options)
  awesm_id = options.delete(:awesm_id)
  response = Awesm.http_client.get "#{Awesm::HOST}#{PATH}/#{awesm_id}.json", { :v => 3 }.merge(options)
  json = JSON.parse response.content
  new(json)
end