shelf 0.0.1 → 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/VERSION +1 -1
- data/lib/shelf/item.rb +3 -2
- data/spec/item_spec.rb +22 -0
- metadata +6 -11
- data/bin/eshelf.rb +0 -37
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/shelf/item.rb
CHANGED
@@ -4,7 +4,7 @@ require 'shelf/download.rb'
|
|
4
4
|
module Epubify
|
5
5
|
|
6
6
|
class Item
|
7
|
-
attr_accessor :id, :title, :summary, :description, :cover_url, :thumbnail_url, :language, :issued
|
7
|
+
attr_accessor :id, :periodical_token, :periodical_id, :title, :summary, :description, :cover_url, :thumbnail_url, :language, :issued
|
8
8
|
|
9
9
|
def initialize hash = nil, &block
|
10
10
|
summary = ""
|
@@ -27,6 +27,7 @@ module Epubify
|
|
27
27
|
|
28
28
|
def from_hash h
|
29
29
|
self.id = h["id"]
|
30
|
+
self.periodical_id = h["periodical_id"]
|
30
31
|
self.title = h["title"]
|
31
32
|
self.summary = h["summary"]
|
32
33
|
self.description = h["description"]
|
@@ -37,7 +38,7 @@ module Epubify
|
|
37
38
|
end
|
38
39
|
|
39
40
|
def save
|
40
|
-
@query = { :item => { :title => title, :summary => summary, :description => description, :cover_url => cover_url, :thumbnail_url => thumbnail_url, :language => language, :issued => issued } }
|
41
|
+
@query = { :item => { :periodical_token => periodical_token, :title => title, :summary => summary, :description => description, :cover_url => cover_url, :thumbnail_url => thumbnail_url, :language => language, :issued => issued } }
|
41
42
|
|
42
43
|
if id
|
43
44
|
res = ShelfApi.update_item(id, @query)
|
data/spec/item_spec.rb
CHANGED
@@ -60,6 +60,7 @@ module Epubify
|
|
60
60
|
end
|
61
61
|
|
62
62
|
|
63
|
+
|
63
64
|
it "destroys an item" do
|
64
65
|
items = Shelf.new.items
|
65
66
|
count = items.length
|
@@ -70,6 +71,27 @@ module Epubify
|
|
70
71
|
Shelf.new.items.length.should be < count
|
71
72
|
end
|
72
73
|
|
74
|
+
|
75
|
+
it "creates an item with periodical" do
|
76
|
+
periodical_token = config["test"]["periodical_token"]
|
77
|
+
|
78
|
+
count = Shelf.new.items.length
|
79
|
+
|
80
|
+
item = Epubify::Item.new
|
81
|
+
item.title = "MyDaily #{Date.today.to_s}"
|
82
|
+
item.summary = "Daily news aggregated at #{DateTime.now.to_s}"
|
83
|
+
item.periodical_token = periodical_token
|
84
|
+
item.save
|
85
|
+
|
86
|
+
Shelf.new.items.length.should be > count
|
87
|
+
item.id.should_not be_nil
|
88
|
+
item.periodical_id.should_not be_nil
|
89
|
+
|
90
|
+
item.destroy
|
91
|
+
end
|
92
|
+
|
93
|
+
|
94
|
+
|
73
95
|
end
|
74
96
|
|
75
97
|
end
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: shelf
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 27
|
5
5
|
prerelease: false
|
6
6
|
segments:
|
7
7
|
- 0
|
8
|
-
- 0
|
9
8
|
- 1
|
10
|
-
|
9
|
+
- 0
|
10
|
+
version: 0.1.0
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Rune Myrland
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
18
|
+
date: 2011-03-09 00:00:00 +01:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|
@@ -36,10 +36,8 @@ dependencies:
|
|
36
36
|
version_requirements: *id001
|
37
37
|
description: Epubify Shelf is presently under construction. It will be an online bookshelf for ebooks.
|
38
38
|
email: rune@epubify.com
|
39
|
-
executables:
|
40
|
-
|
41
|
-
- eshelf.rb
|
42
|
-
- eshelf.rb~
|
39
|
+
executables: []
|
40
|
+
|
43
41
|
extensions: []
|
44
42
|
|
45
43
|
extra_rdoc_files:
|
@@ -61,9 +59,6 @@ files:
|
|
61
59
|
- spec/shelf_spec.rb
|
62
60
|
- spec/spec.opts
|
63
61
|
- spec/spec_helper.rb
|
64
|
-
- bin/shelf.rb~
|
65
|
-
- bin/eshelf.rb
|
66
|
-
- bin/eshelf.rb~
|
67
62
|
has_rdoc: true
|
68
63
|
homepage: http://github.com/wrimle/shelf
|
69
64
|
licenses: []
|
data/bin/eshelf.rb
DELETED
@@ -1,37 +0,0 @@
|
|
1
|
-
#!/usr/bin/ruby
|
2
|
-
|
3
|
-
$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
|
4
|
-
$LOAD_PATH.unshift(File.dirname(__FILE__))
|
5
|
-
require 'shelf'
|
6
|
-
|
7
|
-
|
8
|
-
Epubify::Shelf.base_uri 'localhost:3000'
|
9
|
-
Epubify::Shelf.api_key = "tlzr_ZMgVEPRiHCK-Nix"
|
10
|
-
shelf = Epubify::Shelf
|
11
|
-
|
12
|
-
#res = Epubify::Item.find(1)
|
13
|
-
#puts res.inspect
|
14
|
-
|
15
|
-
#res = shelf.items
|
16
|
-
#puts res.inspect
|
17
|
-
|
18
|
-
|
19
|
-
#res = shelf.item(1)
|
20
|
-
#puts res["item"].inspect
|
21
|
-
|
22
|
-
#item = Epubify::Item.new
|
23
|
-
#item.title = "MyDaily2 #{Date.today.to_s}"
|
24
|
-
#item.summary = "Daily news aggregated at #{DateTime.now.to_s}"
|
25
|
-
|
26
|
-
#puts item.inspect
|
27
|
-
#res = item.save
|
28
|
-
|
29
|
-
|
30
|
-
item = Epubify::Item.find(1)
|
31
|
-
#puts item.inspect
|
32
|
-
res = item.share(2)
|
33
|
-
puts res.inspect
|
34
|
-
|
35
|
-
#res = Epubify::Item.find(2)
|
36
|
-
#puts res.inspect
|
37
|
-
|