bgg 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (57) hide show
  1. checksums.yaml +7 -0
  2. data/.document +5 -0
  3. data/.rspec +2 -0
  4. data/.travis.yml +6 -0
  5. data/Gemfile +20 -0
  6. data/Gemfile.lock +54 -0
  7. data/LICENSE.txt +20 -0
  8. data/README.md +73 -0
  9. data/Rakefile +38 -0
  10. data/VERSION +1 -0
  11. data/bgg.gemspec +122 -0
  12. data/lib/bgg.rb +53 -0
  13. data/lib/bgg/collection.rb +58 -0
  14. data/lib/bgg/collection_item.rb +69 -0
  15. data/lib/bgg/game.rb +57 -0
  16. data/lib/bgg/play.rb +64 -0
  17. data/lib/bgg/plays.rb +26 -0
  18. data/lib/bgg/plays_iterator.rb +64 -0
  19. data/lib/bgg/search.rb +34 -0
  20. data/lib/bgg/search_result.rb +18 -0
  21. data/lib/bgg/user.rb +60 -0
  22. data/sample_data/collection?username=texasjdl +5224 -0
  23. data/sample_data/collection?username=texasjdl&own=1&excludesubtype=boardgameexpansion +2606 -0
  24. data/sample_data/collection?username=yyyyyyy +3 -0
  25. data/sample_data/hot?type=boardgame +253 -0
  26. data/sample_data/plays?pages=9999999999999&username=ryanmacg +2 -0
  27. data/sample_data/plays?username=beetss&page=1 +3 -0
  28. data/sample_data/plays?username=ryanmacg +504 -0
  29. data/sample_data/plays?username=texasjdl&id=84876 +192 -0
  30. data/sample_data/plays?username=texasjdl&id=84876&type=thing +199 -0
  31. data/sample_data/plays?username=texasjdl&page=1 +717 -0
  32. data/sample_data/plays?username=texasjdl&page=2 +709 -0
  33. data/sample_data/plays?username=texasjdl&page=3 +707 -0
  34. data/sample_data/plays?username=yyyyyyy&page=1 +667 -0
  35. data/sample_data/search?query=Burgun +47 -0
  36. data/sample_data/search?query=Burgun&exact=1 +3 -0
  37. data/sample_data/search?query=Burgund&type=boardgame +12 -0
  38. data/sample_data/search?query=The+Castles+of+Burgundy&exact=1 +7 -0
  39. data/sample_data/search?query=yyyyyyy +3 -0
  40. data/sample_data/thing?id=10000000&type=boardgame +3 -0
  41. data/sample_data/thing?id=29773&type=boardgame +90 -0
  42. data/sample_data/thing?id=70512&type=boardgame +82 -0
  43. data/sample_data/thing?id=84876&type=boardgame +82 -0
  44. data/sample_data/user?name=texasjdl +17 -0
  45. data/sample_data/user?name=yyyyyyy +17 -0
  46. data/spec/bgg_api_spec.rb +113 -0
  47. data/spec/bgg_collection_item_spec.rb +259 -0
  48. data/spec/bgg_collection_spec.rb +83 -0
  49. data/spec/bgg_game_spec.rb +232 -0
  50. data/spec/bgg_play_spec.rb +166 -0
  51. data/spec/bgg_plays_iterator_spec.rb +156 -0
  52. data/spec/bgg_plays_spec.rb +60 -0
  53. data/spec/bgg_search_result_spec.rb +73 -0
  54. data/spec/bgg_search_spec.rb +84 -0
  55. data/spec/bgg_user_spec.rb +113 -0
  56. data/spec/spec_helper.rb +29 -0
  57. metadata +241 -0
@@ -0,0 +1,47 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items total="11" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <item type="boardgame" id="84876">
4
+ <name type="primary" value="The Castles of Burgundy"/>
5
+ <yearpublished value="2011"/>
6
+ </item>
7
+ <item type="boardgame" id="110926">
8
+ <name type="primary" value="The Castles of Burgundy: New Player Boards"/>
9
+ <yearpublished value="2011"/>
10
+ </item>
11
+ <item type="boardgame" id="139160">
12
+ <name type="primary" value="The Castles of Burgundy: Player Board – German board game championship 2013"/>
13
+ <yearpublished value="2013"/>
14
+ </item>
15
+ <item type="boardgame" id="132477">
16
+ <name type="primary" value="The Castles of Burgundy: The 2nd Expansion"/>
17
+ <yearpublished value="2012"/>
18
+ </item>
19
+ <item type="boardgame" id="150083">
20
+ <name type="primary" value="The Castles of Burgundy: The 4th Expansion"/>
21
+ <yearpublished value="2013"/>
22
+ </item>
23
+ <item type="boardgame" id="7087">
24
+ <name type="primary" value="Fürsten von Burgund"/>
25
+ <yearpublished value="1992"/>
26
+ </item>
27
+ <item type="boardgameexpansion" id="110926">
28
+ <name type="primary" value="The Castles of Burgundy: New Player Boards"/>
29
+ <yearpublished value="2011"/>
30
+ </item>
31
+ <item type="boardgameexpansion" id="139160">
32
+ <name type="primary" value="The Castles of Burgundy: Player Board – German board game championship 2013"/>
33
+ <yearpublished value="2013"/>
34
+ </item>
35
+ <item type="boardgameexpansion" id="132477">
36
+ <name type="primary" value="The Castles of Burgundy: The 2nd Expansion"/>
37
+ <yearpublished value="2012"/>
38
+ </item>
39
+ <item type="boardgameexpansion" id="150083">
40
+ <name type="primary" value="The Castles of Burgundy: The 4th Expansion"/>
41
+ <yearpublished value="2013"/>
42
+ </item>
43
+ <item type="rpgitem" id="83618">
44
+ <name type="primary" value="The Burgundy Pit"/>
45
+ <yearpublished value="1981"/>
46
+ </item>
47
+ </items>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items total="0" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ </items>
@@ -0,0 +1,12 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items total="3" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <item type="boardgame" id="84876">
4
+ <name type="primary" value="The Castles of Burgundy"/>
5
+ </item>
6
+ <item type="boardgame" id="110926">
7
+ <name type="primary" value="The Castles of Burgundy: New Player Boards"/>
8
+ </item>
9
+ <item type="boardgame" id="7087">
10
+ <name type="primary" value="Fürsten von Burgund"/>
11
+ </item>
12
+ </items>
@@ -0,0 +1,7 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items total="1" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <item type="boardgame" id="84876">
4
+ <name type="primary" value="The Castles of Burgundy"/>
5
+ <yearpublished value="2011"/>
6
+ </item>
7
+ </items>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items total="0" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ </items>
@@ -0,0 +1,3 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ </items>
@@ -0,0 +1,90 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <item type="boardgame" id="29773">
4
+ <thumbnail>http://cf.geekdo-images.com/images/pic270766_t.jpg</thumbnail>
5
+ <image>http://cf.geekdo-images.com/images/pic270766.jpg</image>
6
+ <name type="primary" sortindex="1" value="Cheeky Monkey"/>
7
+ <name type="alternate" sortindex="1" value="Monkey Business"/>
8
+ <name type="alternate" sortindex="1" value="Обезьянки-хулиганки"/>
9
+ <name type="alternate" sortindex="1" value="チーキーモンキー"/>
10
+ <description>The push-your-luck game Cheeky Monkey includes eight sets of animals &amp;ndash; three elephants, four seals, and so on up to ten monkeys &amp;ndash; with a plastic chip representing each animal. To start the game, you place all the chips in a bag.&amp;#10;&amp;#10;On a turn, a player may draw chips until either (1) he chooses to stop or (2) he draws an animal that he has lying in front of him from a previous draw this turn. In this latter case, he returns all chips in front of him from the current turn to the bag, and the next player then takes his turn. In the former case, he stacks the chips in whatever order he wants on top of any chips he's collected in previous turns. (If a player has animals of only a single type, he can tuck them on the bottom of his stack.) Two special rules come into play while the player draws chips:&amp;#10;&amp;#10;&amp;#10; If a player draws an animal chip that matches the animal on top of an opponent's stack, the player can steal this animal, adding it to the chips currently in front of him. (If he busts for drawing a duplicate animal, this stolen chip is also returned to the bag.)&amp;#10; If a player draws a monkey, he can either keep the monkey (as with any other animal) or he can swap the monkey for the chip on top of an opponent's stack.&amp;#10;&amp;#10;&amp;#10;When the last chip has been added to a stack, the game ends. Any player who has more chips of an animal type than any other player receives bonus points equal to the total number of that animal in the game. The player with the most points wins.&amp;#10;&amp;#10;</description>
11
+ <yearpublished value="2007"/>
12
+ <minplayers value="2"/>
13
+ <maxplayers value="6"/>
14
+ <poll name="suggested_numplayers" title="User Suggested Number of Players" totalvotes="16">
15
+ <results numplayers="1">
16
+ <result value="Best" numvotes="0"/>
17
+ <result value="Recommended" numvotes="0"/>
18
+ <result value="Not Recommended" numvotes="8"/>
19
+ </results>
20
+ <results numplayers="2">
21
+ <result value="Best" numvotes="0"/>
22
+ <result value="Recommended" numvotes="4"/>
23
+ <result value="Not Recommended" numvotes="8"/>
24
+ </results>
25
+ <results numplayers="3">
26
+ <result value="Best" numvotes="3"/>
27
+ <result value="Recommended" numvotes="9"/>
28
+ <result value="Not Recommended" numvotes="3"/>
29
+ </results>
30
+ <results numplayers="4">
31
+ <result value="Best" numvotes="8"/>
32
+ <result value="Recommended" numvotes="7"/>
33
+ <result value="Not Recommended" numvotes="0"/>
34
+ </results>
35
+ <results numplayers="5">
36
+ <result value="Best" numvotes="11"/>
37
+ <result value="Recommended" numvotes="4"/>
38
+ <result value="Not Recommended" numvotes="0"/>
39
+ </results>
40
+ <results numplayers="6">
41
+ <result value="Best" numvotes="8"/>
42
+ <result value="Recommended" numvotes="5"/>
43
+ <result value="Not Recommended" numvotes="1"/>
44
+ </results>
45
+ <results numplayers="6+">
46
+ <result value="Best" numvotes="1"/>
47
+ <result value="Recommended" numvotes="4"/>
48
+ <result value="Not Recommended" numvotes="2"/>
49
+ </results>
50
+ </poll>
51
+ <playingtime value="20"/>
52
+ <minage value="7"/>
53
+ <poll name="suggested_playerage" title="User Suggested Player Age" totalvotes="5">
54
+ <results>
55
+ <result value="2" numvotes="0"/>
56
+ <result value="3" numvotes="0"/>
57
+ <result value="4" numvotes="1"/>
58
+ <result value="5" numvotes="2"/>
59
+ <result value="6" numvotes="2"/>
60
+ <result value="8" numvotes="0"/>
61
+ <result value="10" numvotes="0"/>
62
+ <result value="12" numvotes="0"/>
63
+ <result value="14" numvotes="0"/>
64
+ <result value="16" numvotes="0"/>
65
+ <result value="18" numvotes="0"/>
66
+ <result value="21 and up" numvotes="0"/>
67
+ </results>
68
+ </poll>
69
+ <poll name="language_dependence" title="Language Dependence" totalvotes="3">
70
+ <results>
71
+ <result level="1" value="No necessary in-game text" numvotes="3"/>
72
+ <result level="2" value="Some necessary text - easily memorized or small crib sheet" numvotes="0"/>
73
+ <result level="3" value="Moderate in-game text - needs crib sheet or paste ups" numvotes="0"/>
74
+ <result level="4" value="Extensive use of text - massive conversion needed to be playable" numvotes="0"/>
75
+ <result level="5" value="Unplayable in another language" numvotes="0"/>
76
+ </results>
77
+ </poll>
78
+ <link type="boardgamecategory" id="1089" value="Animals"/>
79
+ <link type="boardgamecategory" id="1041" value="Children's Game"/>
80
+ <link type="boardgamemechanic" id="2661" value="Press Your Luck"/>
81
+ <link type="boardgamemechanic" id="2004" value="Set Collection"/>
82
+ <link type="boardgamefamily" id="7178" value="Animals: Apes / Monkeys"/>
83
+ <link type="boardgamedesigner" id="2" value="Reiner Knizia"/>
84
+ <link type="boardgameartist" id="11795" value="Rob Walker"/>
85
+ <link type="boardgamepublisher" id="3475" value="Arclight"/>
86
+ <link type="boardgamepublisher" id="1705" value="Face2Face Games"/>
87
+ <link type="boardgamepublisher" id="8405" value="Gryphon Games"/>
88
+ <link type="boardgamepublisher" id="22" value="Piatnik"/>
89
+ </item>
90
+ </items>
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <item type="boardgame" id="70512">
4
+ <thumbnail>http://cf.geekdo-images.com/images/pic1176894_t.jpg</thumbnail>
5
+ <image>http://cf.geekdo-images.com/images/pic1176894.jpg</image>
6
+ <name type="primary" sortindex="5" value="Luna"/>
7
+ <name type="alternate" sortindex="5" value="Die Burgen von Burgund"/>
8
+ <name type="alternate" sortindex="5" value="Les Châteaux de Bourgogne"/>
9
+ <description>The game is set in the Burgundy region of High Medieval France. Each player takes on the role of an aristocrat, originally controlling a small princedom. While playing they aim to build settlements and powerful castles, practice trade along the river, exploit silver mines, and use the knowledge of travellers.&amp;#10;&amp;#10;The game is about placing settlement tiles into the princedom. Every tile has a function that starts when the tile is placed. The princedom itself consists of several regions, each of which demands its own settlement tile.&amp;#10;&amp;#10;The core game mechanism involves two dice. The pips show the kind of action the players are allowed to do (example: roll a 2 and a 5: using the 2 the player buys a watch tower and places it on a 5 city tile which triggers the function of the tower with additional advantages).&amp;#10;&amp;#10;It is also possible to influence the dice, so the player is not completely subject to luck.&amp;#10;&amp;#10;The rules include basic and advanced versions.&amp;#10;&amp;#10;This game is #14 in the Alea big box series.&amp;#10;&amp;#10;</description>
10
+ <yearpublished value="2011"/>
11
+ <minplayers value="2"/>
12
+ <maxplayers value="4"/>
13
+ <poll name="suggested_numplayers" title="User Suggested Number of Players" totalvotes="112">
14
+ <results numplayers="1">
15
+ <result value="Best" numvotes="0"/>
16
+ <result value="Recommended" numvotes="3"/>
17
+ <result value="Not Recommended" numvotes="41"/>
18
+ </results>
19
+ <results numplayers="2">
20
+ <result value="Best" numvotes="72"/>
21
+ <result value="Recommended" numvotes="27"/>
22
+ <result value="Not Recommended" numvotes="2"/>
23
+ </results>
24
+ <results numplayers="3">
25
+ <result value="Best" numvotes="44"/>
26
+ <result value="Recommended" numvotes="41"/>
27
+ <result value="Not Recommended" numvotes="1"/>
28
+ </results>
29
+ <results numplayers="4">
30
+ <result value="Best" numvotes="16"/>
31
+ <result value="Recommended" numvotes="44"/>
32
+ <result value="Not Recommended" numvotes="31"/>
33
+ </results>
34
+ <results numplayers="4+">
35
+ <result value="Best" numvotes="0"/>
36
+ <result value="Recommended" numvotes="1"/>
37
+ <result value="Not Recommended" numvotes="35"/>
38
+ </results>
39
+ </poll>
40
+ <playingtime value="90"/>
41
+ <minage value="12"/>
42
+ <poll name="suggested_playerage" title="User Suggested Player Age" totalvotes="23">
43
+ <results>
44
+ <result value="2" numvotes="0"/>
45
+ <result value="3" numvotes="0"/>
46
+ <result value="4" numvotes="0"/>
47
+ <result value="5" numvotes="0"/>
48
+ <result value="6" numvotes="1"/>
49
+ <result value="8" numvotes="0"/>
50
+ <result value="10" numvotes="7"/>
51
+ <result value="12" numvotes="13"/>
52
+ <result value="14" numvotes="2"/>
53
+ <result value="16" numvotes="0"/>
54
+ <result value="18" numvotes="0"/>
55
+ <result value="21 and up" numvotes="0"/>
56
+ </results>
57
+ </poll>
58
+ <poll name="language_dependence" title="Language Dependence" totalvotes="35">
59
+ <results>
60
+ <result level="1" value="No necessary in-game text" numvotes="32"/>
61
+ <result level="2" value="Some necessary text - easily memorized or small crib sheet" numvotes="3"/>
62
+ <result level="3" value="Moderate in-game text - needs crib sheet or paste ups" numvotes="0"/>
63
+ <result level="4" value="Extensive use of text - massive conversion needed to be playable" numvotes="0"/>
64
+ <result level="5" value="Unplayable in another language" numvotes="0"/>
65
+ </results>
66
+ </poll>
67
+ <link type="boardgamecategory" id="1017" value="Dice"/>
68
+ <link type="boardgamecategory" id="1035" value="Medieval"/>
69
+ <link type="boardgamecategory" id="1086" value="Territory Building"/>
70
+ <link type="boardgamemechanic" id="2072" value="Dice Rolling"/>
71
+ <link type="boardgamemechanic" id="2004" value="Set Collection"/>
72
+ <link type="boardgamemechanic" id="2002" value="Tile Placement"/>
73
+ <link type="boardgamefamily" id="58" value="Alea Big Box"/>
74
+ <link type="boardgamefamily" id="11006" value="Country: France"/>
75
+ <link type="boardgameexpansion" id="110926" value="The Castles of Burgundy: New Player Boards"/>
76
+ <link type="boardgamedesigner" id="4958" value="Stefan Feld"/>
77
+ <link type="boardgameartist" id="11886" value="Julien Delval"/>
78
+ <link type="boardgameartist" id="4959" value="Harald Lieske"/>
79
+ <link type="boardgamepublisher" id="9" value="alea"/>
80
+ <link type="boardgamepublisher" id="34" value="Ravensburger"/>
81
+ </item>
82
+ </items>
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <items termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <item type="boardgame" id="84876">
4
+ <thumbnail>http://cf.geekdo-images.com/images/pic1176894_t.jpg</thumbnail>
5
+ <image>http://cf.geekdo-images.com/images/pic1176894.jpg</image>
6
+ <name type="primary" sortindex="5" value="The Castles of Burgundy"/>
7
+ <name type="alternate" sortindex="5" value="Die Burgen von Burgund"/>
8
+ <name type="alternate" sortindex="5" value="Les Châteaux de Bourgogne"/>
9
+ <description>The game is set in the Burgundy region of High Medieval France. Each player takes on the role of an aristocrat, originally controlling a small princedom. While playing they aim to build settlements and powerful castles, practice trade along the river, exploit silver mines, and use the knowledge of travellers.&amp;#10;&amp;#10;The game is about placing settlement tiles into the princedom. Every tile has a function that starts when the tile is placed. The princedom itself consists of several regions, each of which demands its own settlement tile.&amp;#10;&amp;#10;The core game mechanism involves two dice. The pips show the kind of action the players are allowed to do (example: roll a 2 and a 5: using the 2 the player buys a watch tower and places it on a 5 city tile which triggers the function of the tower with additional advantages).&amp;#10;&amp;#10;It is also possible to influence the dice, so the player is not completely subject to luck.&amp;#10;&amp;#10;The rules include basic and advanced versions.&amp;#10;&amp;#10;This game is #14 in the Alea big box series.&amp;#10;&amp;#10;</description>
10
+ <yearpublished value="2011"/>
11
+ <minplayers value="2"/>
12
+ <maxplayers value="4"/>
13
+ <poll name="suggested_numplayers" title="User Suggested Number of Players" totalvotes="112">
14
+ <results numplayers="1">
15
+ <result value="Best" numvotes="0"/>
16
+ <result value="Recommended" numvotes="3"/>
17
+ <result value="Not Recommended" numvotes="41"/>
18
+ </results>
19
+ <results numplayers="2">
20
+ <result value="Best" numvotes="72"/>
21
+ <result value="Recommended" numvotes="27"/>
22
+ <result value="Not Recommended" numvotes="2"/>
23
+ </results>
24
+ <results numplayers="3">
25
+ <result value="Best" numvotes="44"/>
26
+ <result value="Recommended" numvotes="41"/>
27
+ <result value="Not Recommended" numvotes="1"/>
28
+ </results>
29
+ <results numplayers="4">
30
+ <result value="Best" numvotes="16"/>
31
+ <result value="Recommended" numvotes="44"/>
32
+ <result value="Not Recommended" numvotes="31"/>
33
+ </results>
34
+ <results numplayers="4+">
35
+ <result value="Best" numvotes="0"/>
36
+ <result value="Recommended" numvotes="1"/>
37
+ <result value="Not Recommended" numvotes="35"/>
38
+ </results>
39
+ </poll>
40
+ <playingtime value="90"/>
41
+ <minage value="12"/>
42
+ <poll name="suggested_playerage" title="User Suggested Player Age" totalvotes="23">
43
+ <results>
44
+ <result value="2" numvotes="0"/>
45
+ <result value="3" numvotes="0"/>
46
+ <result value="4" numvotes="0"/>
47
+ <result value="5" numvotes="0"/>
48
+ <result value="6" numvotes="1"/>
49
+ <result value="8" numvotes="0"/>
50
+ <result value="10" numvotes="7"/>
51
+ <result value="12" numvotes="13"/>
52
+ <result value="14" numvotes="2"/>
53
+ <result value="16" numvotes="0"/>
54
+ <result value="18" numvotes="0"/>
55
+ <result value="21 and up" numvotes="0"/>
56
+ </results>
57
+ </poll>
58
+ <poll name="language_dependence" title="Language Dependence" totalvotes="35">
59
+ <results>
60
+ <result level="1" value="No necessary in-game text" numvotes="32"/>
61
+ <result level="2" value="Some necessary text - easily memorized or small crib sheet" numvotes="3"/>
62
+ <result level="3" value="Moderate in-game text - needs crib sheet or paste ups" numvotes="0"/>
63
+ <result level="4" value="Extensive use of text - massive conversion needed to be playable" numvotes="0"/>
64
+ <result level="5" value="Unplayable in another language" numvotes="0"/>
65
+ </results>
66
+ </poll>
67
+ <link type="boardgamecategory" id="1017" value="Dice"/>
68
+ <link type="boardgamecategory" id="1035" value="Medieval"/>
69
+ <link type="boardgamecategory" id="1086" value="Territory Building"/>
70
+ <link type="boardgamemechanic" id="2072" value="Dice Rolling"/>
71
+ <link type="boardgamemechanic" id="2004" value="Set Collection"/>
72
+ <link type="boardgamemechanic" id="2002" value="Tile Placement"/>
73
+ <link type="boardgamefamily" id="58" value="Alea Big Box"/>
74
+ <link type="boardgamefamily" id="11006" value="Country: France"/>
75
+ <link type="boardgameexpansion" id="110926" value="The Castles of Burgundy: New Player Boards"/>
76
+ <link type="boardgamedesigner" id="4958" value="Stefan Feld"/>
77
+ <link type="boardgameartist" id="11886" value="Julien Delval"/>
78
+ <link type="boardgameartist" id="4959" value="Harald Lieske"/>
79
+ <link type="boardgamepublisher" id="9" value="alea"/>
80
+ <link type="boardgamepublisher" id="34" value="Ravensburger"/>
81
+ </item>
82
+ </items>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <user id="39488" name="texasjdl" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <firstname value="Jeremiah"/>
4
+ <lastname value="Lee"/>
5
+ <avatarlink value="http://geekdo-images.com/avatars/avatar_id14507.jpg"/>
6
+ <yearregistered value="2004"/>
7
+ <lastlogin value="2012-08-15"/>
8
+ <stateorprovince value="California"/>
9
+ <country value="United States"/>
10
+ <webaddress value=""/>
11
+ <xboxaccount value="Solipsyst"/>
12
+ <wiiaccount value=""/>
13
+ <psnaccount value=""/>
14
+ <battlenetaccount value=""/>
15
+ <steamaccount value=""/>
16
+ <traderating value="5"/>
17
+ </user>
@@ -0,0 +1,17 @@
1
+ <?xml version="1.0" encoding="utf-8"?>
2
+ <user id="" name="yyyyyyy" termsofuse="http://boardgamegeek.com/xmlapi/termsofuse">
3
+ <firstname value=""/>
4
+ <lastname value=""/>
5
+ <avatarlink value="N/A"/>
6
+ <yearregistered value=""/>
7
+ <lastlogin value=""/>
8
+ <stateorprovince value=""/>
9
+ <country value=""/>
10
+ <webaddress value=""/>
11
+ <xboxaccount value=""/>
12
+ <wiiaccount value=""/>
13
+ <psnaccount value=""/>
14
+ <battlenetaccount value=""/>
15
+ <steamaccount value=""/>
16
+ <traderating value="362"/>
17
+ </user>
@@ -0,0 +1,113 @@
1
+ require 'spec_helper'
2
+
3
+ describe 'BggApi basic API calls' do
4
+ context 'when calling an undefined method' do
5
+ subject { BggApi.foo }
6
+
7
+ it 'raises an UndefinedMethodError' do
8
+ expect { subject }.to raise_error(NoMethodError)
9
+ end
10
+ end
11
+
12
+ context 'with stubbed responses' do
13
+ let(:expected_response) { File.open(response_file) }
14
+
15
+ before do
16
+ stub_request(:any, request_url)
17
+ .with(query: query)
18
+ .to_return(body: expected_response, status: 200)
19
+ end
20
+
21
+ describe 'BGG Search' do
22
+ let(:query) { {query: 'Burgund', type: 'boardgame'} }
23
+ let(:request_url) { 'http://www.boardgamegeek.com/xmlapi2/search' }
24
+ let(:response_file) { 'sample_data/search?query=Burgund&type=boardgame' }
25
+
26
+ subject(:results) { BggApi.search(query) }
27
+
28
+ it { should_not be_nil }
29
+ end
30
+
31
+ describe 'BGG Thing' do
32
+ let(:query) { {id: '84876', type: 'boardgame'} }
33
+ let(:request_url) { 'http://www.boardgamegeek.com/xmlapi2/thing' }
34
+ let(:response_file) { 'sample_data/thing?id=84876&type=boardgame' }
35
+
36
+ subject(:results) { BggApi.thing(query) }
37
+
38
+ it { should_not be_nil }
39
+
40
+ it 'retrieves the correct id' do
41
+ results['item'][0]['id'].should == '84876'
42
+ end
43
+ end
44
+
45
+ describe 'BGG Collection' do
46
+ let(:query) { {own: '1', username: 'texasjdl', type: 'boardgame'} }
47
+ let(:request_url) { 'http://www.boardgamegeek.com/xmlapi2/collection' }
48
+ let(:response_file) { 'sample_data/collection?username=texasjdl&own=1&excludesubtype=boardgameexpansion' }
49
+
50
+ subject(:results) { BggApi.collection(query) }
51
+
52
+ it { should_not be_nil }
53
+
54
+ it 'retrieves the correct id' do
55
+ results['item'][0]['objectid'].should == '421'
56
+ end
57
+ end
58
+
59
+ describe 'BGG Hot Items' do
60
+ let(:query) { {type: 'boardgame'} }
61
+ let(:request_url) { 'http://www.boardgamegeek.com/xmlapi2/hot' }
62
+ let(:response_file) { 'sample_data/hot?type=boardgame' }
63
+
64
+ subject(:results) { BggApi.hot(query) }
65
+
66
+ it { should_not be_nil }
67
+
68
+ it 'retrieves the correct rank' do
69
+ results['item'][0]['rank'].should == '1'
70
+ end
71
+ end
72
+
73
+ describe 'BGG Plays' do
74
+ let(:query) { {id: '84876', username: 'texasjdl'} }
75
+ let(:request_url) { 'http://www.boardgamegeek.com/xmlapi2/plays' }
76
+ let(:response_file) { 'sample_data/plays?username=texasjdl&id=84876' }
77
+
78
+ subject(:results) { BggApi.plays(query) }
79
+
80
+ it { should_not be_nil }
81
+
82
+ it 'retrieves the correct total' do
83
+ results['total'].should == '27'
84
+ end
85
+ end
86
+
87
+ describe 'BGG User' do
88
+ context 'who exists' do
89
+ let(:query) { {name: 'texasjdl'} }
90
+ let(:request_url) { 'http://www.boardgamegeek.com/xmlapi2/user' }
91
+ let(:response_file) { 'sample_data/user?name=texasjdl' }
92
+
93
+ subject(:results) { BggApi.user(query) }
94
+
95
+ it { should_not be_nil }
96
+
97
+ it 'has a yearregistered value' do
98
+ results['yearregistered'][0]['value'].should == '2004'
99
+ end
100
+ end
101
+
102
+ context 'who does not exist' do
103
+ let(:query) { {name: 'yyyyyyy'} }
104
+ let(:request_url) { 'http://www.boardgamegeek.com/xmlapi2/user' }
105
+ let(:response_file) { 'sample_data/user?name=yyyyyyy' }
106
+
107
+ subject(:results) { BggApi.user(query) }
108
+
109
+ it { should raise_error }
110
+ end
111
+ end
112
+ end
113
+ end