bgg-api 0.0.1
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/.document +5 -0
- data/.rspec +2 -0
- data/Gemfile +15 -0
- data/Gemfile.lock +48 -0
- data/LICENSE.txt +20 -0
- data/README.md +22 -0
- data/Rakefile +53 -0
- data/VERSION +1 -0
- data/lib/bgg_api.rb +41 -0
- data/sample_data/collection?username=texasjdl&own=1&excludesubtype=boardgameexpansion +1908 -0
- data/sample_data/hot?type=boardgame +202 -0
- data/sample_data/plays?username=texasjdl&id=84876 +191 -0
- data/sample_data/search?query=Burgund&type=boardgame +10 -0
- data/sample_data/thing?id=84876&type=boardgame +294 -0
- data/sample_data/user?name=texasjdl +3 -0
- data/spec/bgg_api_spec.rb +63 -0
- data/spec/spec_helper.rb +19 -0
- metadata +166 -0
@@ -0,0 +1,3 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?><user id="39488" name="texasjdl" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
|
2
|
+
<firstname value="Jeremiah" /> <lastname value="Lee" /> <avatarlink value="http://geekdo-images.com/avatars/avatar_id14507.jpg" /> <yearregistered value="2004" /> <lastlogin value="2012-08-15" /> <stateorprovince value="California" /> <country value="United States" /> <webaddress value="" /> <xboxaccount value="Solipsyst" /> <wiiaccount value="" /> <psnaccount value="" /> <battlenetaccount value="" /> <steamaccount value="" /> <traderating value="5" />
|
3
|
+
</user>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'rspec'
|
2
|
+
require 'bgg-api'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
|
5
|
+
describe 'BGG Search' do
|
6
|
+
|
7
|
+
it 'some results come back' do
|
8
|
+
stub_request(:any, "http://www.boardgamegeek.com/xmlapi2/search").with(:query => {:query => 'Burgund', :type => 'boardgame'}).to_return(:body => File.new('sample_data/search?query=Burgund&type=boardgame'), :status => 200)
|
9
|
+
|
10
|
+
bgg = BggApi.new
|
11
|
+
results = bgg.search({:query => 'Burgund', :type => 'boardgame'})
|
12
|
+
|
13
|
+
results.should_not be_nil
|
14
|
+
end
|
15
|
+
end
|
16
|
+
|
17
|
+
describe 'BGG Thing' do
|
18
|
+
it 'searches for and returns a thing' do
|
19
|
+
stub_request(:any, "http://www.boardgamegeek.com/xmlapi2/thing").with(:query => {:id => '84876', :type => 'boardgame'}).to_return(:body => File.new('sample_data/thing?id=84876&type=boardgame'), :status => 200)
|
20
|
+
|
21
|
+
bgg = BggApi.new
|
22
|
+
results = bgg.thing({:id => '84876', :type => 'boardgame'})
|
23
|
+
|
24
|
+
results.should_not be_nil
|
25
|
+
results['item'][0]['id'].should == '84876'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
describe 'BGG Collection' do
|
30
|
+
it 'retrieves a collection' do
|
31
|
+
stub_request(:any, "http://www.boardgamegeek.com/xmlapi2/collection").with(:query => {:own => '1', :name => 'texasjdl', :type => 'boardgame'}).to_return(:body => File.new('sample_data/collection?username=texasjdl&own=1&excludesubtype=boardgameexpansion'), :status => 200)
|
32
|
+
|
33
|
+
bgg = BggApi.new
|
34
|
+
results = bgg.collection({:name => 'texasjdl', :own => '1', :type => 'boardgame'})
|
35
|
+
|
36
|
+
results.should_not be_nil
|
37
|
+
results['item'][0]['objectid'].should == '421'
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
describe 'BGG Hot Items' do
|
42
|
+
it 'retrieves the current hot boardgames' do
|
43
|
+
stub_request(:any, "http://www.boardgamegeek.com/xmlapi2/hot").with(:query => {:type => 'boardgame'}).to_return(:body => File.new('sample_data/hot?type=boardgame'), :status => 200)
|
44
|
+
|
45
|
+
bgg = BggApi.new
|
46
|
+
results = bgg.hot({:type => 'boardgame'})
|
47
|
+
|
48
|
+
results.should_not be_nil
|
49
|
+
results['item'][0]['rank'].should == '1'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
53
|
+
describe 'BGG Plays' do
|
54
|
+
it 'retrieves the plays for a user' do
|
55
|
+
stub_request(:any, "http://www.boardgamegeek.com/xmlapi2/plays").with(:query => {:id => '84876', :username => 'texasjdl'}).to_return(:body => File.new('sample_data/plays?username=texasjdl&id=84876'), :status => 200)
|
56
|
+
|
57
|
+
bgg = BggApi.new
|
58
|
+
results = bgg.plays({:id => '84876', :username => 'texasjdl'})
|
59
|
+
|
60
|
+
results.should_not be_nil
|
61
|
+
results['total'].should == '27'
|
62
|
+
end
|
63
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
require 'webmock/rspec'
|
2
|
+
|
3
|
+
# This file was generated by the `rspec --init` command. Conventionally, all
|
4
|
+
# specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
|
5
|
+
# Require this file using `require "spec_helper"` to ensure that it is only
|
6
|
+
# loaded once.
|
7
|
+
#
|
8
|
+
# See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
|
9
|
+
RSpec.configure do |config|
|
10
|
+
config.treat_symbols_as_metadata_keys_with_true_values = true
|
11
|
+
config.run_all_when_everything_filtered = true
|
12
|
+
config.filter_run :focus
|
13
|
+
|
14
|
+
# Run specs in random order to surface order dependencies. If you find an
|
15
|
+
# order dependency and want to debug it, you can fix the order by providing
|
16
|
+
# the seed, which is printed after each run.
|
17
|
+
# --seed 1234
|
18
|
+
config.order = 'random'
|
19
|
+
end
|
metadata
ADDED
@@ -0,0 +1,166 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bgg-api
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Brett Hardin
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2013-01-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
15
|
+
name: httparty
|
16
|
+
requirement: &2155297900 !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: '0'
|
22
|
+
type: :runtime
|
23
|
+
prerelease: false
|
24
|
+
version_requirements: *2155297900
|
25
|
+
- !ruby/object:Gem::Dependency
|
26
|
+
name: xml-simple
|
27
|
+
requirement: &2155297100 !ruby/object:Gem::Requirement
|
28
|
+
none: false
|
29
|
+
requirements:
|
30
|
+
- - ! '>='
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '0'
|
33
|
+
type: :runtime
|
34
|
+
prerelease: false
|
35
|
+
version_requirements: *2155297100
|
36
|
+
- !ruby/object:Gem::Dependency
|
37
|
+
name: bundler
|
38
|
+
requirement: &2155296560 !ruby/object:Gem::Requirement
|
39
|
+
none: false
|
40
|
+
requirements:
|
41
|
+
- - ! '>='
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: 1.0.0
|
44
|
+
type: :development
|
45
|
+
prerelease: false
|
46
|
+
version_requirements: *2155296560
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: rspec
|
49
|
+
requirement: &2155295960 !ruby/object:Gem::Requirement
|
50
|
+
none: false
|
51
|
+
requirements:
|
52
|
+
- - ! '>='
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '0'
|
55
|
+
type: :development
|
56
|
+
prerelease: false
|
57
|
+
version_requirements: *2155295960
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: webmock
|
60
|
+
requirement: &2155295220 !ruby/object:Gem::Requirement
|
61
|
+
none: false
|
62
|
+
requirements:
|
63
|
+
- - ! '>='
|
64
|
+
- !ruby/object:Gem::Version
|
65
|
+
version: '0'
|
66
|
+
type: :development
|
67
|
+
prerelease: false
|
68
|
+
version_requirements: *2155295220
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: jeweler
|
71
|
+
requirement: &2155294520 !ruby/object:Gem::Requirement
|
72
|
+
none: false
|
73
|
+
requirements:
|
74
|
+
- - ! '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
type: :development
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: *2155294520
|
80
|
+
- !ruby/object:Gem::Dependency
|
81
|
+
name: rake
|
82
|
+
requirement: &2155293840 !ruby/object:Gem::Requirement
|
83
|
+
none: false
|
84
|
+
requirements:
|
85
|
+
- - ! '>='
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: '0'
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: *2155293840
|
91
|
+
- !ruby/object:Gem::Dependency
|
92
|
+
name: rcov
|
93
|
+
requirement: &2155293360 !ruby/object:Gem::Requirement
|
94
|
+
none: false
|
95
|
+
requirements:
|
96
|
+
- - ! '>='
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '0'
|
99
|
+
type: :development
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: *2155293360
|
102
|
+
- !ruby/object:Gem::Dependency
|
103
|
+
name: rdoc
|
104
|
+
requirement: &2155292880 !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
type: :development
|
111
|
+
prerelease: false
|
112
|
+
version_requirements: *2155292880
|
113
|
+
description: A gem to interact with the BGG API
|
114
|
+
email: hardin.brett@gmail.com
|
115
|
+
executables: []
|
116
|
+
extensions: []
|
117
|
+
extra_rdoc_files:
|
118
|
+
- LICENSE.txt
|
119
|
+
- README.md
|
120
|
+
files:
|
121
|
+
- .document
|
122
|
+
- .rspec
|
123
|
+
- Gemfile
|
124
|
+
- Gemfile.lock
|
125
|
+
- LICENSE.txt
|
126
|
+
- README.md
|
127
|
+
- Rakefile
|
128
|
+
- VERSION
|
129
|
+
- lib/bgg_api.rb
|
130
|
+
- sample_data/collection?username=texasjdl&own=1&excludesubtype=boardgameexpansion
|
131
|
+
- sample_data/hot?type=boardgame
|
132
|
+
- sample_data/plays?username=texasjdl&id=84876
|
133
|
+
- sample_data/search?query=Burgund&type=boardgame
|
134
|
+
- sample_data/thing?id=84876&type=boardgame
|
135
|
+
- sample_data/user?name=texasjdl
|
136
|
+
- spec/bgg_api_spec.rb
|
137
|
+
- spec/spec_helper.rb
|
138
|
+
homepage: http://github.com/bhardin/bgg-api
|
139
|
+
licenses:
|
140
|
+
- MIT
|
141
|
+
post_install_message:
|
142
|
+
rdoc_options: []
|
143
|
+
require_paths:
|
144
|
+
- lib
|
145
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
146
|
+
none: false
|
147
|
+
requirements:
|
148
|
+
- - ! '>='
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: '0'
|
151
|
+
segments:
|
152
|
+
- 0
|
153
|
+
hash: -997643993582713169
|
154
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
155
|
+
none: false
|
156
|
+
requirements:
|
157
|
+
- - ! '>='
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
requirements: []
|
161
|
+
rubyforge_project:
|
162
|
+
rubygems_version: 1.8.6
|
163
|
+
signing_key:
|
164
|
+
specification_version: 3
|
165
|
+
summary: boardgamegeek api gem
|
166
|
+
test_files: []
|