money-mongoid 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
data/Gemfile CHANGED
@@ -1,10 +1,11 @@
1
- source :rubygems
1
+ source 'https://rubygems.org'
2
2
 
3
3
  gem 'money'
4
- gem 'mongoid', "~> 3.0.0"
5
- gem 'origin'
6
- gem 'moped'
4
+ gem 'mongoid', ">= 2.4"
5
+ gem 'origin', '>= 1'
6
+ gem 'moped', '>= 1'
7
7
  gem 'origin-selectable_ext'
8
+ gem 'sugar-high', '>= 0.7.2'
8
9
 
9
10
  # gem 'mongoid', "~> 2.4"
10
11
  # gem 'bson'
@@ -18,7 +19,6 @@ group :development do
18
19
  gem "simplecov",">= 0.5"
19
20
  end
20
21
 
21
- group :test do
22
- gem 'moped'
23
- gem 'bson_ext'
22
+ group :test do
23
+ gem 'bson'
24
24
  end
@@ -1,5 +1,5 @@
1
1
  GEM
2
- remote: http://rubygems.org/
2
+ remote: https://rubygems.org/
3
3
  specs:
4
4
  activemodel (3.2.8)
5
5
  activesupport (= 3.2.8)
@@ -8,8 +8,6 @@ GEM
8
8
  i18n (~> 0.6)
9
9
  multi_json (~> 1.0)
10
10
  bson (1.7.0)
11
- bson_ext (1.7.0)
12
- bson (~> 1.7.0)
13
11
  builder (3.0.3)
14
12
  diff-lcs (1.1.3)
15
13
  git (1.2.5)
@@ -48,20 +46,22 @@ GEM
48
46
  multi_json (~> 1.0)
49
47
  simplecov-html (~> 0.5.3)
50
48
  simplecov-html (0.5.3)
49
+ sugar-high (0.7.3)
51
50
  tzinfo (0.3.33)
52
51
 
53
52
  PLATFORMS
54
53
  ruby
55
54
 
56
55
  DEPENDENCIES
57
- bson_ext
56
+ bson
58
57
  bundler (>= 1.1.0)
59
58
  jeweler (>= 1.8.4)
60
59
  money
61
- mongoid (~> 3.0.0)
62
- moped
63
- origin
60
+ mongoid (>= 2.4)
61
+ moped (>= 1)
62
+ origin (>= 1)
64
63
  origin-selectable_ext
65
64
  rdoc (>= 3.12)
66
65
  rspec (>= 2.10)
67
66
  simplecov (>= 0.5)
67
+ sugar-high (>= 0.7.2)
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # Money for mongoid
2
2
 
3
- Use the [money](https://github.com/RubyMoney/money) gem with Mongoid 2.x and 3.x.
3
+ Use the [money](https://github.com/RubyMoney/money) gem with Mongoid 2.4+, 3 (and 4).
4
4
 
5
5
  ## Install
6
6
 
@@ -18,12 +18,18 @@ Bundle via Terminal:
18
18
 
19
19
  ```ruby
20
20
  require 'money-mongoid'
21
- ``
21
+ ```
22
22
 
23
23
  Now also supports MoneyRange with between queries and can even do dynamic currency conversions as part of the query!!! ;)
24
24
 
25
25
  See specs for usage examples, fx `money/mongoid/3x/money_spec.rb`
26
26
 
27
+ ## Spec note
28
+
29
+ Please note that currently the `money/mongoid/monetize_spec.rb` fails with a number of errors. Please help fix these bugs
30
+
31
+ However the `2x` and `3x` specs should pass just fine ;)
32
+
27
33
  ## Contributing to money-mongoid
28
34
 
29
35
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.2.2
@@ -1,4 +1,5 @@
1
1
  require 'money'
2
+ require 'sugar-high/delegate'
2
3
  require 'money/mongoid/core_ext'
3
4
 
4
5
  require 'money/orm/generic'
@@ -10,11 +10,11 @@ module Mongoize
10
10
 
11
11
  module ClassMethods
12
12
  def demongoize(value)
13
- ::Money.new get_cents(value), get_currency(value)
13
+ value && ::Money.new( get_cents(value), get_currency(value) )
14
14
  end
15
15
 
16
16
  def evolve(object)
17
- object.__evolve_to_money__.mongoize
17
+ object && object.__evolve_to_money__.mongoize
18
18
  end
19
19
 
20
20
  def custom_serialization?(operator)
@@ -18,19 +18,6 @@ class Money
18
18
  end
