finexclub 0.2.1 → 0.3.0

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 CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
data/finexclub.gemspec CHANGED
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{finexclub}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Alex Levin"]
12
- s.date = %q{2010-10-11}
12
+ s.date = %q{2010-11-09}
13
13
  s.default_executable = %q{finexclub_updater}
14
14
  s.description = %q{Finexclub gem stores and retrieves Forex signals and screenshots. It is the heart of the http://trendsonforex.com and http://finexclub.net}
15
15
  s.email = %q{clubfinex@gmail.com}
@@ -59,6 +59,17 @@ module Finexclub
59
59
  end
60
60
  end
61
61
 
62
+ def define_trade_action_fields(name)
63
+ define_attr_reader(name)
64
+ define_attr_writer(name, lambda{|x| x.to_s})
65
+
66
+ %w(buy sell hold_buy hold_sell stop).each do |action|
67
+ define_method "#{name}_#{action}?" do
68
+ send("#{name}") == action
69
+ end
70
+ end
71
+ end
72
+
62
73
  def define_image_fields(name)
63
74
  define_attr_reader(name)
64
75
  define_attr_writer(name)
@@ -4,7 +4,7 @@ module Finexclub
4
4
  class Octopus < Signal
5
5
  field :symbol, :symbol
6
6
  field :updated, :timestamp
7
- field :action, :string
7
+ field :action, :trade_action
8
8
  field :take_profit, :float
9
9
  field :profit, :integer
10
10
  field :stop_loss, :float
@@ -4,7 +4,7 @@ module Finexclub
4
4
  class Prognosis < Signal
5
5
  field :symbol, :symbol
6
6
  field :updated, :timestamp
7
- field :action, :string
7
+ field :action, :trade_action
8
8
  field :take_profit, :float
9
9
  field :profit, :integer
10
10
  field :screenshot, :image
@@ -178,6 +178,23 @@ describe 'Finexclub::Document' do
178
178
  end
179
179
  end
180
180
 
181
+ # buy, sell, hold_buy, hold_sell, stop
182
+ describe 'trade_action field' do
183
+ before do
184
+ @object.apply_meta(:action => :trade_action)
185
+ end
186
+
187
+ %w(buy sell hold_buy hold_sell stop).each do |action|
188
+ it "should respond to action_#{action}? methods" do
189
+ @object.action = action
190
+ @object.send("action_#{action}?".to_sym).should == true
191
+
192
+ @object.action = "no_such_action"
193
+ @object.send("action_#{action}?".to_sym).should == false
194
+ end
195
+ end
196
+ end
197
+
181
198
  describe 'image field' do
182
199
  before do
183
200
  @object.apply_meta({:screenshot => :image})
@@ -10,7 +10,7 @@ describe 'Finexclub::Signals::Octopus' do
10
10
  Finexclub::Signals::Octopus.meta.should == {
11
11
  :updated => :timestamp,
12
12
  :symbol => :symbol,
13
- :action => :string,
13
+ :action => :trade_action,
14
14
  :take_profit => :float,
15
15
  :profit => :integer,
16
16
  :stop_loss => :float,
@@ -10,7 +10,7 @@ describe 'Finexclub::Signals::Prognosis' do
10
10
  Finexclub::Signals::Prognosis.meta.should == {
11
11
  :updated => :timestamp,
12
12
  :symbol => :symbol,
13
- :action => :string,
13
+ :action => :trade_action,
14
14
  :take_profit => :float,
15
15
  :profit => :integer,
16
16
  :screenshot => :image
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 2
8
- - 1
9
- version: 0.2.1
7
+ - 3
8
+ - 0
9
+ version: 0.3.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Alex Levin
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2010-10-11 00:00:00 +07:00
17
+ date: 2010-11-09 00:00:00 +07:00
18
18
  default_executable: finexclub_updater
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency