snafu 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (50) hide show
  1. data/.gitignore +1 -0
  2. data/CHANGELOG.textile +12 -1
  3. data/README.textile +68 -7
  4. data/lib/snafu.rb +9 -2
  5. data/lib/snafu/achievements.rb +17 -0
  6. data/lib/snafu/client.rb +33 -23
  7. data/lib/snafu/giants.rb +35 -0
  8. data/lib/snafu/models.rb +4 -1
  9. data/lib/snafu/models/achievement.rb +24 -0
  10. data/lib/snafu/models/giant.rb +21 -0
  11. data/lib/snafu/models/glitch_time.rb +116 -0
  12. data/lib/snafu/models/hub.rb +5 -2
  13. data/lib/snafu/models/location.rb +3 -3
  14. data/lib/snafu/models/street.rb +13 -5
  15. data/lib/snafu/util.rb +12 -0
  16. data/lib/snafu/version.rb +1 -1
  17. data/snafu.gemspec +2 -2
  18. data/spec/snafu/achievements_spec.rb +51 -0
  19. data/spec/snafu/client_spec.rb +37 -15
  20. data/spec/snafu/giants_spec.rb +60 -0
  21. data/spec/snafu/locations_spec.rb +33 -32
  22. data/spec/snafu/models/achievement_spec.rb +31 -0
  23. data/spec/snafu/models/giant_spec.rb +38 -0
  24. data/spec/snafu/models/glitch_image_spec.rb +7 -17
  25. data/spec/snafu/models/glitch_time_spec.rb +176 -0
  26. data/spec/snafu/models/hub_spec.rb +2 -2
  27. data/spec/snafu/models/street_spec.rb +1 -1
  28. data/spec/snafu/models/util_spec.rb +22 -0
  29. data/spec/snafu_spec.rb +4 -3
  30. data/spec/spec_helper.rb +17 -16
  31. metadata +46 -54
  32. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_accept_a_hash_of_POST_arguments.yml +0 -39
  33. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_automatically_pass_in_the_oauth_token_if.yml +0 -36
  34. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_automatically_pass_in_the_oauth_token_if_authenticate.yml +0 -36
  35. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_automatically_pass_in_the_oauth_token_if_authenticate_called_with_true.yml +0 -36
  36. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_automatically_pass_in_the_oauth_token_if_called_with_authenticate.yml +0 -36
  37. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_automatically_pass_in_the_oauth_token_if_called_with_authenticate_true.yml +0 -36
  38. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_automatically_pass_in_the_oauth_token_if_called_with_true.yml +0 -36
  39. data/spec/fixtures/vcr_cassettes/Snafu_Client/call_should_raise_a_GlitchAPIError_if_receiving_an_unsucessful_response_from_the_Glitch_API.yml +0 -36
  40. data/spec/fixtures/vcr_cassettes/Snafu_Locations/get_hub_should_return_a_valid_hub_if_given_a_valid_Hub_ID.yml +0 -39
  41. data/spec/fixtures/vcr_cassettes/Snafu_Locations/get_hub_should_return_an_array_of_valid_street_information_if_given_a_valid_Hub_ID.yml +0 -39
  42. data/spec/fixtures/vcr_cassettes/Snafu_Locations/get_hubs_should_populated_the_returned_Hub_objects_with_an_id_and_name.yml +0 -39
  43. data/spec/fixtures/vcr_cassettes/Snafu_Locations/get_hubs_should_return_an_array_of_Hub_objects.yml +0 -39
  44. data/spec/fixtures/vcr_cassettes/Snafu_Locations/get_hubs_should_return_an_array_of_all_hubs.yml +0 -39
  45. data/spec/fixtures/vcr_cassettes/Snafu_Locations/get_street_should_return_a_complete_street_if_given_a_valid_street_ID.yml +0 -40
  46. data/spec/fixtures/vcr_cassettes/Snafu_Models_Hub/initialize_should_populate_values_if_given_the_raw_JSON_response_from_HTTParty.yml +0 -39
  47. data/spec/fixtures/vcr_cassettes/Snafu_Models_Hub/initialize_should_populate_values_if_given_the_raw_response_from_Glitch.yml +0 -39
  48. data/spec/fixtures/vcr_cassettes/Snafu_Models_Street/initialize_should_populate_values_if_given_the_raw_JSON_response_from_HTTParty.yml +0 -40
  49. data/spec/fixtures/vcr_cassettes/Snafu_Models_Street_new/should_populate_values_if_given_the_raw_JSON_response_from_HTTParty.yml +0 -40
  50. data/spec/fixtures/vcr_cassettes/calendar_getHoldays/valid_calendar.yml +0 -39
