Class: Nokaya::Apple
Direct Known Subclasses
Instance Attribute Summary
Attributes inherited from Basic
#args, #filenames, #name, #options, #path, #type, #urls
Instance Method Summary collapse
- #create_url(terms) ⇒ Object
-
#initialize(args, options) ⇒ Apple
constructor
A new instance of Apple.
- #music_url(terms) ⇒ Object
Methods inherited from Basic
#get_basic, #name_files, #parse, #save
Constructor Details
#initialize(args, options) ⇒ Apple
Returns a new instance of Apple.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/nokaya/apple.rb', line 6 def initialize args, super(args, ) if ['ios'] @entity = "software" elsif ['itunes'] if ['album'] @entity = 'album' else @entity = "musicTrack" end else @entity = "macSoftware" end end |
Instance Method Details
#create_url(terms) ⇒ Object
21 22 23 |
# 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) ⇒ Object
25 26 27 28 29 |
# 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 |