wikidata-client 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (61) hide show
  1. checksums.yaml +7 -0
  2. data/.rspec +2 -0
  3. data/.travis.yml +7 -0
  4. data/Gemfile +7 -0
  5. data/Gemfile.lock +69 -0
  6. data/LICENCE +21 -0
  7. data/README.md +180 -0
  8. data/Rakefile +5 -0
  9. data/config/mapping.yml +19 -0
  10. data/config/settings.yml +4 -0
  11. data/lib/wikidata.rb +39 -0
  12. data/lib/wikidata/client.rb +36 -0
  13. data/lib/wikidata/config.rb +23 -0
  14. data/lib/wikidata/entity.rb +83 -0
  15. data/lib/wikidata/item.rb +41 -0
  16. data/lib/wikidata/property.rb +29 -0
  17. data/lib/wikidata/property/base.rb +16 -0
  18. data/lib/wikidata/property/globe_coordinate.rb +13 -0
  19. data/lib/wikidata/property/string.rb +6 -0
  20. data/lib/wikidata/property/time.rb +66 -0
  21. data/lib/wikidata/property/url.rb +6 -0
  22. data/lib/wikidata/resource.rb +69 -0
  23. data/lib/wikidata/response.rb +31 -0
  24. data/lib/wikidata/search_response.rb +35 -0
  25. data/lib/wikidata/version.rb +3 -0
  26. data/spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_a_key.yml +160 -0
  27. data/spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_an_id.yml +160 -0
  28. data/spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_a_key_children_here_.yml +518 -0
  29. data/spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_an_id_P40_for_children_here_.yml +516 -0
  30. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_a_key_date_of_birth_here_.yml +162 -0
  31. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_property_id_P569_for_date_of_birth_here_.yml +162 -0
  32. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_globe_coordinate/should_return_GlobeCoordinate_from_a_key_coordinate_location_here_.yml +58 -0
  33. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_globe_coordinate/should_return_GlobeCoordinate_from_a_property_id_P625_for_coordinate_location_here_.yml +58 -0
  34. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_string/should_return_String_from_a_key_freebase_identifier_here_.yml +160 -0
  35. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_string/should_return_String_from_a_property_id_P646_for_freebase_identifier_here_.yml +160 -0
  36. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_url/should_return_Url_from_a_key_official_website_here_.yml +78 -0
  37. data/spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_url/should_return_Url_from_a_property_id_P856_for_official_website_here_.yml +78 -0
  38. data/spec/fixtures/vcr/Wikidata_Entity/properties/should_return_aliases.yml +176 -0
  39. data/spec/fixtures/vcr/Wikidata_Entity/properties/should_return_descriptions.yml +178 -0
  40. data/spec/fixtures/vcr/Wikidata_Entity/properties/should_return_id.yml +176 -0
  41. data/spec/fixtures/vcr/Wikidata_Entity/properties/should_return_labels.yml +176 -0
  42. data/spec/fixtures/vcr/Wikidata_Entity/properties/should_return_sitelinks.yml +176 -0
  43. data/spec/fixtures/vcr/Wikidata_Entity/properties/should_return_url.yml +178 -0
  44. data/spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_id.yml +319 -0
  45. data/spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_ids.yml +441 -0
  46. data/spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_title.yml +319 -0
  47. data/spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_titles.yml +441 -0
  48. data/spec/fixtures/vcr/Wikidata_Item/_find_/should_return_nil_if_item_not_found.yml +58 -0
  49. data/spec/fixtures/vcr/Wikidata_Item/_search/should_fetch_all_all_items_of_the_collection.yml +656 -0
  50. data/spec/fixtures/vcr/Wikidata_Item/_search/should_return_a_response_with_an_empty_array_of_results_if_search_missing.yml +57 -0
  51. data/spec/fixtures/vcr/Wikidata_Item/_search/should_return_an_array_of_Wikidata_Item.yml +654 -0
  52. data/spec/fixtures/vcr/Wikidata_Item/_search/should_return_the_next_page_offset.yml +123 -0
  53. data/spec/fixtures/vcr/Wikidata_Item/_search/should_return_the_total_number_of_hits.yml +123 -0
  54. data/spec/spec_helper.rb +28 -0
  55. data/spec/wikidata/client_spec.rb +4 -0
  56. data/spec/wikidata/entity_spec.rb +139 -0
  57. data/spec/wikidata/item_spec.rb +64 -0
  58. data/spec/wikidata/property/time_spec.rb +61 -0
  59. data/spec/wikidata_spec.rb +20 -0
  60. data/wikidata-client.gemspec +27 -0
  61. metadata +262 -0
