bibsonomy 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +34 -0
- data/Gemfile +4 -0
- data/LICENSE +505 -0
- data/README.md +121 -0
- data/Rakefile +2 -0
- data/bibsonomy.gemspec +33 -0
- data/lib/bibsonomy.rb +7 -0
- data/lib/bibsonomy/api.rb +150 -0
- data/lib/bibsonomy/csl.rb +395 -0
- data/lib/bibsonomy/post.rb +21 -0
- data/lib/bibsonomy/version.rb +3 -0
- data/test/post_test.rb +39 -0
- data/test/test_helper.rb +9 -0
- metadata +199 -0
@@ -0,0 +1,21 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
module BibSonomy
|
4
|
+
class Post
|
5
|
+
|
6
|
+
attr_reader :user_name, :intra_hash, :title, :year, :entrytype, :booktitle, :journal, :url
|
7
|
+
|
8
|
+
def initialize(post)
|
9
|
+
publication = post["bibtex"]
|
10
|
+
@user_name = post["user"]["name"]
|
11
|
+
@intra_hash = publication["intrahash"]
|
12
|
+
@title = publication["title"]
|
13
|
+
@year = publication["year"]
|
14
|
+
@entrytype = publication["entrytype"]
|
15
|
+
@booktitle = publication["booktitle"]
|
16
|
+
@journal = publication["journal"]
|
17
|
+
@url = publication["url"]
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
data/test/post_test.rb
ADDED
@@ -0,0 +1,39 @@
|
|
1
|
+
require './test/test_helper'
|
2
|
+
|
3
|
+
class BibSonomyPostTest < Minitest::Unit::TestCase
|
4
|
+
|
5
|
+
def setup
|
6
|
+
@api = BibSonomy::API.new(ENV['USER_NAME'], ENV['API_KEY'], 'ruby')
|
7
|
+
end
|
8
|
+
|
9
|
+
def test_exists
|
10
|
+
assert BibSonomy::Post
|
11
|
+
assert BibSonomy::API
|
12
|
+
end
|
13
|
+
|
14
|
+
def test_find_post
|
15
|
+
VCR.use_cassette('one_post') do
|
16
|
+
post = @api.get_post("jaeschke", "c9437d5ec56ba949f533aeec00f571e3")
|
17
|
+
assert_equal BibSonomy::Post, post.class
|
18
|
+
|
19
|
+
# Check that the fields are accessible by our model
|
20
|
+
assert_equal "jaeschke", post.user_name
|
21
|
+
assert_equal "c9437d5ec56ba949f533aeec00f571e3", post.intra_hash
|
22
|
+
assert_equal "The Social Bookmark and Publication Management System {BibSonomy}", post.title
|
23
|
+
assert_equal "2010", post.year
|
24
|
+
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def test_find_posts
|
28
|
+
VCR.use_cassette('all_posts') do
|
29
|
+
result = @api.get_posts_for_user("jaeschke", "publication", nil, 0, 20)
|
30
|
+
|
31
|
+
# Make sure we got all the posts
|
32
|
+
assert_equal 20, result.length
|
33
|
+
|
34
|
+
# Make sure that the JSON was parsed
|
35
|
+
assert result.kind_of?(Array)
|
36
|
+
assert result.first.kind_of?(BibSonomy::Post)
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
data/test/test_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,199 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bibsonomy
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.4.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Robert Jäschke
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-02-25 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.7'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.7'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: minitest
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '5.4'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '5.4'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.9'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.9'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '1.19'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '1.19'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: faraday
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.9'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.9'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: json
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '1.8'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '1.8'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: citeproc
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - "~>"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '1.0'
|
118
|
+
type: :runtime
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - "~>"
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '1.0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: csl-styles
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - "~>"
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '1.0'
|
132
|
+
type: :runtime
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - "~>"
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '1.0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: bibtex-ruby
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - "~>"
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '4.0'
|
146
|
+
type: :runtime
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - "~>"
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '4.0'
|
153
|
+
description: Enables calls to the BibSonomy REST API with Ruby.
|
154
|
+
email:
|
155
|
+
- jaeschke@l3s.de
|
156
|
+
executables: []
|
157
|
+
extensions: []
|
158
|
+
extra_rdoc_files: []
|
159
|
+
files:
|
160
|
+
- ".gitignore"
|
161
|
+
- Gemfile
|
162
|
+
- LICENSE
|
163
|
+
- README.md
|
164
|
+
- Rakefile
|
165
|
+
- bibsonomy.gemspec
|
166
|
+
- lib/bibsonomy.rb
|
167
|
+
- lib/bibsonomy/api.rb
|
168
|
+
- lib/bibsonomy/csl.rb
|
169
|
+
- lib/bibsonomy/post.rb
|
170
|
+
- lib/bibsonomy/version.rb
|
171
|
+
- test/post_test.rb
|
172
|
+
- test/test_helper.rb
|
173
|
+
homepage: https://github.com/rjoberon/bibsonomy-ruby
|
174
|
+
licenses:
|
175
|
+
- LGPL 2.1
|
176
|
+
metadata: {}
|
177
|
+
post_install_message:
|
178
|
+
rdoc_options: []
|
179
|
+
require_paths:
|
180
|
+
- lib
|
181
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - ">="
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '0'
|
191
|
+
requirements: []
|
192
|
+
rubyforge_project:
|
193
|
+
rubygems_version: 2.2.2
|
194
|
+
signing_key:
|
195
|
+
specification_version: 4
|
196
|
+
summary: Wraps the BibSonomy REST API.
|
197
|
+
test_files:
|
198
|
+
- test/post_test.rb
|
199
|
+
- test/test_helper.rb
|