public
Rubygem
Fork of james/ruminant
Description: A ruby library to regurgitate MOO products
Homepage:
Clone URL: git://github.com/infovore/ruminant.git
ruminant / README
100644 70 lines (53 sloc) 2.12 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
Ruminant
========
 
Aiming to make the moo API almost as easy to use for developers as the moo.com site itself.
 
Installation
------------
 
If you've never installed a gem from github before - enter the following and you will eternally be graced by a thousand minds:
gem sources -a http://gems.github.com
 
Then you can install this like any other gem:
gem install infovore-ruminant
 
Usage
-----
 
All parameters are done in an ActiveRecord attributes style, i.e. they can be passed into new() as a hash, and are all attr-accessors. Note that product objects do not have attributes that are not impossible for that product, and that a Sticker will raise an error if you try to give it text.
 
Making an order:
require 'rubygems'
require 'moo'
order = Moo::Order.new(:api_key => "your api key")
 
Adding a product:
moocard = Moo::MiniCard.new(:url => "http://farm...")
order.designs << moocard
 
Adding text
moocard.text = "This is line 1 \n This is line 2"
moocard.line(1) #=> This is line 1
moocard.line(1).bold = true
moocard.line(1).align = "right"
moocard.line(1).font = "modern"
moocard.line(1).colour = "#444444"
moocard.bold = true # sets bold=true on all lines
 
Submitting to moo:
order.to_xml # Gives you the generated xml if you want to manually submit it
order.submit
if order.error?
  order.error_string
else
  order.start_url
end
 
Current Limitations
-------------------
 
Currently I only support MiniCards and Stickers, but have made it incredibly easy to add the other supported products.
I haven't yet, as I do not have a personal need, so don't feel I can test it. If you have such a need, do let me know, as we can add it.
 
Manual Cropping is not currently supported for the same reason.
 
Please please please do feel to give feedback and/or submit patches. I want this library to be as helpful as possible, but can only do that if I know what you want.
 
Contributors thus far
---------------------
Xenia Kingsley - Naming powers
Chris Mear - Fixing stuff, and provides the wine
Dan Webb - Wisdom
Tom Armitage - adding Moo::Sticker
 
 
         (__)
         (oo)
  /-------\/
 / | ||
* ||----||
   ~~ ~~