fossil 0.5.2 → 0.5.3
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +3 -0
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/fossil.gemspec +16 -6
- data/lib/dbr_models/group_cost.rb +3 -0
- data/lib/dbr_models/quote.rb +9 -0
- data/lib/dbr_models/trip.rb +5 -0
- data/lib/dbr_models/trip_leg.rb +24 -0
- data/lib/fossil.rb +2 -10
- data/lib/models/trip_leg.rb +2 -2
- data/lib/sequel/core_patch.rb +9 -0
- data/lib/sequel/fos_dates.rb +1 -2
- data/spec/models/trip_leg_spec.rb +26 -16
- data/spec/sequel/core_patch_spec.rb +19 -1
- data/spec/sequel/fos_dates_spec.rb +2 -0
- data/spec/sequel/serializer/json_serializer_spec.rb +2 -1
- data/spec/sequel/serializer/json_serializer_with_active_support_spec.rb +40 -0
- metadata +14 -7
data/README.rdoc
ADDED
data/Rakefile
CHANGED
@@ -9,7 +9,7 @@
|
|
9
9
|
gemspec.description = "Access FOS/betrieve db with this Sequel based orm wrapper"
|
10
10
|
gemspec.email = "plardin@xojet.com"
|
11
11
|
gemspec.homepage = ""
|
12
|
-
gemspec.add_dependency('sequel', '= 3.
|
12
|
+
gemspec.add_dependency('sequel', '= 3.14.0')
|
13
13
|
gemspec.add_dependency('ruby-odbc')
|
14
14
|
gemspec.add_development_dependency('rspec')
|
15
15
|
gemspec.authors = ["Patrick Lardin, Daniel Sudol"]
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.5.
|
1
|
+
0.5.3
|
data/fossil.gemspec
CHANGED
@@ -5,18 +5,26 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{fossil}
|
8
|
-
s.version = "0.5.
|
8
|
+
s.version = "0.5.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Patrick Lardin, Daniel Sudol"]
|
12
|
-
s.date = %q{2010-10-
|
12
|
+
s.date = %q{2010-10-26}
|
13
13
|
s.description = %q{Access FOS/betrieve db with this Sequel based orm wrapper}
|
14
14
|
s.email = %q{plardin@xojet.com}
|
15
|
+
s.extra_rdoc_files = [
|
16
|
+
"README.rdoc"
|
17
|
+
]
|
15
18
|
s.files = [
|
16
|
-
"
|
19
|
+
"README.rdoc",
|
20
|
+
"Rakefile",
|
17
21
|
"VERSION",
|
18
22
|
"fossil.gemspec",
|
19
23
|
"lib/date_extentions.rb",
|
24
|
+
"lib/dbr_models/group_cost.rb",
|
25
|
+
"lib/dbr_models/quote.rb",
|
26
|
+
"lib/dbr_models/trip.rb",
|
27
|
+
"lib/dbr_models/trip_leg.rb",
|
20
28
|
"lib/delegate_method.rb",
|
21
29
|
"lib/fos_schema/FOS_SCHEMA_3.8.22.r3.csv",
|
22
30
|
"lib/fos_schema/FOS_SCHEMA_3.8.27.r1.csv",
|
@@ -146,6 +154,7 @@ Gem::Specification.new do |s|
|
|
146
154
|
"spec/sequel/model_patch_spec.rb",
|
147
155
|
"spec/sequel/pervasive_adapter_spec.rb",
|
148
156
|
"spec/sequel/serializer/json_serializer_spec.rb",
|
157
|
+
"spec/sequel/serializer/json_serializer_with_active_support_spec.rb",
|
149
158
|
"spec/sequel/serializer/xml_serializer_spec.rb",
|
150
159
|
"spec/sequel/spec_helper_tables.rb",
|
151
160
|
"spec/spec_helper.rb"
|
@@ -164,6 +173,7 @@ Gem::Specification.new do |s|
|
|
164
173
|
"spec/sequel/fos_dates_spec.rb",
|
165
174
|
"spec/sequel/core_patch_spec.rb",
|
166
175
|
"spec/sequel/spec_helper_tables.rb",
|
176
|
+
"spec/sequel/serializer/json_serializer_with_active_support_spec.rb",
|
167
177
|
"spec/sequel/serializer/json_serializer_spec.rb",
|
168
178
|
"spec/sequel/serializer/xml_serializer_spec.rb",
|
169
179
|
"spec/sequel/pervasive_adapter_spec.rb",
|
@@ -182,16 +192,16 @@ Gem::Specification.new do |s|
|
|
182
192
|
s.specification_version = 3
|
183
193
|
|
184
194
|
if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
|
185
|
-
s.add_runtime_dependency(%q<sequel>, ["= 3.
|
195
|
+
s.add_runtime_dependency(%q<sequel>, ["= 3.14.0"])
|
186
196
|
s.add_runtime_dependency(%q<ruby-odbc>, [">= 0"])
|
187
197
|
s.add_development_dependency(%q<rspec>, [">= 0"])
|
188
198
|
else
|
189
|
-
s.add_dependency(%q<sequel>, ["= 3.
|
199
|
+
s.add_dependency(%q<sequel>, ["= 3.14.0"])
|
190
200
|
s.add_dependency(%q<ruby-odbc>, [">= 0"])
|
191
201
|
s.add_dependency(%q<rspec>, [">= 0"])
|
192
202
|
end
|
193
203
|
else
|
194
|
-
s.add_dependency(%q<sequel>, ["= 3.
|
204
|
+
s.add_dependency(%q<sequel>, ["= 3.14.0"])
|
195
205
|
s.add_dependency(%q<ruby-odbc>, [">= 0"])
|
196
206
|
s.add_dependency(%q<rspec>, [">= 0"])
|
197
207
|
end
|
@@ -0,0 +1,9 @@
|
|
1
|
+
class Quote
|
2
|
+
|
3
|
+
many_to_one :trip, :class=>:Trip, :key=>:trip_id
|
4
|
+
many_to_one :requester, :class=>:Passenger, :key=>:pax_id
|
5
|
+
many_to_one :group_cost, :class=>:GroupCost, :key=>:costgroup_id
|
6
|
+
one_to_many :quote_legs, :class=>:QuoteLeg, :key=>:quotes_id, :primary_key=>:id
|
7
|
+
many_to_one :client_invoice_comment, :class=>:Comment, :key=>:client_invoice_comment_id
|
8
|
+
|
9
|
+
end
|
@@ -0,0 +1,5 @@
|
|
1
|
+
class Trip
|
2
|
+
one_to_many :passengers, :class => :TripPassenger, :key=>:trip_id, :primary_key=>:id
|
3
|
+
many_to_one :trip_requester, :class => :Passenger, :key=>:requester_id
|
4
|
+
one_to_many :trip_legs, :class => :TripLeg, :key=>:'trip number', :primary_key=>:'trip number'
|
5
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
################################################################################
|
2
|
+
#
|
3
|
+
# This TripLeg is overriding the TripLeg model in fossil.
|
4
|
+
# It is pulling data from the mysql in memory database which is a copy of the fos
|
5
|
+
# trip leg table but with an added id column, and single ids for all foreign keys,
|
6
|
+
# so the associations are all rewritten to use the single primary key.
|
7
|
+
# The other methods are special methods for datamart trip_leg summary table
|
8
|
+
#
|
9
|
+
class TripLeg
|
10
|
+
one_to_many :crew_legs, :class=>:CrewLeg, :key=>:trip_leg_id, :primary_key=>:id
|
11
|
+
one_to_many :flight_log_expenses, :class=>:FlightLogExpense, :key=>:trip_leg_id, :primary_key=>:id
|
12
|
+
many_to_one :trip, :class=>:Trip, :key=>:trips_id
|
13
|
+
many_to_one :arrival_fbo, :class=>:AirportFbo, :key=>:fbo_id
|
14
|
+
many_to_one :departure_fbo, :class=>:AirportFbo, :key=>:fueler_id
|
15
|
+
many_to_one :trip_requester, :class=>:Passenger, :key=>:requester_id
|
16
|
+
many_to_one :leg_requestor, :class=>:Passenger, :key=>:leg_req_id
|
17
|
+
many_to_one :departure_catering_comment, :class=>:Comment, :key=>:departure_catering_comment_id
|
18
|
+
many_to_one :arrival_catering_comment, :class=>:Comment, :key=>:arrival_catering_comment_id
|
19
|
+
many_to_one :departure_transport_comment, :class=>:Comment, :key=>:departure_transport_comment_id
|
20
|
+
many_to_one :arrival_transport_comment, :class=>:Comment, :key=>:arrival_transport_comment_id
|
21
|
+
many_to_one :departure_general_comment, :class=>:Comment, :key=>:departure_general_comment_id
|
22
|
+
many_to_one :arrival_general_comment, :class=>:Comment, :key=>:arrival_general_comment_id
|
23
|
+
|
24
|
+
end
|
data/lib/fossil.rb
CHANGED
@@ -1,20 +1,12 @@
|
|
1
1
|
require 'rubygems'
|
2
2
|
|
3
3
|
begin
|
4
|
-
gem 'sequel', '=3.
|
4
|
+
gem 'sequel', '=3.14.0'
|
5
5
|
require('sequel')
|
6
6
|
rescue LoadError => e
|
7
|
-
raise("To use Fossil you need the sequel gem:\n '$ sudo gem install sequel -v=3.
|
7
|
+
raise("To use Fossil you need the sequel gem:\n '$ sudo gem install sequel -v=3.14.0'")
|
8
8
|
end
|
9
9
|
|
10
|
-
#begin
|
11
|
-
# gem 'activesupport', '=2.3.5'
|
12
|
-
# require('active_support')
|
13
|
-
#rescue LoadError => e
|
14
|
-
# p e.message
|
15
|
-
# raise "To use Fossil you need the active_support gem: '$ sudo gem install active_support -v=2.3.5'"
|
16
|
-
#end
|
17
|
-
|
18
10
|
dir = File.dirname(__FILE__)
|
19
11
|
files = [File.join(dir,'number_helper.rb')] +
|
20
12
|
[File.join(dir,'hash_extentions.rb')] +
|
data/lib/models/trip_leg.rb
CHANGED
@@ -63,10 +63,10 @@ class TripLeg < Sequel::Model(:'trip legs')
|
|
63
63
|
many_to_one :departure_fbo_comment_value, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>43) }
|
64
64
|
many_to_one :arrival_fbo_comment_value, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>34) }
|
65
65
|
many_to_one :departure_catering_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>37) }
|
66
|
-
many_to_one :departure_transport_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>41) }
|
67
|
-
many_to_one :departure_general_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>183) }
|
68
66
|
many_to_one :arrival_catering_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>1) }
|
67
|
+
many_to_one :departure_transport_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>41) }
|
69
68
|
many_to_one :arrival_transport_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>36) }
|
69
|
+
many_to_one :departure_general_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>183) }
|
70
70
|
many_to_one :arrival_general_comment, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>185) }
|
71
71
|
|
72
72
|
many_to_one :limo_comment_value, :class=>:Comment, :key=>nil, :dataset=>proc { Comment.filter( :"kid - date"=>self[:"kid - date"], :"kid - time"=>self[:"kid - time"], :"kid - user"=>self[:"kid - user"], :"kid - mult"=>self[:"kid - mult"], :"kid - comm"=>self[:"limo comment"]) }
|
data/lib/sequel/core_patch.rb
CHANGED
@@ -7,6 +7,15 @@ module Sequel
|
|
7
7
|
db
|
8
8
|
end
|
9
9
|
|
10
|
+
def fos_dbr(opts={})
|
11
|
+
db = Sequel.mysql(opts)
|
12
|
+
db.extend(MySql::Pervasive::DatabaseMethods)
|
13
|
+
# require the dbr libs
|
14
|
+
dbr_lib_dir = File.join(File.dirname(__FILE__),'..','lib','dbr_fos_models')
|
15
|
+
Dir.glob(File.join(dbr_lib_dir , '*.rb')).each{|f| require f}
|
16
|
+
db
|
17
|
+
end
|
18
|
+
|
10
19
|
# sets the db to all sequel models
|
11
20
|
def set_db(db)
|
12
21
|
Sequel::Model.find_children.each { |klass| klass.to_s.constantize.db=db }
|
data/lib/sequel/fos_dates.rb
CHANGED
@@ -22,8 +22,7 @@ class Date
|
|
22
22
|
def to_time(dest, method)
|
23
23
|
#Convert a fraction of a day to a number of microseconds
|
24
24
|
usec = (dest.send(:sec_fraction) * 60 * 60 * 24 * (10**6)).to_i
|
25
|
-
Time.send(method, dest.year, dest.month, dest.day, dest.send(:hour), dest.send(:min),
|
26
|
-
dest.send(:sec), usec)
|
25
|
+
Time.send(method, dest.year, dest.month, dest.day, dest.send(:hour), dest.send(:min), dest.send(:sec), usec)
|
27
26
|
end
|
28
27
|
end
|
29
28
|
|
@@ -2,6 +2,12 @@ require File.expand_path(File.dirname(__FILE__) + '/../spec_helper')
|
|
2
2
|
|
3
3
|
describe TripLeg do
|
4
4
|
|
5
|
+
it "catering association works with eager graph" do
|
6
|
+
set_fos_db([TripLeg,Comment])
|
7
|
+
t = TripLeg.filter(:'trip legs__kid_date'=>66254).eager_graph(:aircraft).limit(1).all.first
|
8
|
+
t.departure_general_comment
|
9
|
+
end
|
10
|
+
|
5
11
|
# describe "arrival_airport assoc works" do
|
6
12
|
# before :all do
|
7
13
|
# set_fos_db([Airport])
|
@@ -81,16 +87,16 @@ describe TripLeg do
|
|
81
87
|
# tl = TripLeg.new(:arrival_date_gmt=>arr_date_act_gmt.to_fos_days, :land_time_act_gmt=>20, :arriv_time_act_gmt=>40)
|
82
88
|
# tl.actual_land_date_time_gmt.should == DateTime.new(1900, 1, 2, 0, 20, 0)
|
83
89
|
# end
|
84
|
-
|
85
|
-
it "actual arrival date_time base are correctly calculating the tz offset" do
|
86
|
-
arr_date_act_gmt = Date.new(1900, 1, 2)
|
87
|
-
arriv_time_act_gmt = 1420
|
88
|
-
home_tz_gmt_offset = -70
|
89
|
-
tl = TripLeg.new(:arrival_date_gmt => arr_date_act_gmt.to_fos_days, :arriv_time_act_gmt => arriv_time_act_gmt,
|
90
|
-
:home_tz_gmt_offset => home_tz_gmt_offset)
|
91
|
-
tl.actual_arrival_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
|
92
|
-
end
|
93
|
-
|
90
|
+
#
|
91
|
+
# it "actual arrival date_time base are correctly calculating the tz offset" do
|
92
|
+
# arr_date_act_gmt = Date.new(1900, 1, 2)
|
93
|
+
# arriv_time_act_gmt = 1420
|
94
|
+
# home_tz_gmt_offset = -70
|
95
|
+
# tl = TripLeg.new(:arrival_date_gmt => arr_date_act_gmt.to_fos_days, :arriv_time_act_gmt => arriv_time_act_gmt,
|
96
|
+
# :home_tz_gmt_offset => home_tz_gmt_offset)
|
97
|
+
# tl.actual_arrival_date_time_base.should == DateTime.new(1900, 1, 2, 16, 40, 0)
|
98
|
+
# end
|
99
|
+
#
|
94
100
|
# it "actual departure date_time base are correctly calculating the tz offset" do
|
95
101
|
# dept_date_act_gmt = Date.new(1900, 1, 2)
|
96
102
|
# dept_time_act_gmt = 1420
|
@@ -123,11 +129,11 @@ describe TripLeg do
|
|
123
129
|
# tl = TripLeg.new(:trip_number=>100, :leg_number=>1, :trip=>@t)
|
124
130
|
# tl.passenger_list.should == ''
|
125
131
|
# end
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
|
132
|
+
##
|
133
|
+
#### it "when leg has no pax/deadhead" do
|
134
|
+
#### tl = TripLeg.new(:trip_number=>100,:leg_number=>1, :trip=>@t, :status=>1,:deadhead=>1)
|
135
|
+
#### tl.passenger_list.should == ''
|
136
|
+
#### end
|
131
137
|
#
|
132
138
|
# it "when leg has some in range ( and put lead pax name first )" do
|
133
139
|
# stub(@t).passengers { [@p1, @p2, @p3] }
|
@@ -154,7 +160,11 @@ describe TripLeg do
|
|
154
160
|
# tl = TripLeg.new(:trip_number=>100, :leg_number=>3, :trip=>@t)
|
155
161
|
# tl.total_trip_statute_miles.should == 10.0
|
156
162
|
# end
|
157
|
-
|
163
|
+
|
164
|
+
|
165
|
+
|
166
|
+
|
167
|
+
|
158
168
|
# describe 'crew brief fields' do
|
159
169
|
# before :all do
|
160
170
|
# set_fos_db([TripLeg, Comment])
|
@@ -7,7 +7,7 @@ describe Sequel do
|
|
7
7
|
@db = Sequel.fos('fos')
|
8
8
|
end
|
9
9
|
|
10
|
-
it "
|
10
|
+
it "instantiates a fos/pervasive db from an odbc name" do
|
11
11
|
@db.should_not be nil
|
12
12
|
end
|
13
13
|
|
@@ -17,6 +17,24 @@ describe Sequel do
|
|
17
17
|
end
|
18
18
|
end
|
19
19
|
|
20
|
+
describe "has method 'fos_dbr' that" do
|
21
|
+
before :all do
|
22
|
+
hash = {:host=>'hrkdm.pcmt.local', :user=>'datamart', :password=>'datap@ss', :database=>'dbr'}
|
23
|
+
@db = Sequel.fos_dbr(hash)
|
24
|
+
end
|
25
|
+
|
26
|
+
it "instantiates dbr/mysql db from hash of params name" do
|
27
|
+
@db.should_not be nil
|
28
|
+
end
|
29
|
+
|
30
|
+
it "actually works to see dbr tables" do
|
31
|
+
TripLeg.db=@db
|
32
|
+
TripLeg.first.should_not be nil
|
33
|
+
Aircraft.db=@db
|
34
|
+
TripLeg.first.aircraft.should_not be nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
20
38
|
it "set_db method finds sets db on all Sequel models" do
|
21
39
|
db = Sequel.fos('fos')
|
22
40
|
Sequel.set_db db
|
@@ -41,6 +41,8 @@ describe "fos_dates" do
|
|
41
41
|
|
42
42
|
it "DateTime from fos date time" do
|
43
43
|
DateTime.from_fos_date_time(40209,100).should == DateTime.new(2010,2,1,1,40,0)
|
44
|
+
p DateTime.from_fos_date_time(0,1440)
|
45
|
+
DateTime.from_fos_date_time(0,100).should == DateTime.new(1899,12,31,1,40,0)
|
44
46
|
end
|
45
47
|
|
46
48
|
it "DateTime has long_view method that makes long formatted string" do
|
@@ -24,6 +24,8 @@ describe "Sequel::Serializer" do
|
|
24
24
|
add_test_table_data({:id=>1, :'goofy name col' => 123})
|
25
25
|
array = [TestTable.first]
|
26
26
|
array.to_fos_json(:methods=>[:'goofy name col']).should=="[{\"goofy name col\":123}]"
|
27
|
+
# another one just in case
|
28
|
+
Dude.all.to_fos_json(:methods=>[:name]).should == "[{\"name\":\"dano\"},{\"name\":\"eric\"}]"
|
27
29
|
end
|
28
30
|
|
29
31
|
it "shows methods which are dynamically delegated" do
|
@@ -31,7 +33,6 @@ describe "Sequel::Serializer" do
|
|
31
33
|
data = TestTable.first
|
32
34
|
data.to_fos_json(:methods=>[:date_col__round]).should == "{\"date_col__round\":123}"
|
33
35
|
end
|
34
|
-
|
35
36
|
end
|
36
37
|
|
37
38
|
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/../../spec_helper'
|
2
|
+
require File.dirname(__FILE__) + '/../spec_helper_tables' unless metaclass.class_variable_defined? :@@set_up_demo_tables
|
3
|
+
|
4
|
+
require 'active_support'
|
5
|
+
|
6
|
+
describe "Sequel::Serializer with active support loaded" do
|
7
|
+
|
8
|
+
describe "to_fos_json method" do
|
9
|
+
before :each do
|
10
|
+
set_demo_db([TestTable,Dude,Horse])
|
11
|
+
end
|
12
|
+
|
13
|
+
it "adds :only=>[] to the options hash" do
|
14
|
+
data = Trip.new
|
15
|
+
mock(data).to_json({:only=>[], :methods=>[]})
|
16
|
+
data.to_fos_json(:methods=>[])
|
17
|
+
end
|
18
|
+
|
19
|
+
it "handles single sequel model" do
|
20
|
+
add_test_table_data({:id=>1, :'goofy name col' => 123})
|
21
|
+
data = TestTable.first
|
22
|
+
data.to_fos_json(:methods=>[:'goofy name col']).should == "{\"goofy name col\":123}"
|
23
|
+
end
|
24
|
+
|
25
|
+
it "handles an array of sequel models" do
|
26
|
+
add_test_table_data({:id=>1, :'goofy name col' => 123})
|
27
|
+
array = [TestTable.first]
|
28
|
+
array.to_fos_json(:methods=>[:'goofy name col']).should=="[{\"goofy name col\":123}]"
|
29
|
+
# another one just in case
|
30
|
+
Dude.all.to_fos_json(:methods=>[:name]).should == "[{\"name\":\"dano\"},{\"name\":\"eric\"}]"
|
31
|
+
end
|
32
|
+
|
33
|
+
it "shows methods which are dynamically delegated" do
|
34
|
+
add_test_table_data({:id=>1, :'date_col' => 123})
|
35
|
+
data = TestTable.first
|
36
|
+
data.to_fos_json(:methods=>[:date_col__round]).should == "{\"date_col__round\":123}"
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
end
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 5
|
8
|
-
-
|
9
|
-
version: 0.5.
|
8
|
+
- 3
|
9
|
+
version: 0.5.3
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Patrick Lardin, Daniel Sudol
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-10-
|
17
|
+
date: 2010-10-26 00:00:00 -07:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -27,9 +27,9 @@ dependencies:
|
|
27
27
|
- !ruby/object:Gem::Version
|
28
28
|
segments:
|
29
29
|
- 3
|
30
|
-
-
|
30
|
+
- 14
|
31
31
|
- 0
|
32
|
-
version: 3.
|
32
|
+
version: 3.14.0
|
33
33
|
type: :runtime
|
34
34
|
version_requirements: *id001
|
35
35
|
- !ruby/object:Gem::Dependency
|
@@ -64,13 +64,18 @@ executables: []
|
|
64
64
|
|
65
65
|
extensions: []
|
66
66
|
|
67
|
-
extra_rdoc_files:
|
68
|
-
|
67
|
+
extra_rdoc_files:
|
68
|
+
- README.rdoc
|
69
69
|
files:
|
70
|
+
- README.rdoc
|
70
71
|
- Rakefile
|
71
72
|
- VERSION
|
72
73
|
- fossil.gemspec
|
73
74
|
- lib/date_extentions.rb
|
75
|
+
- lib/dbr_models/group_cost.rb
|
76
|
+
- lib/dbr_models/quote.rb
|
77
|
+
- lib/dbr_models/trip.rb
|
78
|
+
- lib/dbr_models/trip_leg.rb
|
74
79
|
- lib/delegate_method.rb
|
75
80
|
- lib/fos_schema/FOS_SCHEMA_3.8.22.r3.csv
|
76
81
|
- lib/fos_schema/FOS_SCHEMA_3.8.27.r1.csv
|
@@ -200,6 +205,7 @@ files:
|
|
200
205
|
- spec/sequel/model_patch_spec.rb
|
201
206
|
- spec/sequel/pervasive_adapter_spec.rb
|
202
207
|
- spec/sequel/serializer/json_serializer_spec.rb
|
208
|
+
- spec/sequel/serializer/json_serializer_with_active_support_spec.rb
|
203
209
|
- spec/sequel/serializer/xml_serializer_spec.rb
|
204
210
|
- spec/sequel/spec_helper_tables.rb
|
205
211
|
- spec/spec_helper.rb
|
@@ -244,6 +250,7 @@ test_files:
|
|
244
250
|
- spec/sequel/fos_dates_spec.rb
|
245
251
|
- spec/sequel/core_patch_spec.rb
|
246
252
|
- spec/sequel/spec_helper_tables.rb
|
253
|
+
- spec/sequel/serializer/json_serializer_with_active_support_spec.rb
|
247
254
|
- spec/sequel/serializer/json_serializer_spec.rb
|
248
255
|
- spec/sequel/serializer/xml_serializer_spec.rb
|
249
256
|
- spec/sequel/pervasive_adapter_spec.rb
|