Class: NBS::ArtistProfile

Inherits:
Object
  • Object
show all
Defined in:
lib/next-big-sound/artist_profile.rb

Constant Summary collapse

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(artist_id, service_type, url = "", options = {}) ⇒ ArtistProfile

Returns a new instance of ArtistProfile.



8
9
10
11
12
# File 'lib/next-big-sound/artist_profile.rb', line 8

def initialize(artist_id,service_type, url="",options={})
  self.service_type = service_type 
  self.artist_id = artist_id 
  self.url = url
end

Instance Attribute Details

#artist_idObject

Returns the value of attribute artist_id.



6
7
8
# File 'lib/next-big-sound/artist_profile.rb', line 6

def artist_id
  @artist_id
end

#optionsObject

Returns the value of attribute options.



6
7
8
# File 'lib/next-big-sound/artist_profile.rb', line 6

def options
  @options
end

#service_typeObject

Returns the value of attribute service_type.



6
7
8
# File 'lib/next-big-sound/artist_profile.rb', line 6

def service_type
  @service_type
end

#urlObject

Returns the value of attribute url.



6
7
8
# File 'lib/next-big-sound/artist_profile.rb', line 6

def url
  @url
end

Instance Method Details

#load_metrics(sdate, edate) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/next-big-sound/artist_profile.rb', line 19

def load_metrics(sdate,edate)
  metrics ={}
  METRICS.each do |metric_string|
    metrics[metric_string.to_s] = NBS::Metric.new(self.artist_id,self.service_type,metric_string.to_s,sdate,edate)
  end
  return metrics
end

#metrics(sdate, edate) ⇒ Object



13
14
15
# File 'lib/next-big-sound/artist_profile.rb', line 13

def metrics(sdate,edate)
  @metrics ||= load_metrics(sdate,edate)
end

#set_metrics(metrics_array = {}) ⇒ Object



16
17
18
# File 'lib/next-big-sound/artist_profile.rb', line 16

def set_metrics(metrics_array={})
  @metrics = metrics_array
end