19
19
  end
20
20
 
21
- # http://blog.jayfields.com/2008/02/ruby-replace-methodmissing-with-dynamic.html
22
- class DelegateDecorator
23
- def initialize(subject)
24
- subject.public_methods(false).each do |meth|
25
- (class << self; self; end).class_eval do
26
- define_method meth do |*args|
27
- subject.send meth, *args
28
- end
29
- end
30
- end
31
- end
32
- end
33
-
34
21
  class MoneyRange < DelegateDecorator
35
22
  attr_reader :iso_code, :range
36
23
 
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "money-mongoid"
8
- s.version = "0.2.1"
8
+ s.version = "0.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Kristian Mandrup"]
12
- s.date = "2012-09-24"
12
+ s.date = "2013-02-27"
13
13
  s.description = "Makes it easy to use money with mongoid"
14
14
  s.email = "kmandrup@gmail.com"
15
15
  s.extra_rdoc_files = [
@@ -56,7 +56,7 @@ Gem::Specification.new do |s|
56
56
  s.homepage = "http://github.com/kristianmandrup/money-mongoid"
57
57
  s.licenses = ["MIT"]
58
58
  s.require_paths = ["lib"]
59
- s.rubygems_version = "1.8.24"
59
+ s.rubygems_version = "1.8.25"
60
60
  s.summary = "Mongoid support and integration for the money gem"
61
61
 
62
62
  if s.respond_to? :specification_version then
@@ -64,10 +64,11 @@ Gem::Specification.new do |s|
64
64
 
65
65
  if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
66
66
  s.add_runtime_dependency(%q<money>, [">= 0"])
67
- s.add_runtime_dependency(%q<mongoid>, ["~> 3.0.0"])
68
- s.add_runtime_dependency(%q<origin>, [">= 0"])
69
- s.add_runtime_dependency(%q<moped>, [">= 0"])
67
+ s.add_runtime_dependency(%q<mongoid>, [">= 2.4"])
68
+ s.add_runtime_dependency(%q<origin>, [">= 1"])
69
+ s.add_runtime_dependency(%q<moped>, [">= 1"])
70
70
  s.add_runtime_dependency(%q<origin-selectable_ext>, [">= 0"])
71
+ s.add_runtime_dependency(%q<sugar-high>, [">= 0.7.2"])
71
72
  s.add_development_dependency(%q<rspec>, [">= 2.10"])
72
73
  s.add_development_dependency(%q<rdoc>, [">= 3.12"])
73
74
  s.add_development_dependency(%q<bundler>, [">= 1.1.0"])
@@ -75,10 +76,11 @@ Gem::Specification.new do |s|
75
76
  s.add_development_dependency(%q<simplecov>, [">= 0.5"])
76
77
  else
77
78
  s.add_dependency(%q<money>, [">= 0"])
78
- s.add_dependency(%q<mongoid>, ["~> 3.0.0"])
79
- s.add_dependency(%q<origin>, [">= 0"])
80
- s.add_dependency(%q<moped>, [">= 0"])
79
+ s.add_dependency(%q<mongoid>, [">= 2.4"])
80
+ s.add_dependency(%q<origin>, [">= 1"])
81
+ s.add_dependency(%q<moped>, [">= 1"])
81
82
  s.add_dependency(%q<origin-selectable_ext>, [">= 0"])
83
+ s.add_dependency(%q<sugar-high>, [">= 0.7.2"])
82
84
  s.add_dependency(%q<rspec>, [">= 2.10"])
83
85
  s.add_dependency(%q<rdoc>, [">= 3.12"])
84
86
  s.add_dependency(%q<bundler>, [">= 1.1.0"])
@@ -87,10 +89,11 @@ Gem::Specification.new do |s|
87
89
  end
88
90
  else
89
91
  s.add_dependency(%q<money>, [">= 0"])
90
- s.add_dependency(%q<mongoid>, ["~> 3.0.0"])
91
- s.add_dependency(%q<origin>, [">= 0"])
92
- s.add_dependency(%q<moped>, [">= 0"])
92
+ s.add_dependency(%q<mongoid>, [">= 2.4"])
93
+ s.add_dependency(%q<origin>, [">= 1"])
94
+ s.add_dependency(%q<moped>, [">= 1"])
93
95
  s.add_dependency(%q<origin-selectable_ext>, [">= 0"])
96
+ s.add_dependency(%q<sugar-high>, [">= 0.7.2"])
94
97
  s.add_dependency(%q<rspec>, [">= 2.10"])
95
98
  s.add_dependency(%q<rdoc>, [">= 3.12"])
96
99
  s.add_dependency(%q<bundler>, [">= 1.1.0"])
@@ -1,11 +1,16 @@
1
1
  require 'money/mongoid/spec_helper'
2
- require 'money/mongoid/money'
2
+
3
+ require 'money/mongoid/monetize'
4
+ require 'money/mongoid/monetizable'
5
+
3
6
  require 'money/mongoid/2x/product'
4
7
 
5
8
  describe 'Mongoid custom Money type' do
6
9
  subject { product }
7
10
 
8
- let(:product) do { Product.create :price => Money.new(3000, 'USD') }
11
+ let(:product) do
12
+ Product.create :price => Money.new(3000, 'USD')
13
+ end
9
14
 
10
15
  its(:price) { should be_a Money }
11
16
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: money-mongoid
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-24 00:00:00.000000000 Z
12
+ date: 2013-02-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: money
@@ -32,17 +32,17 @@ dependencies:
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  none: false
34
34
  requirements:
35
- - - ~>
35
+ - - ! '>='
36
36
  - !ruby/object:Gem::Version
37
- version: 3.0.0
37
+ version: '2.4'
38
38
  type: :runtime
39
39
  prerelease: false
40
40
  version_requirements: !ruby/object:Gem::Requirement
41
41
  none: false
42
42
  requirements:
43
- - - ~>
43
+ - - ! '>='
44
44
  - !ruby/object:Gem::Version
45
- version: 3.0.0
45
+ version: '2.4'
46
46
  - !ruby/object:Gem::Dependency
47
47
  name: origin
48
48
  requirement: !ruby/object:Gem::Requirement
@@ -50,7 +50,7 @@ dependencies:
50
50
  requirements:
51
51
  - - ! '>='
52
52
  - !ruby/object:Gem::Version
53
- version: '0'
53
+ version: '1'
54
54
  type: :runtime
55
55
  prerelease: false
56
56
  version_requirements: !ruby/object:Gem::Requirement
@@ -58,7 +58,7 @@ dependencies:
58
58
  requirements:
59
59
  - - ! '>='
60
60
  - !ruby/object:Gem::Version
61
- version: '0'
61
+ version: '1'
62
62
  - !ruby/object:Gem::Dependency
63
63
  name: moped
64
64
  requirement: !ruby/object:Gem::Requirement
@@ -66,7 +66,7 @@ dependencies:
66
66
  requirements:
67
67
  - - ! '>='
68
68
  - !ruby/object:Gem::Version
69
- version: '0'
69
+ version: '1'
70
70
  type: :runtime
71
71
  prerelease: false
72
72
  version_requirements: !ruby/object:Gem::Requirement
@@ -74,7 +74,7 @@ dependencies:
74
74
  requirements:
75
75
  - - ! '>='
76
76
  - !ruby/object:Gem::Version
77
- version: '0'
77
+ version: '1'
78
78
  - !ruby/object:Gem::Dependency
79
79
  name: origin-selectable_ext
80
80
  requirement: !ruby/object:Gem::Requirement
@@ -91,6 +91,22 @@ dependencies:
91
91
  - - ! '>='
92
92
  - !ruby/object:Gem::Version
93
93
  version: '0'
94
+ - !ruby/object:Gem::Dependency
95
+ name: sugar-high
96
+ requirement: !ruby/object:Gem::Requirement
97
+ none: false
98
+ requirements:
99
+ - - ! '>='
100
+ - !ruby/object:Gem::Version
101
+ version: 0.7.2
102
+ type: :runtime
103
+ prerelease: false
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.7.2
94
110
  - !ruby/object:Gem::Dependency
95
111
  name: rspec
96
112
  requirement: !ruby/object:Gem::Requirement
@@ -229,7 +245,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
229
245
  version: '0'
230
246
  segments:
231
247
  - 0
232
- hash: 3922419886446166376
248
+ hash: 2622379676700763146
233
249
  required_rubygems_version: !ruby/object:Gem::Requirement
234
250
  none: false
235
251
  requirements:
@@ -238,7 +254,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
238
254
  version: '0'
239
255
  requirements: []
240
256
  rubyforge_project:
241
- rubygems_version: 1.8.24
257
+ rubygems_version: 1.8.25
242
258
  signing_key:
243
259
  specification_version: 3
244
260
  summary: Mongoid support and integration for the money gem