@@ -1,39 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api.glitch.com:80/simple/locations.getHubs
6
- body: !!null
7
- headers: !!null
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- access-control-allow-credentials:
14
- - 'false'
15
- access-control-allow-methods:
16
- - POST, GET, OPTIONS
17
- access-control-allow-origin:
18
- - ! '*'
19
- access-control-max-age:
20
- - '1728000'
21
- cache-control:
22
- - no-cache="set-cookie"
23
- content-type:
24
- - text/plain; charset=utf-8
25
- date:
26
- - Thu, 01 Dec 2011 01:35:00 GMT
27
- server:
28
- - Apache/2.2.17
29
- set-cookie:
30
- - AWSELB=F7715B6B10BD5947A6E9DAE19D6F6DD7D91A271FB744B8EE156EEC745EF275A9089C697163F6DA6B492CB3CBE399C5977DF92D1F3093BD75659503606D3AB37D325E15FFCF;PATH=/;MAX-AGE=600
31
- content-length:
32
- - '678'
33
- connection:
34
- - Close
35
- body: ! '{"ok":1,"hubs":{"27":{"name":"Ix"},"50":{"name":"Ilmenskie Caverns"},"51":{"name":"Uralia"},"56":{"name":"Groddle
36
- Forest"},"58":{"name":"Groddle Meadow"},"63":{"name":"Shimla Mirch"},"64":{"name":"Groddle
37
- Heights"},"71":{"name":"Jethimadh"},"72":{"name":"Chakra Phool"},"75":{"name":"Bortola"},"76":{"name":"Alakol"},"78":{"name":"Ilmenskie
38
- Deeps"},"85":{"name":"Kajuu"},"86":{"name":"Baqala"},"89":{"name":"Andra"},"90":{"name":"Choru"},"91":{"name":"Zhambu"},"92":{"name":"Tamila"},"93":{"name":"Salatu"},"95":{"name":"Xalanga"},"97":{"name":"Muufo"},"98":{"name":"Besara"},"99":{"name":"Kalavana"},"101":{"name":"Aranna"},"106":{"name":"Pollokoo"},"107":{"name":"Callopee"}}}'
39
- http_version: '1.1'
@@ -1,40 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api.glitch.com:80/simple/locations.streetInfo?street_tsid=LM416LNIKVLM1
6
- body: !!null
7
- headers: !!null
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- access-control-allow-credentials:
14
- - 'false'
15
- access-control-allow-methods:
16
- - POST, GET, OPTIONS
17
- access-control-allow-origin:
18
- - ! '*'
19
- access-control-max-age:
20
- - '1728000'
21
- cache-control:
22
- - no-cache="set-cookie"
23
- content-type:
24
- - text/plain; charset=utf-8
25
- date:
26
- - Thu, 01 Dec 2011 01:35:05 GMT
27
- server:
28
- - Apache/2.2.17
29
- set-cookie:
30
- - AWSELB=F7715B6B10BD5947A6E9DAE19D6F6DD7D91A271FB7C136A73584C8A9C7D99844891B9CE40943A67B18C55CD05576680FE8CB8ED1442E532BB1DB467DE7995571EE672126B5;PATH=/;MAX-AGE=600
31
- content-length:
32
- - '685'
33
- connection:
34
- - Close
35
- body: ! '{"ok":1,"tsid":"LM416LNIKVLM1","name":"Baby Steppes","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"},"active_project":false,"features":["<b>5
36
- Piggies<\/b>, <b>2 Butterflies<\/b>, <b>9 Chickens<\/b>, <b>5 Spice Plants<\/b>,
37
- and <b>1 Gas Plant<\/b>."],"connections":{"LM4115NJ46G8M":{"name":"Groddle Ladder","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}},"LM410TMR0S2S1":{"name":"Ruta
38
- Asuncion","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}},"LM4109NI2R640":{"name":"Guillermo
39
- Gamera Way","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}}},"image":{"url":"http:\/\/c2.glitch.bz\/streets\/2011-11-27\/LM416LNIKVLM1_main_1322382945.jpg","w":720,"h":120}}'
40
- http_version: '1.1'
@@ -1,39 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api.glitch.com:80/simple/locations.getStreets?hub_id=27
6
- body: !!null
7
- headers: !!null
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- access-control-allow-credentials:
14
- - 'false'
15
- access-control-allow-methods:
16
- - POST, GET, OPTIONS
17
- access-control-allow-origin:
18
- - ! '*'
19
- access-control-max-age:
20
- - '1728000'
21
- cache-control:
22
- - no-cache="set-cookie"
23
- content-type:
24
- - text/plain; charset=utf-8
25
- date:
26
- - Thu, 01 Dec 2011 01:51:35 GMT
27
- server:
28
- - Apache/2.2.17
29
- set-cookie:
30
- - AWSELB=F7715B6B10BD5947A6E9DAE19D6F6DD7D91A271FB7C136A73584C8A9C7D99844891B9CE40943A67B18C55CD05576680FE8CB8ED1442E532BB1DB467DE7995571EE672126B5;PATH=/;MAX-AGE=600
31
- content-length:
32
- - '329'
33
- connection:
34
- - Close
35
- body: ! '{"ok":1,"hub_id":"27","name":"Ix","streets":{"LM416LNIKVLM1":{"name":"Baby
36
- Steppes"},"LM413SQ6LRN58":{"name":"East Spice"},"LM410QQ0CHARO":{"name":"Flipside"},"LM4115NJ46G8M":{"name":"Groddle
37
- Ladder"},"LM4109NI2R640":{"name":"Guillermo Gamera Way"},"LM410TMR0S2S1":{"name":"Ruta
38
- Asuncion"},"LM413RQ6LRG9N":{"name":"West Spice"}}}'
39
- http_version: '1.1'
@@ -1,39 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api.glitch.com:80/simple/locations.getStreets?hub_id=27
6
- body: !!null
7
- headers: !!null
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- access-control-allow-credentials:
14
- - 'false'
15
- access-control-allow-methods:
16
- - POST, GET, OPTIONS
17
- access-control-allow-origin:
18
- - ! '*'
19
- access-control-max-age:
20
- - '1728000'
21
- cache-control:
22
- - no-cache="set-cookie"
23
- content-type:
24
- - text/plain; charset=utf-8
25
- date:
26
- - Thu, 01 Dec 2011 01:35:07 GMT
27
- server:
28
- - Apache/2.2.17
29
- set-cookie:
30
- - AWSELB=F7715B6B10BD5947A6E9DAE19D6F6DD7D91A271FB744B8EE156EEC745EF275A9089C697163F6DA6B492CB3CBE399C5977DF92D1F3093BD75659503606D3AB37D325E15FFCF;PATH=/;MAX-AGE=600
31
- content-length:
32
- - '329'
33
- connection:
34
- - Close
35
- body: ! '{"ok":1,"hub_id":"27","name":"Ix","streets":{"LM416LNIKVLM1":{"name":"Baby
36
- Steppes"},"LM413SQ6LRN58":{"name":"East Spice"},"LM410QQ0CHARO":{"name":"Flipside"},"LM4115NJ46G8M":{"name":"Groddle
37
- Ladder"},"LM4109NI2R640":{"name":"Guillermo Gamera Way"},"LM410TMR0S2S1":{"name":"Ruta
38
- Asuncion"},"LM413RQ6LRG9N":{"name":"West Spice"}}}'
39
- http_version: '1.1'
@@ -1,40 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api.glitch.com:80/simple/locations.streetInfo?street_tsid=LM416LNIKVLM1
6
- body: !!null
7
- headers: !!null
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- access-control-allow-credentials:
14
- - 'false'
15
- access-control-allow-methods:
16
- - POST, GET, OPTIONS
17
- access-control-allow-origin:
18
- - ! '*'
19
- access-control-max-age:
20
- - '1728000'
21
- cache-control:
22
- - no-cache="set-cookie"
23
- content-type:
24
- - text/plain; charset=utf-8
25
- date:
26
- - Thu, 01 Dec 2011 02:08:10 GMT
27
- server:
28
- - Apache/2.2.17
29
- set-cookie:
30
- - AWSELB=F7715B6B10BD5947A6E9DAE19D6F6DD7D91A271FB7C65A13E6B150AA38A20996585FE1291DCF151568D701ED5E98FEE24FF052B412CF84A57C93B1B6B2555103165F28F773;PATH=/;MAX-AGE=600
31
- content-length:
32
- - '685'
33
- connection:
34
- - Close
35
- body: ! '{"ok":1,"tsid":"LM416LNIKVLM1","name":"Baby Steppes","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"},"active_project":false,"features":["<b>5
36
- Piggies<\/b>, <b>2 Butterflies<\/b>, <b>9 Chickens<\/b>, <b>5 Spice Plants<\/b>,
37
- and <b>1 Gas Plant<\/b>."],"connections":{"LM4115NJ46G8M":{"name":"Groddle Ladder","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}},"LM410TMR0S2S1":{"name":"Ruta
38
- Asuncion","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}},"LM4109NI2R640":{"name":"Guillermo
39
- Gamera Way","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}}},"image":{"url":"http:\/\/c2.glitch.bz\/streets\/2011-11-27\/LM416LNIKVLM1_main_1322382945.jpg","w":720,"h":120}}'
40
- http_version: '1.1'
@@ -1,40 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api.glitch.com:80/simple/locations.streetInfo?street_tsid=LM416LNIKVLM1
6
- body: !!null
7
- headers: !!null
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- access-control-allow-credentials:
14
- - 'false'
15
- access-control-allow-methods:
16
- - POST, GET, OPTIONS
17
- access-control-allow-origin:
18
- - ! '*'
19
- access-control-max-age:
20
- - '1728000'
21
- cache-control:
22
- - no-cache="set-cookie"
23
- content-type:
24
- - text/plain; charset=utf-8
25
- date:
26
- - Sun, 11 Dec 2011 07:06:46 GMT
27
- server:
28
- - Apache/2.2.17
29
- set-cookie:
30
- - AWSELB=F7715B6B10BD5947A6E9DAE19D6F6DD7D91A271FB7C136A73584C8A9C7D99844891B9CE4098DC7B1C7896C3495C0321477EE3FFB6D062BCC604E27B432E4350AD26F2A097D;PATH=/;MAX-AGE=600
31
- content-length:
32
- - '665'
33
- connection:
34
- - Close
35
- body: ! '{"ok":1,"tsid":"LM416LNIKVLM1","name":"Baby Steppes","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"},"active_project":false,"features":["<b>13
36
- Piggies<\/b>, <b>6 Butterflies<\/b>, <b>5 Chickens<\/b>, and <b>6 Spice Plants<\/b>."],"connections":{"LM4115NJ46G8M":{"name":"Groddle
37
- Ladder","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}},"LM410TMR0S2S1":{"name":"Ruta
38
- Asuncion","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}},"LM4109NI2R640":{"name":"Guillermo
39
- Gamera Way","hub":{"id":27,"name":"Ix"},"mote":{"id":9,"name":"Ur"}}},"image":{"url":"http:\/\/c2.glitch.bz\/streets\/2011-11-27\/LM416LNIKVLM1_main_1322382945.jpg","w":720,"h":120}}'
40
- http_version: '1.1'
@@ -1,39 +0,0 @@
1
- ---
2
- - !ruby/struct:VCR::HTTPInteraction
3
- request: !ruby/struct:VCR::Request
4
- method: :get
5
- uri: http://api.glitch.com:80/simple/calendar.getHolidays
6
- body: !!null
7
- headers: !!null
8
- response: !ruby/struct:VCR::Response
9
- status: !ruby/struct:VCR::ResponseStatus
10
- code: 200
11
- message: OK
12
- headers:
13
- access-control-allow-credentials:
14
- - 'false'
15
- access-control-allow-methods:
16
- - POST, GET, OPTIONS
17
- access-control-allow-origin:
18
- - ! '*'
19
- access-control-max-age:
20
- - '1728000'
21
- cache-control:
22
- - no-cache="set-cookie"
23
- content-type:
24
- - text/plain; charset=utf-8
25
- date:
26
- - Thu, 01 Dec 2011 01:34:57 GMT
27
- server:
28
- - Apache/2.2.17
29
- set-cookie:
30
- - AWSELB=F7715B6B10BD5947A6E9DAE19D6F6DD7D91A271FB7C136A73584C8A9C7D99844891B9CE40943A67B18C55CD05576680FE8CB8ED1442E532BB1DB467DE7995571EE672126B5;PATH=/;MAX-AGE=600
31
- content-length:
32
- - '438'
33
- connection:
34
- - Close
35
- body: ! '{"ok":1,"days":[{"month":1,"day":5,"name":"AlphCon"},{"month":2,"day":2,"name":"Lemadan"},{"month":3,"day":3,"name":"Pot
36
- Twoday"},{"month":4,"day":2,"name":"Root"},{"month":4,"day":3,"name":"Root"},{"month":4,"day":4,"name":"Root"},{"month":4,"day":11,"name":"Sprinkling"},{"month":6,"day":17,"name":"Croppaday"},{"month":7,"day":1,"name":"Belabor
37
- Day"},{"month":8,"day":37,"name":"Zilloween"},{"month":11,"day":11,"name":"Recurse
38
- Eve"}]}'
39
- http_version: '1.1'