class AppleMusic::Chart
Attributes
chart[R]
data[R]
href[R]
name[R]
next[R]
Public Class Methods
list(**options)
click to toggle source
e.g. AppleMusic::Chart.list
(types: ['songs', 'albums', 'playlists'], genre: 20, limit: 30) developer.apple.com/documentation/applemusicapi/get_catalog_charts
# File lib/apple_music/chart.rb, line 19 def list(**options) raise ParameterMissing, 'required parameter :types is missing' unless options[:types] types = options[:types].is_a?(Array) ? options[:types].join(',') : options[:types] storefront = Storefront.lookup(options.delete(:storefront)) response = AppleMusic.get("catalog/#{storefront}/charts", options.merge(types: types)) ChartResponse.new(response.body['results'] || {}) end
new(props = {})
click to toggle source
# File lib/apple_music/chart.rb, line 8 def initialize(props = {}) @chart = props['chart'] # required @data = Array(props['data']).map { |attrs| Resource.build(attrs) } # required @href = props['href'] # required @name = props['name'] # required @next = props['next'] end
search(**_options)
click to toggle source
# File lib/apple_music/chart.rb, line 28 def search(**_options) warn 'WARN: :charts is not searchable resource' end