Module: ITunesCharts

Extended by:
ITunesCharts
Included in:
ITunesCharts
Defined in:
lib/itunes_charts.rb,
lib/itunes_charts/version.rb,
lib/itunes_charts/chart_item.rb

Defined Under Namespace

Classes: ChartItem

Constant Summary collapse

VERSION =
"1.0.1"

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(name, *args) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/itunes_charts.rb', line 12

def method_missing(name, *args)
  hyphened_name = name.to_s.gsub('_','-')
  if charts.include?(hyphened_name)
    request(hyphened_name)
  else
    super(name, *args)
  end
end

Instance Method Details

#chartsObject



8
9
10
# File 'lib/itunes_charts.rb', line 8

def charts
  %w(albums songs tv-shows movies movie-rentals free-apps paid-apps music-videos)
end