Skip to content

Commit

Permalink
Compatibility fixes when using affiliate
Browse files Browse the repository at this point in the history
  • Loading branch information
Sam Pohlenz committed Apr 16, 2008
1 parent 98bac1b commit 1239bfc
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions lib/itunes_link_maker.rb
Expand Up @@ -56,11 +56,14 @@ def self.parse_html(html)
end

def self.get_html(query, options={})
options['term'] = CGI.escape(query)
open("#{SEARCH_URL}?#{serialize(options)}").read
open(url_for(options.merge('term' => query))).read
end

def self.url_for(options)
"#{SEARCH_URL}?#{serialize(options)}"
end

def self.serialize(options={})
options.sort_by { |k, v| OPTION_ORDER.index(k) }.map { |k, v| "#{k}=#{v}" }.join('&')
options.sort_by { |k, v| OPTION_ORDER.index(k) }.map { |k, v| "#{k}=#{CGI.escape(v.to_s)}" }.join('&')
end
end

0 comments on commit 1239bfc

Please sign in to comment.