farmingengineers 0.1.2 → 0.1.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.
- data/VERSION +1 -1
- data/farmingengineers.gemspec +2 -2
- data/invoice.rb +2 -1
- data/lib/egg_csa_invoice.rb +1 -0
- data/lib/farming_engineers/invoices/eggs.rb +15 -11
- metadata +4 -4
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.1.
|
1
|
+
0.1.3
|
data/farmingengineers.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{farmingengineers}
|
8
|
-
s.version = "0.1.
|
8
|
+
s.version = "0.1.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Matt Burke"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-18}
|
13
13
|
s.description = %q{Invoice generators, etc.}
|
14
14
|
s.email = %q{mr.matt.burke@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/invoice.rb
CHANGED
@@ -7,7 +7,8 @@ egg_csa_invoice do
|
|
7
7
|
customer 'Sample customer'
|
8
8
|
address ['123 Street', 'City, IN', '317-xxx-xxxx']
|
9
9
|
deposit '8/1/2010', 50
|
10
|
-
deliver '10/11/2010',
|
10
|
+
deliver '10/11/2010', 11
|
11
|
+
deliver '10/11/2010', 4, :rate => 4.50
|
11
12
|
purchase '11/1/2010', 'Doughnuts', 10
|
12
13
|
notes 'Notes to customer'
|
13
14
|
end
|
data/lib/egg_csa_invoice.rb
CHANGED
@@ -7,25 +7,29 @@ module FarmingEngineers ; module Invoices ; module Eggs
|
|
7
7
|
end
|
8
8
|
|
9
9
|
class History < Common::History
|
10
|
-
def deliver date, dozens
|
11
|
-
push Delivery.new(date, dozens)
|
10
|
+
def deliver date, dozens, opts = {}
|
11
|
+
push Delivery.new(date, dozens, opts)
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
15
|
class Delivery < Common::HistoryItem
|
16
|
-
def initialize(date, dozens)
|
16
|
+
def initialize(date, dozens, opts = {})
|
17
17
|
@date = date
|
18
18
|
@description = 'Delivery'
|
19
19
|
@quantity = dozens
|
20
|
+
@total = calculate opts.merge(:dozens => dozens)
|
20
21
|
end
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
22
|
+
private
|
23
|
+
def calculate opts
|
24
|
+
opts[:total] ||
|
25
|
+
opts[:dozens] * (opts[:rate] || opts[:price] ||
|
26
|
+
if opts[:dozens] < 8
|
27
|
+
5
|
28
|
+
elsif opts[:dozens] < 12
|
29
|
+
4.50
|
30
|
+
else
|
31
|
+
4
|
32
|
+
end)
|
29
33
|
end
|
30
34
|
end
|
31
35
|
end ; end ; end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: farmingengineers
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 29
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 1
|
9
|
-
-
|
10
|
-
version: 0.1.
|
9
|
+
- 3
|
10
|
+
version: 0.1.3
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Matt Burke
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2010-10-
|
18
|
+
date: 2010-10-18 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|