@@ -0,0 +1,61 @@
1
+ require 'spec_helper'
2
+
3
+ describe Wikidata::Property::Time do
4
+ let(:joconde) { Wikidata::Item.find_by_title 'Mona Lisa' }
5
+ let(:range_of_year) {
6
+ described_class.new(
7
+ {
8
+ "id" => "Q12418$8EDF7B01-3F71-4DA7-8B52-8C26242F0293",
9
+ "mainsnak" => {
10
+ "snaktype" => "value",
11
+ "property" => "P571",
12
+ "datatype" => "time",
13
+ "datavalue"=> {
14
+ "value" => {
15
+ "time" => "+00000001503-01-01T00:00:00Z",
16
+ "timezone" => 0,
17
+ "before" => 0,
18
+ "after" => 3,
19
+ "precision" => 9,
20
+ "calendarmodel" => "http://www.wikidata.org/entity/Q1985727"
21
+ },
22
+ "type" => "time"
23
+ }
24
+ },
25
+ "type" => "statement",
26
+ "rank" => "normal",
27
+ "references" => [
28
+ {
29
+ "hash" => "592714cb87c0fc64425e45a185765982f444e5ad",
30
+ "snaks" => {
31
+ "P143" => [
32
+ {
33
+ "snaktype" => "value",
34
+ "property" => "P143",
35
+ "datatype" => "wikibase-item",
36
+ "datavalue"=> {
37
+ "value" => {
38
+ "entity-type" => "item",
39
+ "numeric-id" => 465
40
+ },
41
+ "type" => "wikibase-entityid"
42
+ }
43
+ }
44
+ ]
45
+ },
46
+ "snaks-order" => ["P143"]
47
+ }
48
+ ]
49
+ }
50
+ )
51
+ }
52
+
53
+ it 'should return Time from a a key (date_of_foundation_or_creation here)' do
54
+ range_of_year.tap do |date|
55
+ date.should be_kind_of Wikidata::Property::Time
56
+ date.date.should eq DateTime.new(1503, 1, 1)
57
+ date.range.min.should eq DateTime.new(1503, 1, 1, 0, 0, 0)
58
+ date.range.max.should eq DateTime.new(1505, 12, 31, 00, 00, 00)
59
+ end
60
+ end
61
+ end
@@ -0,0 +1,20 @@
1
+ require 'spec_helper'
2
+
3
+ describe Wikidata do
4
+ it 'should be configurable' do
5
+ Wikidata.configure do |c|
6
+ c.client_options = {
7
+ request: {
8
+ open_timeout: 10,
9
+ timeout: 10
10
+ }
11
+ }
12
+ end
13
+ Wikidata.client_options.should eq({
14
+ request: {
15
+ open_timeout: 10,
16
+ timeout: 10
17
+ }
18
+ })
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ $:.push File.expand_path("../lib", __FILE__)
2
+ require "wikidata/version"
3
+
4
+ Gem::Specification.new do |s|
5
+ s.name = "wikidata-client"
6
+ s.version = Wikidata::VERSION.dup
7
+ s.platform = Gem::Platform::RUBY
8
+ s.licenses = ["MIT"]
9
+ s.summary = "Wikidata API client"
10
+ s.email = "kevinlacointe@gmail.com"
11
+ s.homepage = "https://github.com/klacointe/wikidata-client"
12
+ s.authors = ['Kévin Lacointe']
13
+
14
+ s.files = `git ls-files`.split("\n")
15
+ s.test_files = `git ls-files -- spec/*`.split("\n")
16
+ s.require_paths = ["lib"]
17
+
18
+ s.add_dependency("faraday", "~> 0.9")
19
+ s.add_dependency("faraday_middleware", "~> 0.9")
20
+ s.add_dependency("patron", "~> 0.4")
21
+ s.add_dependency("hashie", "~> 3.3")
22
+ s.add_development_dependency("rspec", "~> 3.1")
23
+ s.add_development_dependency("webmock", "~> 1.18")
24
+ s.add_development_dependency("vcr", "~> 2.9")
25
+ s.add_development_dependency("pry", "~> 0.10")
26
+ s.add_development_dependency("rake", "~> 10.3")
27
+ end
metadata ADDED
@@ -0,0 +1,262 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: wikidata-client
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Kévin Lacointe
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-09-29 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.9'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.9'
27
+ - !ruby/object:Gem::Dependency
28
+ name: faraday_middleware
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '0.9'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '0.9'
41
+ - !ruby/object:Gem::Dependency
42
+ name: patron
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '0.4'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '0.4'
55
+ - !ruby/object:Gem::Dependency
56
+ name: hashie
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - "~>"
60
+ - !ruby/object:Gem::Version
61
+ version: '3.3'
62
+ type: :runtime
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - "~>"
67
+ - !ruby/object:Gem::Version
68
+ version: '3.3'
69
+ - !ruby/object:Gem::Dependency
70
+ name: rspec
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - "~>"
74
+ - !ruby/object:Gem::Version
75
+ version: '3.1'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '3.1'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - "~>"
88
+ - !ruby/object:Gem::Version
89
+ version: '1.18'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - "~>"
95
+ - !ruby/object:Gem::Version
96
+ version: '1.18'
97
+ - !ruby/object:Gem::Dependency
98
+ name: vcr
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - "~>"
102
+ - !ruby/object:Gem::Version
103
+ version: '2.9'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - "~>"
109
+ - !ruby/object:Gem::Version
110
+ version: '2.9'
111
+ - !ruby/object:Gem::Dependency
112
+ name: pry
113
+ requirement: !ruby/object:Gem::Requirement
114
+ requirements:
115
+ - - "~>"
116
+ - !ruby/object:Gem::Version
117
+ version: '0.10'
118
+ type: :development
119
+ prerelease: false
120
+ version_requirements: !ruby/object:Gem::Requirement
121
+ requirements:
122
+ - - "~>"
123
+ - !ruby/object:Gem::Version
124
+ version: '0.10'
125
+ - !ruby/object:Gem::Dependency
126
+ name: rake
127
+ requirement: !ruby/object:Gem::Requirement
128
+ requirements:
129
+ - - "~>"
130
+ - !ruby/object:Gem::Version
131
+ version: '10.3'
132
+ type: :development
133
+ prerelease: false
134
+ version_requirements: !ruby/object:Gem::Requirement
135
+ requirements:
136
+ - - "~>"
137
+ - !ruby/object:Gem::Version
138
+ version: '10.3'
139
+ description:
140
+ email: kevinlacointe@gmail.com
141
+ executables: []
142
+ extensions: []
143
+ extra_rdoc_files: []
144
+ files:
145
+ - ".rspec"
146
+ - ".travis.yml"
147
+ - Gemfile
148
+ - Gemfile.lock
149
+ - LICENCE
150
+ - README.md
151
+ - Rakefile
152
+ - config/mapping.yml
153
+ - config/settings.yml
154
+ - lib/wikidata.rb
155
+ - lib/wikidata/client.rb
156
+ - lib/wikidata/config.rb
157
+ - lib/wikidata/entity.rb
158
+ - lib/wikidata/item.rb
159
+ - lib/wikidata/property.rb
160
+ - lib/wikidata/property/base.rb
161
+ - lib/wikidata/property/globe_coordinate.rb
162
+ - lib/wikidata/property/string.rb
163
+ - lib/wikidata/property/time.rb
164
+ - lib/wikidata/property/url.rb
165
+ - lib/wikidata/resource.rb
166
+ - lib/wikidata/response.rb
167
+ - lib/wikidata/search_response.rb
168
+ - lib/wikidata/version.rb
169
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_a_key.yml
170
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_an_id.yml
171
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_a_key_children_here_.yml
172
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_an_id_P40_for_children_here_.yml
173
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_a_key_date_of_birth_here_.yml
174
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_property_id_P569_for_date_of_birth_here_.yml
175
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_globe_coordinate/should_return_GlobeCoordinate_from_a_key_coordinate_location_here_.yml
176
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_globe_coordinate/should_return_GlobeCoordinate_from_a_property_id_P625_for_coordinate_location_here_.yml
177
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_string/should_return_String_from_a_key_freebase_identifier_here_.yml
178
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_string/should_return_String_from_a_property_id_P646_for_freebase_identifier_here_.yml
179
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_url/should_return_Url_from_a_key_official_website_here_.yml
180
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_url/should_return_Url_from_a_property_id_P856_for_official_website_here_.yml
181
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_aliases.yml
182
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_descriptions.yml
183
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_id.yml
184
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_labels.yml
185
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_sitelinks.yml
186
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_url.yml
187
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_id.yml
188
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_ids.yml
189
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_title.yml
190
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_titles.yml
191
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_return_nil_if_item_not_found.yml
192
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_fetch_all_all_items_of_the_collection.yml
193
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_a_response_with_an_empty_array_of_results_if_search_missing.yml
194
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_an_array_of_Wikidata_Item.yml
195
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_the_next_page_offset.yml
196
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_the_total_number_of_hits.yml
197
+ - spec/spec_helper.rb
198
+ - spec/wikidata/client_spec.rb
199
+ - spec/wikidata/entity_spec.rb
200
+ - spec/wikidata/item_spec.rb
201
+ - spec/wikidata/property/time_spec.rb
202
+ - spec/wikidata_spec.rb
203
+ - wikidata-client.gemspec
204
+ homepage: https://github.com/klacointe/wikidata-client
205
+ licenses:
206
+ - MIT
207
+ metadata: {}
208
+ post_install_message:
209
+ rdoc_options: []
210
+ require_paths:
211
+ - lib
212
+ required_ruby_version: !ruby/object:Gem::Requirement
213
+ requirements:
214
+ - - ">="
215
+ - !ruby/object:Gem::Version
216
+ version: '0'
217
+ required_rubygems_version: !ruby/object:Gem::Requirement
218
+ requirements:
219
+ - - ">="
220
+ - !ruby/object:Gem::Version
221
+ version: '0'
222
+ requirements: []
223
+ rubyforge_project:
224
+ rubygems_version: 2.2.2
225
+ signing_key:
226
+ specification_version: 4
227
+ summary: Wikidata API client
228
+ test_files:
229
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_a_key.yml
230
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_allow_to_return_only_entities_ids_from_an_id.yml
231
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_a_key_children_here_.yml
232
+ - spec/fixtures/vcr/Wikidata_Entity/properties/entities/should_return_entities_property_from_an_id_P40_for_children_here_.yml
233
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_a_key_date_of_birth_here_.yml
234
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_date/should_return_Time_from_a_property_id_P569_for_date_of_birth_here_.yml
235
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_globe_coordinate/should_return_GlobeCoordinate_from_a_key_coordinate_location_here_.yml
236
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_globe_coordinate/should_return_GlobeCoordinate_from_a_property_id_P625_for_coordinate_location_here_.yml
237
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_string/should_return_String_from_a_key_freebase_identifier_here_.yml
238
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_string/should_return_String_from_a_property_id_P646_for_freebase_identifier_here_.yml
239
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_url/should_return_Url_from_a_key_official_website_here_.yml
240
+ - spec/fixtures/vcr/Wikidata_Entity/properties/properties/of_type_url/should_return_Url_from_a_property_id_P856_for_official_website_here_.yml
241
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_aliases.yml
242
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_descriptions.yml
243
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_id.yml
244
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_labels.yml
245
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_sitelinks.yml
246
+ - spec/fixtures/vcr/Wikidata_Entity/properties/should_return_url.yml
247
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_id.yml
248
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_ids.yml
249
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_title.yml
250
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_find_by_titles.yml
251
+ - spec/fixtures/vcr/Wikidata_Item/_find_/should_return_nil_if_item_not_found.yml
252
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_fetch_all_all_items_of_the_collection.yml
253
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_a_response_with_an_empty_array_of_results_if_search_missing.yml
254
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_an_array_of_Wikidata_Item.yml
255
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_the_next_page_offset.yml
256
+ - spec/fixtures/vcr/Wikidata_Item/_search/should_return_the_total_number_of_hits.yml
257
+ - spec/spec_helper.rb
258
+ - spec/wikidata/client_spec.rb
259
+ - spec/wikidata/entity_spec.rb
260
+ - spec/wikidata/item_spec.rb
261
+ - spec/wikidata/property/time_spec.rb
262
+ - spec/wikidata_spec.rb