Class: NextBigSoundLite::Metric

Inherits:
Resource
  • Object
show all
Defined in:
lib/next_big_sound_lite/resources/metric.rb

Constant Summary collapse

ALLOWED_METRICS =
%w(all plays fans views comments downloads likes price)

Class Method Summary collapse

Methods inherited from Resource

get, idfy, parse, post

Class Method Details

.artist(id, params = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/next_big_sound_lite/resources/metric.rb', line 16

def self.artist(id, params = {})
  get resource["artist/#{id}.json?#{querify params}"] do |response|
    response.map do |metric|
      Hashie::Mash.new Hash[metric.to_a.map { |k,v| [k.downcase, v] }]
    end
  end
end

.profile(id, params = {}) ⇒ Object

start and end can be either a Date or Time object



12
13
14
# File 'lib/next_big_sound_lite/resources/metric.rb', line 12

def self.profile(id, params = {})
  get resource["profile/#{id}.json?#{querify params}"]
end

.resourceObject



7
8
9
# File 'lib/next_big_sound_lite/resources/metric.rb', line 7

def self.resource
  super 'metrics'
end