Installation from RubyGems.org
gem install fetchapp-api-ruby
Setup
FetchAppAPI::Base.basic_auth(:key => 'demokey', :token => 'demotoken')
FetchAppAPI::Base.can_connect?
Account
account = FetchAppAPI::Account.details
token = FetchAppAPI::Account.new_token
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
downloads = product.downloads
files = product.files
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 => "[email protected]",
:order_items => [{:sku => 'ABC0001'}, {:sku => 'ABC0002'}]
)
order.update(:first_name => "Daffy")
order.destroy
order.expire
order.send_email
order.stats
order_items = order.order_items
downloads = order.downloads
OrderItems
order_items = order.order_items
order_item = FetchAppAPI::Order.find("445566")
order_item.expire
downloads = order_item.downloads
files = order_item.files