sshaw/itunes_store_transporter

View on GitHub
README.rdoc

Summary

Maintainability
Test Coverage
= iTunes::Store::Transporter

{<img src="https://secure.travis-ci.org/sshaw/itunes_store_transporter.svg"/>}[http://travis-ci.org/sshaw/itunes_store_transporter]
{<img src="https://ci.appveyor.com/api/projects/status/k6w6ob5f7s9j8pv8?svg=true"/>}[https://ci.appveyor.com/project/sshaw/itunes-store-transporter]
{<img src="https://codeclimate.com/github/sshaw/itunes_store_transporter.svg" />}[https://codeclimate.com/github/sshaw/itunes_store_transporter]

Upload and manage your assets in the iTunes Store using the iTunes Store's Transporter (+iTMSTransporter+).

=== Overview

 require "itunes/store/transporter"

 itms = iTunes::Store::Transporter.new(:username => "SomeUser",
                                       :shortname => "shrt",  # or :itc_provider, if you have no shortname
                                       :password => "w3c@llYoU!")

 itms.upload("/path/to/yourpackage.itmsp")
 metadata = itms.lookup(:apple_id => "yourpackage")

 begin
   itms.verify("/path/to/package2.itmsp", :verify_asssets => false)
 rescue iTunes::Store::Transporter::ExecutionError => e
   puts "Exited with #{e.exitstatus}"

   e.errors.each do |error|
     puts "#{error.message} - #{error.code}"
     puts "Basically, you have some faulty metadata" if error.missing_data?
   end
 end

=== Description

<code>iTunes::Store::Transporter</code> is a wrapper around Apple's +iTMSTransporter+ program. It currently
supports the following operations:

* Upload packages
* Validate packages
* Retrieve status information
* Lookup package metadata and video assets
* List providers
* Retrieve iTunes metadata schemas

It also includes +itms+, an executable that's sorta like using +iTMSTransporter+ directly except
that it can send email notifications and allows one to set global/per-command defaults via <code>$HOME/.itms</code>.

=== Requirements

* Optout (<code>gem install optout</code>)
* iTunes Store Transporter (https://help.apple.com/itc/transporteruserguide/)

=== Installation

Add `gem "itunes_store_transporter"` to your Ruby project's Gemfile to use as a library, or run `gem install itunes_store_transporter` to install system-wide for CLI usage.

=== Locating iTMSTransporter

If the +iTMSTransporter+ cannot be found in {one your platform's known locations}[https://github.com/sshaw/itunes_store_transporter/blob/fcb4f0f9ada4a45764160beac6a049b0d419c8a9/lib/itunes/store/transporter/shell.rb#L31] you must specify it when creating an instance of <code>iTunes::Store::Transporter</code> via {the <code>:path</code> option}[http://www.rubydoc.info/gems/itunes_store_transporter/ITunes/Store/Transporter/ITMSTransporter#initialize-instance_method].

If you're using the bundled +itms+ command you must use its +--path+ option or specify the path in the itms config file. See the +itms+ section for more info.

=== Using itms

<code>itms COMMAND [OPTIONS] [PACKAGE]</code>

* +COMMAND+ - The command to run, which can be any one of {the <code>iTunes::Store::Transporter</code> methods}[http://sshaw.github.io/itunes_store_transporter/classes/ITunes/Store/Transporter/ITMSTransporter.html]
* +OPTIONS+ - These are quivalent to the given +COMMAND+'s options except they must be given in a strict long option format. For example <code>:apple_id => "X123"</code> would be <code>--apple-id=X123</code>. Boolean options can be negated with the <code>--no-</code> prefix. For more info see {each command's options}[http://sshaw.github.io/itunes_store_transporter/classes/ITunes/Store/Transporter/ITMSTransporter.html].
* +PACKAGE+ - The package or directory to operate on, if required by the command

<b>Note that options with a value must contain the equals character</b> (<code>"="</code>).
The format is <code>--option=value</code> and not <code>--option value</code>.

==== Examples

    itms upload --username=sshaw --password=w3cAllYoU --transport=aspera a_package.itmsp
    itms version
    itms status --no-print-stderr --vendor-id=X123123 --username=sshaw --password=sekr3t_ --shortname=ss

==== Username, Password, Short Name

Most all commands require your username and password, some require a shortname. These can be specified on the command line
via the +--username+, +--password+, and +--shortname+ options, or via an +itms+ config file. See the config file section below.

==== Lookup command

The lookup command differs slightly from the gem by allowing you to download low-quality copies of the assets associated with the looked up metadata.
These assets are created by Apple (at the time of this writing, Apple only allows you to download full and preview assets, there is nothing
in +itms+ that would prevent you from downloading other types of assets if/when they're supported).

For example, to lookup the metadata for package +X123+ and download low-quality copies of all the assets:

  itms lookup --vendor-id=X123 --assets

To download a particular asset type just provide its name:

  itms lookup --vendor-id=X123 --assets=preview

If there are multiple territories this will download the preview assets for each of them. To only download assets in a given territory or territories use:

  itms lookup --vendor-id=X123 --assets=preview:US
  itms lookup --vendor-id=X123 --assets=preview:US:BR

If necessary multiple asset types can be seperated by a comma:

  itms lookup --vendor-id=X123 --assets=full,preview
  itms lookup --vendor-id=X123 --assets=full,preview:MX

==== Config file

Default options and email notifications can be placed in a YAML file at <code>$HOME/.itms</code>. To skip loading the config file use the <code>--no-config</code> option.

    # Global command defaults
    path: /usr/bin
    username: sshaw
    password: Pa55W0rd!

    # Global email defaults
    email:
      to: everyone@example.com
      from: no-reply@example.com
      host: smtp.example.com

    # Verify command
    verify:
      shortname: lUzer

    # Upload command
    upload:
      shortname: enc0d3rz
      transport: Aspera
      rate: 750000
      # Email notifications for the upload command
      email:
        success:
          cc: assets@example.com
          subject: iTunes Upload <%= @apple_id %>
          message: |
            <%= @username %> uploaded it using <%= @transport %>

            Bye!
        failure:
          to: support@example.com
          subject: Upload Failed!
          message: |
            Here's the problem:

            <%= @error %>

            Fix it!

As you can see, command options are turned into template variables.

=== More Info

* Docs: http://sshaw.github.io/itunes_store_transporter
* Bugs: http://github.com/sshaw/itunes_store_transporter/issues
* Source Code: http://github.com/sshaw/itunes_store_transporter
* iTunes Store Transporter: GUI: http://transportergui.com

=== Author

Skye Shaw [skye.shaw AT gmail.com]

=== License

Released under the MIT License: http://www.opensource.org/licenses/MIT

---

Made by {ScreenStaring}[http://screenstaring.com]