0.0
No commit activity in last 3 years
No release in over 3 years
Provides a friendly ruby-like interface to the Dawanda API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Runtime

= 0.4.0
 Project Readme

DaWanda¶ ↑

The Dawanda gem provides a friendly Ruby interface to the Dawanda API, plus a secure OAuth interface to get user-specific data.

Installation¶ ↑

 Installing the latest stable version is simple:

sudo gem install dawanda_client

Usage¶ ↑

The Dawanda API is read-only - all you need to gain access is an API Key (available from dawanda.com/apps). Once you have your API key, set it in your script:

require 'rubygems'
require 'dawanda'
Dawanda.api_key = 'foobar'
Dawanda.country = 'de'

From there, you can make any calls to the API that you need. Note: Any call to the API can fail. In case of an error an exception is raised. So make sure your API client codes handles it.

See the wiki for more information about what you can recieve via the DaWanda API.

Example¶ ↑

If you’re starting with a user, the easiest way is to use the Dawanda.user method:

>> user = Dawanda.get_user('meko')
=> #<Dawanda::User:0x141bf58 @result={"name"=>"meko", "city"=>"auma", "is_seller"=>true, ...
>> user.name
=> "meko"
>> user.id
=> 13008

Each user may optionally have a shop. If a user is a seller, he / she also has an associated shop object:

>> user.seller?
=> true
>> shop = user.shop
=> #<Dawanda::Shop:0x14170c0 @result={"is_vacation"=>false, "name"=>"MEKO STORE" ...
>> shop.name
=> "MEKO STORE"

See the wiki for more information about what you can recieve via the DaWanda API.

Exceptions¶ ↑

Chances are, that for some reason a HTTP request to the dawanda API can fail. This can have many reasons, either missing network connection or a wrong id. In case the HTTP status code is different von 2xx or 3xx an exception containing a meaningful error message is raised.

>> category = Dawanda::Category.find_by_id(2323)
=> RuntimeError: {"error":{"status":404,"message":"The Category 2323 could not be found"}}