class Nokaya::Apple

Public Class Methods

new(args, options) click to toggle source
Calls superclass method
# File lib/nokaya/apple.rb, line 6
def initialize args, options
  super(args, options)
  if options['ios']
    @entity = "software"
  elsif options['itunes']
    if options['album']
      @entity = 'album'
    else
      @entity = "musicTrack"
    end
  else
    @entity = "macSoftware"
  end
end

Public Instance Methods

create_url(terms) click to toggle source
# File lib/nokaya/apple.rb, line 21
def create_url terms
  URI.parse("http://itunes.apple.com/search?term=#{CGI.escape(terms.join(" "))}&entity=#{@entity}")
end
music_url(terms) click to toggle source
# File lib/nokaya/apple.rb, line 25
def music_url terms
  url = "http://itunes.apple.com/search?entity=#{@entity}"
  terms.each {|term| url << "&term=#{CGI.escape(term)}"}
  URI.parse(url)
end