james-ruminant 0.9.2 → 0.9.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. data/README +40 -5
  2. data/lib/moo.rb +1 -1
  3. metadata +1 -1
data/README CHANGED
@@ -1,6 +1,8 @@
1
1
  Ruminant
2
2
  ========
3
3
 
4
+ Aiming to make the moo API almost as easy to use for developers as the moo.com site itself.
5
+
4
6
  Installation
5
7
  ------------
6
8
 
@@ -9,16 +11,49 @@ gem sources -a http://gems.github.com
9
11
 
10
12
  Then you can install this like any other gem:
11
13
  gem install james-ruminant
12
- (Except don't just yet, as it's not done. Hang on in there)
14
+
13
15
 
14
16
  Usage
15
17
  -----
16
18
 
17
- Moo.api_key = "your api key"
18
- order = Moo::Order.new
19
- moocard = Moo::MiniCard.new(:img => "http://farm...")
19
+ 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
20
+
21
+ Making an order:
22
+ require 'rubygems'
23
+ require 'moo'
24
+ order = Moo::Order.new(:api_key => "your api key")
25
+
26
+ Adding a product:
27
+ moocard = Moo::MiniCard.new(:url => "http://farm...")
20
28
  order.designs << moocard
21
- order.to_xml
29
+
30
+ Adding text
31
+ moocard.text = "This is line 1 \n This is line 2"
32
+ moocard.line(1) #=> This is line 1
33
+ moocard.line(1).bold = true
34
+ moocard.line(1).align = "right"
35
+ moocard.line(1).font = "modern"
36
+ moocard.line(1).colour = "#444444"
37
+ moocard.bold = true # sets bold=true on all lines
38
+
39
+ Submitting to moo:
40
+ order.to_xml # Gives you the generated xml if you want to manually submit it
41
+ order.submit
42
+ if order.error?
43
+ order.error_string
44
+ else
45
+ order.start_url
46
+ end
47
+
48
+ Current Limitations
49
+ -------------------
50
+
51
+ Currently I only support MiniCards, but have made it incredibly easy to add the other supported products.
52
+ 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.
53
+
54
+ Manual Cropping is not currently supported for the same reason.
55
+
56
+ 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.
22
57
 
23
58
  Contributors thus far
24
59
  ---------------------
data/lib/moo.rb CHANGED
@@ -25,7 +25,7 @@ module Moo
25
25
  end
26
26
 
27
27
  def to_xml(xml=nil)
28
- xml = Builder::XmlMarkup.new(:target => (@xml_string ||= "")) unless xml
28
+ xml = Builder::XmlMarkup.new(:target => (@xml_string = "")) unless xml
29
29
  eval File.open(File.expand_path(File.dirname(__FILE__) + "/template.xml.builder")).read
30
30
  xml.target!
31
31
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: james-ruminant
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.2
4
+ version: 0.9.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - James Darling