Class: Deliver::ItunesSearchApi

Inherits:
Object
  • Object
show all
Defined in:
lib/deliver/itunes_search_api.rb

Overview

A wrapper around the Apple iTunes Search API to access app information like the app identifier of an app.

Class Method Summary collapse

Class Method Details

.fetch(id) ⇒ Hash

Fetch all information you can get from a specific AppleID of an app

Examples:

Response of Facebook App: itunes.apple.com/lookup?id=284882215

{ 
 ...
 artistName: "Facebook, Inc.",
 price: 0,
 version: "14.9",
 ...
}

Parameters:

  • id (int)

    The AppleID of the given app. This usually consists of 9 digits.

Returns:



19
20
21
22
# File 'lib/deliver/itunes_search_api.rb', line 19

def self.fetch(id)
  # Example: https://itunes.apple.com/lookup?id=284882215
  fetch_url("https://itunes.apple.com/lookup?id=#{id.to_s}")
end

.fetch_bundle_identifier(id) ⇒ String

This method only fetches the bundle identifier of a given app

Parameters:

  • id (int)

    The AppleID of the given app. This usually consists of 9 digits.

Returns:

  • (String)

    the Bundle identifier of the app



33
34
35
# File 'lib/deliver/itunes_search_api.rb', line 33

def self.fetch_bundle_identifier(id)
  self.fetch(id)['bundleId']
end

.fetch_by_identifier(app_identifier) ⇒ Object



24
25
26
27
# File 'lib/deliver/itunes_search_api.rb', line 24

def self.fetch_by_identifier(app_identifier)
  # Example: http://itunes.apple.com/lookup?bundleId=net.sunapps.1
  fetch_url("https://itunes.apple.com/lookup?bundleId=#{app_identifier}")
end