Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Integrate your site with http://fetchapp.com for seamless digital storage + delivery

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .rvmrc
Octocat-spinner-32 CHANGELOG
Octocat-spinner-32 Gemfile
Octocat-spinner-32 Gemfile.lock
Octocat-spinner-32 LICENSE
Octocat-spinner-32 Manifest
Octocat-spinner-32 README.md
Octocat-spinner-32 Rakefile
Octocat-spinner-32 fetchapp-api-ruby.gemspec
Octocat-spinner-32 init.rb
README.md

Installation from RubyGems.org

gem install fetchapp-api-ruby

Setup

    FetchAppAPI::Base.basic_auth(:key => 'demokey', :token => 'demotoken')
    FetchAppAPI::Base.can_connect?  # => true or false

Account

    account = FetchAppAPI::Account.details

    token = FetchAppAPI::Account.new_token  # Subsequent calls will use the new token automatically

Downloads

    downloads = FetchAppAPI::Download.find(:all, :per_page => 50, :page => 2)

    download = FetchAppAPI::Download.find(1)

Products

    products = FetchAppAPI::Product.find(:all, :per_page => 10, :page => 3)

    product = FetchAppAPI::Product.find("CJ0001")

    product = FetchAppAPI::Product.create(:sku => "CJ0001", :name => "Carrot Juice")

    product.update(:name => "Tomato Juice")

    product.destroy

    product.stats  # Returns a FetchAppAPI::Product with only statistical fields filled in

    downloads = product.downloads  # Returns an array of FetchAppAPI::Download for this product

    files = product.files  # Returns an array of FetchAppAPI::File for this product

Orders

    all_orders = FetchAppAPI::Order.find(:all)

    current_orders = FetchAppAPI::Order.find(:current, :page => 3)

    manual_orders = FetchAppAPI::Order.find(:manual, :per_page => 10)

    expired_orders = FetchAppAPI::Order.find(:expired, :per_page => 10, :page => 3)

    order = FetchAppAPI::Order.find("1001")

    order = FetchAppAPI::Order.create(
        :id => "1015",
        :title => "Test Order",
        :first_name => "Donald",
        :last_name => "Duck",
        :email => "donald@duck.com",
        :order_items => [{:sku => 'ABC0001', :price => 10.0}, {:sku => 'ABC0002'}]
    )

    order.update(:first_name => "Daffy")

    order.destroy

    order.expire # Expires the order

    order.send_email # Reopens the order and sends out an email to the customer

    order.stats  # Returns a FetchAppAPI::Order with only statistical fields filled in

    order_items = order.order_items # Returns an array of FetchAppAPI::OrderItem for this order

    downloads = order.downloads  # Returns an array of FetchAppAPI::Download for this order

OrderItems

    order_items = order.order_items # Returns an array of FetchAppAPI::OrderItem for this order

    order_item = FetchAppAPI::Order.find("445566")

    order_item.expire # Expires the OrderItem

    downloads = order_item.downloads  # Returns an array of FetchAppAPI::Download for this order item

    files = order_item.files  # Returns an array of FetchAppAPI::File for this order item
Something went wrong with that request. Please try again.