ntimeline 0.1.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/History.txt +4 -0
- data/License.txt +3 -0
- data/Manifest.txt +31 -0
- data/README.txt +19 -0
- data/Rakefile +4 -0
- data/config/hoe.rb +83 -0
- data/config/requirements.rb +17 -0
- data/lib/ntimeline.rb +172 -0
- data/lib/ntimeline/article.rb +146 -0
- data/lib/ntimeline/category.rb +25 -0
- data/lib/ntimeline/pager.rb +72 -0
- data/lib/ntimeline/timeline.rb +186 -0
- data/lib/ntimeline/user.rb +31 -0
- data/lib/ntimeline/version.rb +9 -0
- data/log/debug.log +0 -0
- data/script/destroy +14 -0
- data/script/generate +14 -0
- data/script/txt2html +74 -0
- data/setup.rb +1585 -0
- data/spec/ntimeline_spec.rb +293 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +14 -0
- data/tasks/deployment.rake +34 -0
- data/tasks/environment.rake +7 -0
- data/tasks/rspec.rake +21 -0
- data/tasks/website.rake +17 -0
- data/website/index.html +204 -0
- data/website/index.txt +122 -0
- data/website/javascripts/rounded_corners_lite.inc.js +285 -0
- data/website/stylesheets/screen.css +138 -0
- data/website/template.rhtml +48 -0
- metadata +88 -0
@@ -0,0 +1,293 @@
|
|
1
|
+
require File.dirname(__FILE__) + '/spec_helper.rb'
|
2
|
+
|
3
|
+
include NTimeLine
|
4
|
+
|
5
|
+
describe NTimeLine do
|
6
|
+
before(:all) do
|
7
|
+
@timeline =
|
8
|
+
TimeLine.create(:timeline_key => $timeline_key,
|
9
|
+
:title => "NTimeLine TEST",
|
10
|
+
:description => "This is a test for NTimeLine.",
|
11
|
+
:label_for_vaxis => "dummy",
|
12
|
+
:open_level => 1,
|
13
|
+
:lock_level => 1,
|
14
|
+
:initial_position => "last",
|
15
|
+
:category => "TimeLine")
|
16
|
+
end
|
17
|
+
|
18
|
+
after(:all) do
|
19
|
+
@timeline.delete(true)
|
20
|
+
end
|
21
|
+
|
22
|
+
describe NTimeLine::TimeLine do
|
23
|
+
|
24
|
+
it "should be equal same id timelines" do
|
25
|
+
timeline = NTimeLine::TimeLine.show(@timeline.id,
|
26
|
+
{:timeline_key => $timeline_key})
|
27
|
+
@timeline.should == timeline
|
28
|
+
end
|
29
|
+
|
30
|
+
it "should have id" do
|
31
|
+
@timeline.id.should_not be_nil
|
32
|
+
end
|
33
|
+
|
34
|
+
it "should have title" do
|
35
|
+
@timeline.title.should == "NTimeLine TEST"
|
36
|
+
end
|
37
|
+
|
38
|
+
it "should have description" do
|
39
|
+
@timeline.description.should == "This is a test for NTimeLine."
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should have label_for_vaxis" do
|
43
|
+
@timeline.label_for_vaxis.should == "dummy"
|
44
|
+
end
|
45
|
+
|
46
|
+
it "should have vaxis_mode" do
|
47
|
+
@timeline.vaxis_mode.should == "numeric"
|
48
|
+
end
|
49
|
+
|
50
|
+
it "should have lock_level" do
|
51
|
+
@timeline.lock_level.should == 1
|
52
|
+
end
|
53
|
+
|
54
|
+
it "should have labels" do
|
55
|
+
@timeline.labels.should == []
|
56
|
+
end
|
57
|
+
|
58
|
+
it "should have time_scale" do
|
59
|
+
@timeline.time_scale.should == "default"
|
60
|
+
end
|
61
|
+
|
62
|
+
it "should have initial_position" do
|
63
|
+
@timeline.initial_position.should == "last"
|
64
|
+
end
|
65
|
+
|
66
|
+
it "should have commentable" do
|
67
|
+
@timeline.commentable.should be_true
|
68
|
+
end
|
69
|
+
|
70
|
+
it "should have open_level" do
|
71
|
+
@timeline.open_level.should == 1
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should have opend_for" do
|
75
|
+
@timeline.opened_for.should == []
|
76
|
+
end
|
77
|
+
|
78
|
+
it "should have lock_level" do
|
79
|
+
@timeline.lock_level.should == 1
|
80
|
+
end
|
81
|
+
|
82
|
+
it "should have locked_for" do
|
83
|
+
@timeline.locked_for.should == []
|
84
|
+
end
|
85
|
+
|
86
|
+
it "should have created_at" do
|
87
|
+
@timeline.created_at.should be_a_kind_of(Time)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "should have updated_at" do
|
91
|
+
@timeline.updated_at.should be_a_kind_of(Time)
|
92
|
+
end
|
93
|
+
|
94
|
+
it "should have score" do
|
95
|
+
@timeline.score.should >= 0
|
96
|
+
end
|
97
|
+
|
98
|
+
it "should have point" do
|
99
|
+
@timeline.point.should >= 0
|
100
|
+
end
|
101
|
+
|
102
|
+
it "should have page_view" do
|
103
|
+
@timeline.page_view.should >= 0
|
104
|
+
end
|
105
|
+
|
106
|
+
it "should have category" do
|
107
|
+
@timeline.category.should == "timeline"
|
108
|
+
end
|
109
|
+
|
110
|
+
describe "when create" do
|
111
|
+
before do
|
112
|
+
@created = nil
|
113
|
+
@required = {
|
114
|
+
:timeline_key => $timeline_key,
|
115
|
+
:title => "NTimeLine test",
|
116
|
+
:description => "This is a test for NTimeLine library.",
|
117
|
+
:label_for_vaxis => "dummy"
|
118
|
+
}
|
119
|
+
end
|
120
|
+
|
121
|
+
it "should require title" do
|
122
|
+
@required.delete(:title)
|
123
|
+
Proc.new do
|
124
|
+
@created = NTimeLine::TimeLine.create(@required)
|
125
|
+
end.should raise_error(ArgumentError)
|
126
|
+
end
|
127
|
+
|
128
|
+
it "should require description" do
|
129
|
+
@required.delete(:description)
|
130
|
+
Proc.new do
|
131
|
+
@created = NTimeLine::TimeLine.create(@required)
|
132
|
+
end.should raise_error(ArgumentError)
|
133
|
+
end
|
134
|
+
|
135
|
+
it "should require label_for_vaxis" do
|
136
|
+
@required.delete(:label_for_vaxis)
|
137
|
+
Proc.new do
|
138
|
+
@created = NTimeLine::TimeLine.create(@required)
|
139
|
+
end.should raise_error(ArgumentError)
|
140
|
+
end
|
141
|
+
|
142
|
+
after do
|
143
|
+
@created.delete if @created
|
144
|
+
end
|
145
|
+
end
|
146
|
+
|
147
|
+
describe "when update" do
|
148
|
+
it "updated_at" do
|
149
|
+
old = @timeline.updated_at
|
150
|
+
@timeline.update({:title => "aaaa"}).updated_at.should >= old
|
151
|
+
end
|
152
|
+
|
153
|
+
it "can update" do
|
154
|
+
@timeline.update({:title => "UPDATED"}).title.should == "UPDATED"
|
155
|
+
end
|
156
|
+
end
|
157
|
+
|
158
|
+
describe "when search" do
|
159
|
+
it "can search by owner" do
|
160
|
+
pager = NTimeLine::TimeLine.search_by_owner(NTimeLine::User.me($timeline_key).nickname,
|
161
|
+
{:timeline_key => $timeline_key})
|
162
|
+
pager.should be_a_kind_of(NTimeLine::TimeLinePager)
|
163
|
+
pager.total.should > 0
|
164
|
+
found = false
|
165
|
+
while pager do
|
166
|
+
if pager.timelines.include?(@timeline)
|
167
|
+
found = true
|
168
|
+
break
|
169
|
+
end
|
170
|
+
pager = pager.next
|
171
|
+
end
|
172
|
+
found.should be_true
|
173
|
+
end
|
174
|
+
|
175
|
+
it "can search by phrase" do
|
176
|
+
pager = NTimeLine::TimeLine.search_by_phrase("NTimeLine",
|
177
|
+
{:timeline_key => $timeline_key})
|
178
|
+
pager.should be_a_kind_of(NTimeLine::TimeLinePager)
|
179
|
+
pager.total.should > 0
|
180
|
+
p pager
|
181
|
+
found = false
|
182
|
+
while pager do
|
183
|
+
if pager.timelines.include?(@timeline)
|
184
|
+
found = true
|
185
|
+
break
|
186
|
+
end
|
187
|
+
pager = pager.next
|
188
|
+
end
|
189
|
+
found.should be_true
|
190
|
+
end
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
describe NTimeLine::Article do
|
195
|
+
before(:all) do
|
196
|
+
@start_time = Time.now
|
197
|
+
@end_time = Time.now
|
198
|
+
@article =
|
199
|
+
@timeline.create_article(:title => "event1",
|
200
|
+
:description => "This is a test event.",
|
201
|
+
:start_time => Time.now,
|
202
|
+
:end_time => Time.now,
|
203
|
+
:grade => 10)
|
204
|
+
end
|
205
|
+
|
206
|
+
after(:all) do
|
207
|
+
@article.delete
|
208
|
+
end
|
209
|
+
|
210
|
+
it "can read :id" do
|
211
|
+
@article.id.should_not be_nil
|
212
|
+
end
|
213
|
+
|
214
|
+
it "can read :title" do
|
215
|
+
@article.title.should == "event1"
|
216
|
+
end
|
217
|
+
|
218
|
+
it "can read :description" do
|
219
|
+
@article.description.should == "This is a test event."
|
220
|
+
end
|
221
|
+
|
222
|
+
it "can read :start_time" do
|
223
|
+
@article.start_time.to_s.should == @start_time.to_s
|
224
|
+
end
|
225
|
+
|
226
|
+
it "can read :end_time" do
|
227
|
+
@article.end_time.to_s.should == @end_time.to_s
|
228
|
+
end
|
229
|
+
|
230
|
+
it "can read :grade" do
|
231
|
+
@article.grade.should == 10
|
232
|
+
end
|
233
|
+
|
234
|
+
it "can read :owner" do
|
235
|
+
@article.owner.should == NTimeLine::User.me($timeline_key).nickname
|
236
|
+
end
|
237
|
+
|
238
|
+
#it "can read :image" do
|
239
|
+
# @article.image.should_not be_nil
|
240
|
+
#end
|
241
|
+
|
242
|
+
it "can read :link" do
|
243
|
+
@article.link.should be_a_kind_of(URI)
|
244
|
+
end
|
245
|
+
|
246
|
+
it "can read :related_links" do
|
247
|
+
@article.related_links.should be_a_kind_of(Array)
|
248
|
+
end
|
249
|
+
|
250
|
+
it "can read :created_at" do
|
251
|
+
@article.created_at.should be_a_kind_of(Time)
|
252
|
+
end
|
253
|
+
|
254
|
+
it "can read :updated_at" do
|
255
|
+
@article.updated_at.should be_a_kind_of(Time)
|
256
|
+
end
|
257
|
+
|
258
|
+
describe "when search" do
|
259
|
+
it "can search by timeline id" do
|
260
|
+
pager = Article.search_by_timeline_id(@timeline.id,
|
261
|
+
{:timeline_key => $timeline_key})
|
262
|
+
pager.should be_a_kind_of(ArticlePager)
|
263
|
+
pager.total.should > 0
|
264
|
+
found = false
|
265
|
+
while pager do
|
266
|
+
if pager.articles.include?(@article)
|
267
|
+
found = true
|
268
|
+
break
|
269
|
+
end
|
270
|
+
pager = pager.next
|
271
|
+
end
|
272
|
+
found.should be_true
|
273
|
+
end
|
274
|
+
end
|
275
|
+
end
|
276
|
+
|
277
|
+
describe NTimeLine::User do
|
278
|
+
it "should get my own information" do
|
279
|
+
Proc.new {
|
280
|
+
NTimeLine::User.me($timeline_key)
|
281
|
+
}.should_not raise_error(StandardError)
|
282
|
+
end
|
283
|
+
|
284
|
+
it "should get the user information" do
|
285
|
+
user = NTimeLine::User.show_by_nickname("keita.yamaguchi")
|
286
|
+
user.nickname.should == "keita.yamaguchi"
|
287
|
+
user.image.should_not be_nil
|
288
|
+
user.introduction.should_not be_nil
|
289
|
+
user.link.should_not be_nil
|
290
|
+
NTimeLine::User.show(user.id).nickname.should == "keita.yamaguchi"
|
291
|
+
end
|
292
|
+
end
|
293
|
+
end
|
data/spec/spec.opts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-fs --colour
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
gem 'rspec'
|
6
|
+
require 'spec'
|
7
|
+
end
|
8
|
+
|
9
|
+
$KCODE = "UTF-8"
|
10
|
+
|
11
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__), "..", "lib")
|
12
|
+
require "ntimeline"
|
13
|
+
|
14
|
+
$timeline_key = File.read(File.expand_path(File.join("~", ".nifty_timeline_key")))
|
@@ -0,0 +1,34 @@
|
|
1
|
+
desc 'Release the website and new gem version'
|
2
|
+
task :deploy => [:check_version, :website, :release] do
|
3
|
+
puts "Remember to create SVN tag:"
|
4
|
+
puts "svn copy svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/trunk " +
|
5
|
+
"svn+ssh://#{rubyforge_username}@rubyforge.org/var/svn/#{PATH}/tags/REL-#{VERS} "
|
6
|
+
puts "Suggested comment:"
|
7
|
+
puts "Tagging release #{CHANGES}"
|
8
|
+
end
|
9
|
+
|
10
|
+
desc 'Runs tasks website_generate and install_gem as a local deployment of the gem'
|
11
|
+
task :local_deploy => [:website_generate, :install_gem]
|
12
|
+
|
13
|
+
task :check_version do
|
14
|
+
unless ENV['VERSION']
|
15
|
+
puts 'Must pass a VERSION=x.y.z release version'
|
16
|
+
exit
|
17
|
+
end
|
18
|
+
unless ENV['VERSION'] == VERS
|
19
|
+
puts "Please update your version.rb to match the release version, currently #{VERS}"
|
20
|
+
exit
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
desc 'Install the package as a gem, without generating documentation(ri/rdoc)'
|
25
|
+
task :install_gem_no_doc => [:clean, :package] do
|
26
|
+
sh "#{'sudo ' unless Hoe::WINDOZE }gem install pkg/*.gem --no-rdoc --no-ri"
|
27
|
+
end
|
28
|
+
|
29
|
+
namespace :manifest do
|
30
|
+
desc 'Recreate Manifest.txt to include ALL files'
|
31
|
+
task :refresh do
|
32
|
+
`rake check_manifest | patch -p0 > Manifest.txt`
|
33
|
+
end
|
34
|
+
end
|
data/tasks/rspec.rake
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
begin
|
2
|
+
require 'spec'
|
3
|
+
rescue LoadError
|
4
|
+
require 'rubygems'
|
5
|
+
require 'spec'
|
6
|
+
end
|
7
|
+
begin
|
8
|
+
require 'spec/rake/spectask'
|
9
|
+
rescue LoadError
|
10
|
+
puts <<-EOS
|
11
|
+
To use rspec for testing you must install rspec gem:
|
12
|
+
gem install rspec
|
13
|
+
EOS
|
14
|
+
exit(0)
|
15
|
+
end
|
16
|
+
|
17
|
+
desc "Run the specs under spec/models"
|
18
|
+
Spec::Rake::SpecTask.new do |t|
|
19
|
+
t.spec_opts = ['--options', "spec/spec.opts"]
|
20
|
+
t.spec_files = FileList['spec/*_spec.rb']
|
21
|
+
end
|
data/tasks/website.rake
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
desc 'Generate website files'
|
2
|
+
task :website_generate => :ruby_env do
|
3
|
+
(Dir['website/**/*.txt'] - Dir['website/version*.txt']).each do |txt|
|
4
|
+
sh %{ #{RUBY_APP} script/txt2html #{txt} > #{txt.gsub(/txt$/,'html')} }
|
5
|
+
end
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Upload website files to rubyforge'
|
9
|
+
task :website_upload do
|
10
|
+
host = "#{rubyforge_username}@rubyforge.org"
|
11
|
+
remote_dir = "/var/www/gforge-projects/#{PATH}/"
|
12
|
+
local_dir = 'website'
|
13
|
+
sh %{rsync -aCv #{local_dir}/ #{host}:#{remote_dir}}
|
14
|
+
end
|
15
|
+
|
16
|
+
desc 'Generate and upload website files'
|
17
|
+
task :website => [:website_generate, :website_upload, :publish_docs]
|
data/website/index.html
ADDED
@@ -0,0 +1,204 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<link rel="stylesheet" href="stylesheets/screen.css" type="text/css" media="screen" />
|
6
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
7
|
+
<title>
|
8
|
+
NTimeLine
|
9
|
+
</title>
|
10
|
+
<script src="javascripts/rounded_corners_lite.inc.js" type="text/javascript"></script>
|
11
|
+
<style>
|
12
|
+
|
13
|
+
</style>
|
14
|
+
<script type="text/javascript">
|
15
|
+
window.onload = function() {
|
16
|
+
settings = {
|
17
|
+
tl: { radius: 10 },
|
18
|
+
tr: { radius: 10 },
|
19
|
+
bl: { radius: 10 },
|
20
|
+
br: { radius: 10 },
|
21
|
+
antiAlias: true,
|
22
|
+
autoPad: true,
|
23
|
+
validTags: ["div"]
|
24
|
+
}
|
25
|
+
var versionBox = new curvyCorners(settings, document.getElementById("version"));
|
26
|
+
versionBox.applyCornersToAll();
|
27
|
+
}
|
28
|
+
</script>
|
29
|
+
</head>
|
30
|
+
<body>
|
31
|
+
<div id="main">
|
32
|
+
|
33
|
+
<h1>NTimeLine</h1>
|
34
|
+
<div id="version" class="clickable" onclick='document.location = "http://rubyforge.org/projects/ntimeline"; return false'>
|
35
|
+
<p>Get Version</p>
|
36
|
+
<a href="http://rubyforge.org/projects/ntimeline" class="numbers">0.1.0</a>
|
37
|
+
</div>
|
38
|
+
<h2>What</h2>
|
39
|
+
|
40
|
+
|
41
|
+
<p>NTimeLine is a wrapper library for <a href="http://timeline.nifty.com/">@nifty TimeLine</a>. You can
|
42
|
+
show/search/create/modify/delete timelines and articles.</p>
|
43
|
+
|
44
|
+
|
45
|
+
<h2>Installing</h2>
|
46
|
+
|
47
|
+
|
48
|
+
<p><pre class='syntax'><span class="ident">sudo</span> <span class="ident">gem</span> <span class="ident">install</span> <span class="ident">ntimeline</span></pre></p>
|
49
|
+
|
50
|
+
|
51
|
+
<h2><span class="caps">API</span> document</h2>
|
52
|
+
|
53
|
+
|
54
|
+
<p>- http://ntimeline.rubyforge.org/rdoc</p>
|
55
|
+
|
56
|
+
|
57
|
+
<h2>The basics</h2>
|
58
|
+
|
59
|
+
|
60
|
+
<h3>timeline</h3>
|
61
|
+
|
62
|
+
|
63
|
+
<h4>show</h4>
|
64
|
+
|
65
|
+
|
66
|
+
<p><pre class='syntax'>
|
67
|
+
<span class="constant">TimeLine</span><span class="punct">.</span><span class="ident">show</span><span class="punct">(</span><span class="ident">id</span><span class="punct">)</span>
|
68
|
+
</pre></p>
|
69
|
+
|
70
|
+
|
71
|
+
<h4>create</h4>
|
72
|
+
|
73
|
+
|
74
|
+
<p><pre class='syntax'>
|
75
|
+
<span class="constant">TimeLine</span><span class="punct">.</span><span class="ident">create</span><span class="punct">(</span><span class="symbol">:timeline_key</span> <span class="punct">=></span> <span class="global">$timeline_key</span><span class="punct">,</span>
|
76
|
+
<span class="symbol">:title</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">NTimeLine TEST</span><span class="punct">",</span>
|
77
|
+
<span class="symbol">:description</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">This is a test for NTimeLine.</span><span class="punct">",</span>
|
78
|
+
<span class="symbol">:label_for_vaxis</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">dummy</span><span class="punct">",</span>
|
79
|
+
<span class="symbol">:initial_position</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">last</span><span class="punct">",</span>
|
80
|
+
<span class="symbol">:category</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">TimeLine</span><span class="punct">")</span>
|
81
|
+
</pre></p>
|
82
|
+
|
83
|
+
|
84
|
+
<h4>modify</h4>
|
85
|
+
|
86
|
+
|
87
|
+
<p><pre class='syntax'>
|
88
|
+
<span class="ident">timeline</span><span class="punct">.</span><span class="ident">modify</span><span class="punct">(</span><span class="symbol">:title</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">modified</span><span class="punct">")</span>
|
89
|
+
<span class="ident">timeline</span><span class="punct">.</span><span class="ident">title</span> <span class="comment"># => modified</span>
|
90
|
+
</pre></p>
|
91
|
+
|
92
|
+
|
93
|
+
<h4>delete</h4>
|
94
|
+
|
95
|
+
|
96
|
+
<p><pre class='syntax'>
|
97
|
+
<span class="comment"># Articles in the timeline are deleted if the argument is true.</span>
|
98
|
+
<span class="ident">timeline</span><span class="punct">.</span><span class="ident">delete</span><span class="punct">(</span><span class="constant">true</span><span class="punct">)</span>
|
99
|
+
</pre></p>
|
100
|
+
|
101
|
+
|
102
|
+
<h4>search</h4>
|
103
|
+
|
104
|
+
|
105
|
+
<p><pre class='syntax'>
|
106
|
+
<span class="ident">pager</span> <span class="punct">=</span> <span class="constant">Timeline</span><span class="punct">.</span><span class="ident">search_by_owner</span><span class="punct">("</span><span class="string">keita.yamaguchi</span><span class="punct">")</span>
|
107
|
+
<span class="ident">list</span> <span class="punct">=</span> <span class="punct">[]</span>
|
108
|
+
<span class="keyword">while</span> <span class="ident">pager</span> <span class="keyword">do</span>
|
109
|
+
<span class="ident">list</span> <span class="punct">+=</span> <span class="ident">pager</span><span class="punct">.</span><span class="ident">timelines</span>
|
110
|
+
<span class="ident">pager</span> <span class="punct">=</span> <span class="ident">pager</span><span class="punct">.</span><span class="ident">next</span>
|
111
|
+
<span class="keyword">end</span>
|
112
|
+
</pre></p>
|
113
|
+
|
114
|
+
|
115
|
+
<h3>article</h3>
|
116
|
+
|
117
|
+
|
118
|
+
<h4>create</h4>
|
119
|
+
|
120
|
+
|
121
|
+
<p><pre class='syntax'>
|
122
|
+
<span class="ident">timeline</span><span class="punct">.</span><span class="ident">create_article</span><span class="punct">(</span><span class="symbol">:title</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">NTimeLine test</span><span class="punct">",</span>
|
123
|
+
<span class="symbol">:description</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">This is a test for NTimeLine library.</span><span class="punct">",</span>
|
124
|
+
<span class="symbol">:label_for_vaxis</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">dummy</span><span class="punct">")</span>
|
125
|
+
</pre></p>
|
126
|
+
|
127
|
+
|
128
|
+
<h4>modify</h4>
|
129
|
+
|
130
|
+
|
131
|
+
<p><pre class='syntax'>
|
132
|
+
<span class="ident">article</span><span class="punct">.</span><span class="ident">modify</span><span class="punct">(</span><span class="symbol">:title</span> <span class="punct">=></span> <span class="punct">"</span><span class="string">modified</span><span class="punct">")</span>
|
133
|
+
<span class="ident">article</span><span class="punct">.</span><span class="ident">title</span> <span class="comment"># => modified</span>
|
134
|
+
</pre></p>
|
135
|
+
|
136
|
+
|
137
|
+
<h4>delete</h4>
|
138
|
+
|
139
|
+
|
140
|
+
<p><pre class='syntax'>
|
141
|
+
<span class="ident">article</span><span class="punct">.</span><span class="ident">delete</span>
|
142
|
+
</pre></p>
|
143
|
+
|
144
|
+
|
145
|
+
<h4>search</h4>
|
146
|
+
|
147
|
+
|
148
|
+
<p><pre class='syntax'>
|
149
|
+
<span class="ident">pager</span> <span class="punct">=</span> <span class="ident">article</span><span class="punct">.</span><span class="ident">search_by_timeline_id</span><span class="punct">(</span><span class="ident">timeline</span><span class="punct">.</span><span class="ident">id</span><span class="punct">)</span>
|
150
|
+
<span class="comment"># or timeline.search_articles</span>
|
151
|
+
<span class="ident">list</span> <span class="punct">=</span> <span class="punct">[]</span>
|
152
|
+
<span class="keyword">while</span> <span class="ident">pager</span> <span class="keyword">do</span>
|
153
|
+
<span class="ident">list</span> <span class="punct">+=</span> <span class="ident">pager</span><span class="punct">.</span><span class="ident">articles</span>
|
154
|
+
<span class="ident">pager</span> <span class="punct">=</span> <span class="ident">pager</span><span class="punct">.</span><span class="ident">next</span>
|
155
|
+
<span class="keyword">end</span>
|
156
|
+
</pre></p>
|
157
|
+
|
158
|
+
|
159
|
+
<h2>Forum</h2>
|
160
|
+
|
161
|
+
|
162
|
+
<p><a href="http://groups.google.com/group/ntimeline">http://groups.google.com/group/ntimeline</a></p>
|
163
|
+
|
164
|
+
|
165
|
+
<h2>How to submit patches</h2>
|
166
|
+
|
167
|
+
|
168
|
+
<p>Read the <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/">8 steps for fixing other people’s code</a> and for section <a href="http://drnicwilliams.com/2007/06/01/8-steps-for-fixing-other-peoples-code/#8b-google-groups">8b: Submit patch to Google Groups</a>, use the Google Group above.</p>
|
169
|
+
|
170
|
+
|
171
|
+
<p>The trunk repository is <code>svn://rubyforge.org/var/svn/ntimeline/trunk</code> for anonymous access.</p>
|
172
|
+
|
173
|
+
|
174
|
+
<h2>License</h2>
|
175
|
+
|
176
|
+
|
177
|
+
<p>This code is free to use under the terms of the Ruby license.</p>
|
178
|
+
|
179
|
+
|
180
|
+
<h2>Links</h2>
|
181
|
+
|
182
|
+
|
183
|
+
<p>- <a href="http://www.nifty.com/">@nifty</a>
|
184
|
+
—<a href="http://timeline.nifty.com/">@nifty TimeLine</a>
|
185
|
+
—<a href="http://webservice.nifty.com/timeline/">@nifty Web Service / TimeLine</a>
|
186
|
+
- NTimeLine
|
187
|
+
—<a href="http://ntimeline.rubyforge.org/">Website</a>
|
188
|
+
—<a href="http://rubyforge.org/projects/ntimeline/">Rubyforge Project</a></p>
|
189
|
+
|
190
|
+
|
191
|
+
<h2>Contact</h2>
|
192
|
+
|
193
|
+
|
194
|
+
<p>Comments are welcome. Send an email to <a href="mailto:keita.yamaguchi@gmail.com">Keita Yamaguchi</a> or the <a href="http://groups.google.com/group/ntimeline">forum</a></p>
|
195
|
+
<p class="coda">
|
196
|
+
<a href="keita.yamaguchi@gmail.com">Keita Yamaguchi</a>, 30th December 2007<br>
|
197
|
+
Theme extended from <a href="http://rb2js.rubyforge.org/">Paul Battley</a>
|
198
|
+
</p>
|
199
|
+
</div>
|
200
|
+
|
201
|
+
<!-- insert site tracking codes here, like Google Urchin -->
|
202
|
+
|
203
|
+
</body>
|
204
|
+
</html>
|