class Establish::ItunesSearchApi

Public Class Methods

fetch(id) click to toggle source
# File lib/establish/itunes_search_api.rb, line 5
def self.fetch(id)
  # Example: https://itunes.apple.com/lookup?id=284882215

  response = JSON.parse(open("https://itunes.apple.com/lookup?id=#{id}").read)
  return nil if response['resultCount'] == 0

  return response['results'].first
rescue
  Helper.log.error "Could not find object '#{id}' using the iTunes API"
  nil
end
fetch_bundle_identifier(id) click to toggle source
# File lib/establish/itunes_search_api.rb, line 17
def self.fetch_bundle_identifier(id)
  self.fetch(id)['bundleId']
end