tatooine 1.0.0

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.
Files changed (68) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +22 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +22 -0
  5. data/README.md +52 -0
  6. data/Rakefile +8 -0
  7. data/lib/tatooine.rb +17 -0
  8. data/lib/tatooine/error.rb +25 -0
  9. data/lib/tatooine/film.rb +6 -0
  10. data/lib/tatooine/middleware/raise_http_error.rb +34 -0
  11. data/lib/tatooine/person.rb +6 -0
  12. data/lib/tatooine/planet.rb +6 -0
  13. data/lib/tatooine/resource.rb +125 -0
  14. data/lib/tatooine/species.rb +6 -0
  15. data/lib/tatooine/starship.rb +6 -0
  16. data/lib/tatooine/vehicle.rb +6 -0
  17. data/lib/tatooine/version.rb +3 -0
  18. data/spec/error_spec.rb +21 -0
  19. data/spec/film_spec.rb +107 -0
  20. data/spec/fixtures/film_schema.json +1 -0
  21. data/spec/fixtures/vcr_cassettes/film_1.yml +57 -0
  22. data/spec/fixtures/vcr_cassettes/film_1_and_schema.yml +57 -0
  23. data/spec/fixtures/vcr_cassettes/film_count.yml +101 -0
  24. data/spec/fixtures/vcr_cassettes/film_list.yml +441 -0
  25. data/spec/fixtures/vcr_cassettes/film_schema.yml +101 -0
  26. data/spec/fixtures/vcr_cassettes/person_1.yml +49 -0
  27. data/spec/fixtures/vcr_cassettes/person_1_and_schema.yml +49 -0
  28. data/spec/fixtures/vcr_cassettes/person_count.yml +58 -0
  29. data/spec/fixtures/vcr_cassettes/person_list.yml +58 -0
  30. data/spec/fixtures/vcr_cassettes/person_next.yml +56 -0
  31. data/spec/fixtures/vcr_cassettes/person_previous.yml +58 -0
  32. data/spec/fixtures/vcr_cassettes/person_schema.yml +58 -0
  33. data/spec/fixtures/vcr_cassettes/planet_1.yml +50 -0
  34. data/spec/fixtures/vcr_cassettes/planet_1_and_schema.yml +50 -0
  35. data/spec/fixtures/vcr_cassettes/planet_count.yml +60 -0
  36. data/spec/fixtures/vcr_cassettes/planet_list.yml +60 -0
  37. data/spec/fixtures/vcr_cassettes/planet_next.yml +63 -0
  38. data/spec/fixtures/vcr_cassettes/planet_previous.yml +60 -0
  39. data/spec/fixtures/vcr_cassettes/planet_schema.yml +60 -0
  40. data/spec/fixtures/vcr_cassettes/species_1.yml +52 -0
  41. data/spec/fixtures/vcr_cassettes/species_1_and_schema.yml +52 -0
  42. data/spec/fixtures/vcr_cassettes/species_count.yml +63 -0
  43. data/spec/fixtures/vcr_cassettes/species_list.yml +63 -0
  44. data/spec/fixtures/vcr_cassettes/species_next.yml +59 -0
  45. data/spec/fixtures/vcr_cassettes/species_previous.yml +63 -0
  46. data/spec/fixtures/vcr_cassettes/species_schema.yml +63 -0
  47. data/spec/fixtures/vcr_cassettes/starship_10.yml +51 -0
  48. data/spec/fixtures/vcr_cassettes/starship_2_and_schema.yml +51 -0
  49. data/spec/fixtures/vcr_cassettes/starship_count.yml +78 -0
  50. data/spec/fixtures/vcr_cassettes/starship_list.yml +78 -0
  51. data/spec/fixtures/vcr_cassettes/starship_next.yml +76 -0
  52. data/spec/fixtures/vcr_cassettes/starship_previous.yml +78 -0
  53. data/spec/fixtures/vcr_cassettes/starship_schema.yml +78 -0
  54. data/spec/fixtures/vcr_cassettes/vehicle_14.yml +50 -0
  55. data/spec/fixtures/vcr_cassettes/vehicle_14_and_schema.yml +50 -0
  56. data/spec/fixtures/vcr_cassettes/vehicle_count.yml +70 -0
  57. data/spec/fixtures/vcr_cassettes/vehicle_list.yml +70 -0
  58. data/spec/fixtures/vcr_cassettes/vehicle_next.yml +68 -0
  59. data/spec/fixtures/vcr_cassettes/vehicle_previous.yml +70 -0
  60. data/spec/fixtures/vcr_cassettes/vehicle_schema.yml +70 -0
  61. data/spec/person_spec.rb +120 -0
  62. data/spec/planet_spec.rb +106 -0
  63. data/spec/spec_helper.rb +21 -0
  64. data/spec/species_spec.rb +111 -0
  65. data/spec/starship_spec.rb +106 -0
  66. data/spec/vehicle_spec.rb +106 -0
  67. data/tatooine.gemspec +30 -0
  68. metadata +272 -0
@@ -0,0 +1,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://swapi.co/api/vehicles/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Tatooine Ruby Gem - 0.0.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 17 Feb 2015 00:59:41 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=d7c00d4a0d23d0ec99130136d04c1a1f61424134779; expires=Wed, 17-Feb-16
31
+ 00:59:39 GMT; path=/; domain=.swapi.co; HttpOnly
32
+ Allow:
33
+ - GET, HEAD, OPTIONS
34
+ X-Frame-Options:
35
+ - SAMEORIGIN
36
+ Vary:
37
+ - Accept, Cookie
38
+ Via:
39
+ - 1.1 vegur
40
+ Server:
41
+ - cloudflare-nginx
42
+ Cf-Ray:
43
+ - 1b9e0b213fe30b7b-LHR
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"count":39,"next":"http://swapi.co/api/vehicles/?page=2","previous":null,"results":[{"name":"Sand
47
+ Crawler","model":"Digger Crawler","manufacturer":"Corellia Mining Corporation","cost_in_credits":"150000","length":"36.8","max_atmosphering_speed":"30","crew":"46","passengers":"30","cargo_capacity":"50000","consumables":"2
48
+ months","vehicle_class":"wheeled","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/5/"],"created":"2014-12-10T15:36:25.724000Z","edited":"2014-12-22T18:21:15.523587Z","url":"http://swapi.co/api/vehicles/4/"},{"name":"T-16
49
+ skyhopper","model":"T-16 skyhopper","manufacturer":"Incom Corporation","cost_in_credits":"14500","length":"10.4","max_atmosphering_speed":"1200","crew":"1","passengers":"1","cargo_capacity":"50","consumables":"0","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:01:52.434000Z","edited":"2014-12-22T18:21:15.552614Z","url":"http://swapi.co/api/vehicles/6/"},{"name":"X-34
50
+ landspeeder","model":"X-34 landspeeder","manufacturer":"SoroSuub Corporation","cost_in_credits":"10550","length":"3.4","max_atmosphering_speed":"250","crew":"1","passengers":"1","cargo_capacity":"5","consumables":"unknown","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:13:52.586000Z","edited":"2014-12-22T18:21:15.583700Z","url":"http://swapi.co/api/vehicles/7/"},{"name":"TIE/LN
51
+ starfighter","model":"Twin Ion Engine/Ln Starfighter","manufacturer":"Sienar
52
+ Fleet Systems","cost_in_credits":"unknown","length":"6.4","max_atmosphering_speed":"1200","crew":"1","passengers":"0","cargo_capacity":"65","consumables":"2
53
+ days","vehicle_class":"starfighter","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-10T16:33:52.860000Z","edited":"2014-12-22T18:21:15.606149Z","url":"http://swapi.co/api/vehicles/8/"},{"name":"Snowspeeder","model":"t-47
54
+ airspeeder","manufacturer":"Incom corporation","cost_in_credits":"unknown","length":"4.5","max_atmosphering_speed":"650","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"none","vehicle_class":"airspeeder","pilots":["http://swapi.co/api/people/1/","http://swapi.co/api/people/18/"],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:22:12Z","edited":"2014-12-22T18:21:15.623033Z","url":"http://swapi.co/api/vehicles/14/"},{"name":"TIE
55
+ bomber","model":"TIE/sa bomber","manufacturer":"Sienar Fleet Systems","cost_in_credits":"unknown","length":"7.8","max_atmosphering_speed":"850","crew":"1","passengers":"0","cargo_capacity":"none","consumables":"2
56
+ days","vehicle_class":"space/planetary bomber","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:33:15.838000Z","edited":"2014-12-22T18:21:15.667730Z","url":"http://swapi.co/api/vehicles/16/"},{"name":"AT-AT","model":"All
57
+ Terrain Armored Transport","manufacturer":"Kuat Drive Yards, Imperial Department
58
+ of Military Research","cost_in_credits":"unknown","length":"20","max_atmosphering_speed":"60","crew":"5","passengers":"40","cargo_capacity":"1000","consumables":"unknown","vehicle_class":"assault
59
+ walker","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:38:25.937000Z","edited":"2014-12-22T18:21:15.714673Z","url":"http://swapi.co/api/vehicles/18/"},{"name":"AT-ST","model":"All
60
+ Terrain Scout Transport","manufacturer":"Kuat Drive Yards, Imperial Department
61
+ of Military Research","cost_in_credits":"unknown","length":"2","max_atmosphering_speed":"90","crew":"2","passengers":"0","cargo_capacity":"200","consumables":"none","vehicle_class":"walker","pilots":["http://swapi.co/api/people/13/"],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:46:42.384000Z","edited":"2014-12-22T18:21:15.761584Z","url":"http://swapi.co/api/vehicles/19/"},{"name":"Storm
62
+ IV Twin-Pod cloud car","model":"Storm IV Twin-Pod","manufacturer":"Bespin
63
+ Motors","cost_in_credits":"75000","length":"7","max_atmosphering_speed":"1500","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"1
64
+ day","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:58:50.530000Z","edited":"2014-12-22T18:21:15.783232Z","url":"http://swapi.co/api/vehicles/20/"},{"name":"Sail
65
+ barge","model":"Modified Luxury Sail Barge","manufacturer":"Ubrikkian Industries
66
+ Custom Vehicle Division","cost_in_credits":"285000","length":"30","max_atmosphering_speed":"100","crew":"26","passengers":"500","cargo_capacity":"2000000","consumables":"Live
67
+ food tanks","vehicle_class":"sail barge","pilots":[],"films":["http://swapi.co/api/films/3/"],"created":"2014-12-18T10:44:14.217000Z","edited":"2014-12-22T18:21:15.807906Z","url":"http://swapi.co/api/vehicles/24/"}]}'
68
+ http_version:
69
+ recorded_at: Tue, 17 Feb 2015 00:59:43 GMT
70
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://swapi.co/api/vehicles/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Tatooine Ruby Gem - 0.0.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 17 Feb 2015 00:59:43 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=dca06ee5a81190b442a49f53d075a4cb21424134781; expires=Wed, 17-Feb-16
31
+ 00:59:41 GMT; path=/; domain=.swapi.co; HttpOnly
32
+ Allow:
33
+ - GET, HEAD, OPTIONS
34
+ X-Frame-Options:
35
+ - SAMEORIGIN
36
+ Vary:
37
+ - Accept, Cookie
38
+ Via:
39
+ - 1.1 vegur
40
+ Server:
41
+ - cloudflare-nginx
42
+ Cf-Ray:
43
+ - 1b9e0b3365380cbf-LHR
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"count":39,"next":"http://swapi.co/api/vehicles/?page=2","previous":null,"results":[{"name":"Sand
47
+ Crawler","model":"Digger Crawler","manufacturer":"Corellia Mining Corporation","cost_in_credits":"150000","length":"36.8","max_atmosphering_speed":"30","crew":"46","passengers":"30","cargo_capacity":"50000","consumables":"2
48
+ months","vehicle_class":"wheeled","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/5/"],"created":"2014-12-10T15:36:25.724000Z","edited":"2014-12-22T18:21:15.523587Z","url":"http://swapi.co/api/vehicles/4/"},{"name":"T-16
49
+ skyhopper","model":"T-16 skyhopper","manufacturer":"Incom Corporation","cost_in_credits":"14500","length":"10.4","max_atmosphering_speed":"1200","crew":"1","passengers":"1","cargo_capacity":"50","consumables":"0","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:01:52.434000Z","edited":"2014-12-22T18:21:15.552614Z","url":"http://swapi.co/api/vehicles/6/"},{"name":"X-34
50
+ landspeeder","model":"X-34 landspeeder","manufacturer":"SoroSuub Corporation","cost_in_credits":"10550","length":"3.4","max_atmosphering_speed":"250","crew":"1","passengers":"1","cargo_capacity":"5","consumables":"unknown","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:13:52.586000Z","edited":"2014-12-22T18:21:15.583700Z","url":"http://swapi.co/api/vehicles/7/"},{"name":"TIE/LN
51
+ starfighter","model":"Twin Ion Engine/Ln Starfighter","manufacturer":"Sienar
52
+ Fleet Systems","cost_in_credits":"unknown","length":"6.4","max_atmosphering_speed":"1200","crew":"1","passengers":"0","cargo_capacity":"65","consumables":"2
53
+ days","vehicle_class":"starfighter","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-10T16:33:52.860000Z","edited":"2014-12-22T18:21:15.606149Z","url":"http://swapi.co/api/vehicles/8/"},{"name":"Snowspeeder","model":"t-47
54
+ airspeeder","manufacturer":"Incom corporation","cost_in_credits":"unknown","length":"4.5","max_atmosphering_speed":"650","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"none","vehicle_class":"airspeeder","pilots":["http://swapi.co/api/people/1/","http://swapi.co/api/people/18/"],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:22:12Z","edited":"2014-12-22T18:21:15.623033Z","url":"http://swapi.co/api/vehicles/14/"},{"name":"TIE
55
+ bomber","model":"TIE/sa bomber","manufacturer":"Sienar Fleet Systems","cost_in_credits":"unknown","length":"7.8","max_atmosphering_speed":"850","crew":"1","passengers":"0","cargo_capacity":"none","consumables":"2
56
+ days","vehicle_class":"space/planetary bomber","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:33:15.838000Z","edited":"2014-12-22T18:21:15.667730Z","url":"http://swapi.co/api/vehicles/16/"},{"name":"AT-AT","model":"All
57
+ Terrain Armored Transport","manufacturer":"Kuat Drive Yards, Imperial Department
58
+ of Military Research","cost_in_credits":"unknown","length":"20","max_atmosphering_speed":"60","crew":"5","passengers":"40","cargo_capacity":"1000","consumables":"unknown","vehicle_class":"assault
59
+ walker","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:38:25.937000Z","edited":"2014-12-22T18:21:15.714673Z","url":"http://swapi.co/api/vehicles/18/"},{"name":"AT-ST","model":"All
60
+ Terrain Scout Transport","manufacturer":"Kuat Drive Yards, Imperial Department
61
+ of Military Research","cost_in_credits":"unknown","length":"2","max_atmosphering_speed":"90","crew":"2","passengers":"0","cargo_capacity":"200","consumables":"none","vehicle_class":"walker","pilots":["http://swapi.co/api/people/13/"],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:46:42.384000Z","edited":"2014-12-22T18:21:15.761584Z","url":"http://swapi.co/api/vehicles/19/"},{"name":"Storm
62
+ IV Twin-Pod cloud car","model":"Storm IV Twin-Pod","manufacturer":"Bespin
63
+ Motors","cost_in_credits":"75000","length":"7","max_atmosphering_speed":"1500","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"1
64
+ day","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:58:50.530000Z","edited":"2014-12-22T18:21:15.783232Z","url":"http://swapi.co/api/vehicles/20/"},{"name":"Sail
65
+ barge","model":"Modified Luxury Sail Barge","manufacturer":"Ubrikkian Industries
66
+ Custom Vehicle Division","cost_in_credits":"285000","length":"30","max_atmosphering_speed":"100","crew":"26","passengers":"500","cargo_capacity":"2000000","consumables":"Live
67
+ food tanks","vehicle_class":"sail barge","pilots":[],"films":["http://swapi.co/api/films/3/"],"created":"2014-12-18T10:44:14.217000Z","edited":"2014-12-22T18:21:15.807906Z","url":"http://swapi.co/api/vehicles/24/"}]}'
68
+ http_version:
69
+ recorded_at: Tue, 17 Feb 2015 00:59:44 GMT
70
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,68 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://swapi.co/api/vehicles/?page=2
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Tatooine Ruby Gem - 0.0.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 17 Feb 2015 00:59:48 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=de0cd4bbcda173249d575110d194933b71424134783; expires=Wed, 17-Feb-16
31
+ 00:59:43 GMT; path=/; domain=.swapi.co; HttpOnly
32
+ Allow:
33
+ - GET, HEAD, OPTIONS
34
+ X-Frame-Options:
35
+ - SAMEORIGIN
36
+ Vary:
37
+ - Accept, Cookie
38
+ Via:
39
+ - 1.1 vegur
40
+ Server:
41
+ - cloudflare-nginx
42
+ Cf-Ray:
43
+ - 1b9e0b3fbeaf0cbf-LHR
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"count":39,"next":"http://swapi.co/api/vehicles/?page=3","previous":"http://swapi.co/api/vehicles/?page=1","results":[{"name":"Bantha-II
47
+ cargo skiff","model":"Bantha-II","manufacturer":"Ubrikkian Industries","cost_in_credits":"8000","length":"9.5","max_atmosphering_speed":"250","crew":"5","passengers":"16","cargo_capacity":"135000","consumables":"1
48
+ day","vehicle_class":"repulsorcraft cargo skiff","pilots":[],"films":["http://swapi.co/api/films/3/"],"created":"2014-12-18T10:48:03.208000Z","edited":"2014-12-22T18:21:15.845988Z","url":"http://swapi.co/api/vehicles/25/"},{"name":"TIE/IN
49
+ interceptor","model":"Twin Ion Engine Interceptor","manufacturer":"Sienar
50
+ Fleet Systems","cost_in_credits":"unknown","length":"9.6","max_atmosphering_speed":"1250","crew":"1","passengers":"0","cargo_capacity":"75","consumables":"2
51
+ days","vehicle_class":"starfighter","pilots":[],"films":["http://swapi.co/api/films/3/"],"created":"2014-12-18T10:50:28.225000Z","edited":"2014-12-22T18:21:15.882388Z","url":"http://swapi.co/api/vehicles/26/"},{"name":"Imperial
52
+ Speeder Bike","model":"74-Z speeder bike","manufacturer":"Aratech Repulsor
53
+ Company","cost_in_credits":"8000","length":"3","max_atmosphering_speed":"360","crew":"1","passengers":"1","cargo_capacity":"4","consumables":"1
54
+ day","vehicle_class":"speeder","pilots":["http://swapi.co/api/people/1/","http://swapi.co/api/people/5/"],"films":["http://swapi.co/api/films/3/"],"created":"2014-12-18T11:20:04.625000Z","edited":"2014-12-22T18:21:15.920537Z","url":"http://swapi.co/api/vehicles/30/"},{"name":"Vulture
55
+ Droid","model":"Vulture-class droid starfighter","manufacturer":"Haor Chall
56
+ Engineering, Baktoid Armor Workshop","cost_in_credits":"unknown","length":"3.5","max_atmosphering_speed":"1200","crew":"0","passengers":"0","cargo_capacity":"0","consumables":"none","vehicle_class":"starfighter","pilots":[],"films":["http://swapi.co/api/films/4/","http://swapi.co/api/films/6/"],"created":"2014-12-19T17:09:53.584000Z","edited":"2014-12-22T18:21:15.953870Z","url":"http://swapi.co/api/vehicles/33/"},{"name":"Multi-Troop
57
+ Transport","model":"Multi-Troop Transport","manufacturer":"Baktoid Armor Workshop","cost_in_credits":"138000","length":"31","max_atmosphering_speed":"35","crew":"4","passengers":"112","cargo_capacity":"12000","consumables":"unknown","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/4/"],"created":"2014-12-19T17:12:04.400000Z","edited":"2014-12-22T18:21:15.975171Z","url":"http://swapi.co/api/vehicles/34/"},{"name":"Armored
58
+ Assault Tank","model":"Armoured Assault Tank","manufacturer":"Baktoid Armor
59
+ Workshop","cost_in_credits":"unknown","length":"9.75","max_atmosphering_speed":"55","crew":"4","passengers":"6","cargo_capacity":"unknown","consumables":"unknown","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/4/"],"created":"2014-12-19T17:13:29.799000Z","edited":"2014-12-22T18:21:15.984817Z","url":"http://swapi.co/api/vehicles/35/"},{"name":"Single
60
+ Trooper Aerial Platform","model":"Single Trooper Aerial Platform","manufacturer":"Baktoid
61
+ Armor Workshop","cost_in_credits":"2500","length":"2","max_atmosphering_speed":"400","crew":"1","passengers":"0","cargo_capacity":"none","consumables":"none","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/4/"],"created":"2014-12-19T17:15:09.511000Z","edited":"2014-12-22T18:21:16.008594Z","url":"http://swapi.co/api/vehicles/36/"},{"name":"C-9979
62
+ landing craft","model":"C-9979 landing craft","manufacturer":"Haor Chall Engineering","cost_in_credits":"200000","length":"210","max_atmosphering_speed":"587","crew":"140","passengers":"284","cargo_capacity":"1800000","consumables":"1
63
+ day","vehicle_class":"landing craft","pilots":[],"films":["http://swapi.co/api/films/4/"],"created":"2014-12-19T17:20:36.373000Z","edited":"2014-12-22T18:21:16.033738Z","url":"http://swapi.co/api/vehicles/37/"},{"name":"Tribubble
64
+ bongo","model":"Tribubble bongo","manufacturer":"Otoh Gunga Bongameken Cooperative","cost_in_credits":"unknown","length":"15","max_atmosphering_speed":"85","crew":"1","passengers":"2","cargo_capacity":"1600","consumables":"unknown","vehicle_class":"submarine","pilots":["http://swapi.co/api/people/10/","http://swapi.co/api/people/32/"],"films":["http://swapi.co/api/films/4/"],"created":"2014-12-19T17:37:37.924000Z","edited":"2014-12-22T18:21:16.072083Z","url":"http://swapi.co/api/vehicles/38/"},{"name":"Sith
65
+ speeder","model":"FC-20 speeder bike","manufacturer":"Razalon","cost_in_credits":"4000","length":"1.5","max_atmosphering_speed":"180","crew":"1","passengers":"0","cargo_capacity":"2","consumables":"unknown","vehicle_class":"speeder","pilots":["http://swapi.co/api/people/44/"],"films":["http://swapi.co/api/films/4/"],"created":"2014-12-20T10:09:56.095000Z","edited":"2014-12-22T18:21:16.095041Z","url":"http://swapi.co/api/vehicles/42/"}]}'
66
+ http_version:
67
+ recorded_at: Tue, 17 Feb 2015 00:59:49 GMT
68
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://swapi.co/api/vehicles/?page=1
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Tatooine Ruby Gem - 0.0.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 17 Feb 2015 00:59:50 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=dbab846b6450a9deb0cd8815efbf6942f1424134788; expires=Wed, 17-Feb-16
31
+ 00:59:48 GMT; path=/; domain=.swapi.co; HttpOnly
32
+ Allow:
33
+ - GET, HEAD, OPTIONS
34
+ X-Frame-Options:
35
+ - SAMEORIGIN
36
+ Vary:
37
+ - Accept, Cookie
38
+ Via:
39
+ - 1.1 vegur
40
+ Server:
41
+ - cloudflare-nginx
42
+ Cf-Ray:
43
+ - 1b9e0b5e17da0a66-LHR
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"count":39,"next":"http://swapi.co/api/vehicles/?page=2","previous":null,"results":[{"name":"Sand
47
+ Crawler","model":"Digger Crawler","manufacturer":"Corellia Mining Corporation","cost_in_credits":"150000","length":"36.8","max_atmosphering_speed":"30","crew":"46","passengers":"30","cargo_capacity":"50000","consumables":"2
48
+ months","vehicle_class":"wheeled","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/5/"],"created":"2014-12-10T15:36:25.724000Z","edited":"2014-12-22T18:21:15.523587Z","url":"http://swapi.co/api/vehicles/4/"},{"name":"T-16
49
+ skyhopper","model":"T-16 skyhopper","manufacturer":"Incom Corporation","cost_in_credits":"14500","length":"10.4","max_atmosphering_speed":"1200","crew":"1","passengers":"1","cargo_capacity":"50","consumables":"0","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:01:52.434000Z","edited":"2014-12-22T18:21:15.552614Z","url":"http://swapi.co/api/vehicles/6/"},{"name":"X-34
50
+ landspeeder","model":"X-34 landspeeder","manufacturer":"SoroSuub Corporation","cost_in_credits":"10550","length":"3.4","max_atmosphering_speed":"250","crew":"1","passengers":"1","cargo_capacity":"5","consumables":"unknown","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:13:52.586000Z","edited":"2014-12-22T18:21:15.583700Z","url":"http://swapi.co/api/vehicles/7/"},{"name":"TIE/LN
51
+ starfighter","model":"Twin Ion Engine/Ln Starfighter","manufacturer":"Sienar
52
+ Fleet Systems","cost_in_credits":"unknown","length":"6.4","max_atmosphering_speed":"1200","crew":"1","passengers":"0","cargo_capacity":"65","consumables":"2
53
+ days","vehicle_class":"starfighter","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-10T16:33:52.860000Z","edited":"2014-12-22T18:21:15.606149Z","url":"http://swapi.co/api/vehicles/8/"},{"name":"Snowspeeder","model":"t-47
54
+ airspeeder","manufacturer":"Incom corporation","cost_in_credits":"unknown","length":"4.5","max_atmosphering_speed":"650","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"none","vehicle_class":"airspeeder","pilots":["http://swapi.co/api/people/1/","http://swapi.co/api/people/18/"],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:22:12Z","edited":"2014-12-22T18:21:15.623033Z","url":"http://swapi.co/api/vehicles/14/"},{"name":"TIE
55
+ bomber","model":"TIE/sa bomber","manufacturer":"Sienar Fleet Systems","cost_in_credits":"unknown","length":"7.8","max_atmosphering_speed":"850","crew":"1","passengers":"0","cargo_capacity":"none","consumables":"2
56
+ days","vehicle_class":"space/planetary bomber","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:33:15.838000Z","edited":"2014-12-22T18:21:15.667730Z","url":"http://swapi.co/api/vehicles/16/"},{"name":"AT-AT","model":"All
57
+ Terrain Armored Transport","manufacturer":"Kuat Drive Yards, Imperial Department
58
+ of Military Research","cost_in_credits":"unknown","length":"20","max_atmosphering_speed":"60","crew":"5","passengers":"40","cargo_capacity":"1000","consumables":"unknown","vehicle_class":"assault
59
+ walker","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:38:25.937000Z","edited":"2014-12-22T18:21:15.714673Z","url":"http://swapi.co/api/vehicles/18/"},{"name":"AT-ST","model":"All
60
+ Terrain Scout Transport","manufacturer":"Kuat Drive Yards, Imperial Department
61
+ of Military Research","cost_in_credits":"unknown","length":"2","max_atmosphering_speed":"90","crew":"2","passengers":"0","cargo_capacity":"200","consumables":"none","vehicle_class":"walker","pilots":["http://swapi.co/api/people/13/"],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:46:42.384000Z","edited":"2014-12-22T18:21:15.761584Z","url":"http://swapi.co/api/vehicles/19/"},{"name":"Storm
62
+ IV Twin-Pod cloud car","model":"Storm IV Twin-Pod","manufacturer":"Bespin
63
+ Motors","cost_in_credits":"75000","length":"7","max_atmosphering_speed":"1500","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"1
64
+ day","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:58:50.530000Z","edited":"2014-12-22T18:21:15.783232Z","url":"http://swapi.co/api/vehicles/20/"},{"name":"Sail
65
+ barge","model":"Modified Luxury Sail Barge","manufacturer":"Ubrikkian Industries
66
+ Custom Vehicle Division","cost_in_credits":"285000","length":"30","max_atmosphering_speed":"100","crew":"26","passengers":"500","cargo_capacity":"2000000","consumables":"Live
67
+ food tanks","vehicle_class":"sail barge","pilots":[],"films":["http://swapi.co/api/films/3/"],"created":"2014-12-18T10:44:14.217000Z","edited":"2014-12-22T18:21:15.807906Z","url":"http://swapi.co/api/vehicles/24/"}]}'
68
+ http_version:
69
+ recorded_at: Tue, 17 Feb 2015 00:59:51 GMT
70
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,70 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://swapi.co/api/vehicles/
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ User-Agent:
11
+ - Tatooine Ruby Gem - 0.0.1
12
+ Accept-Encoding:
13
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
14
+ Accept:
15
+ - "*/*"
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Tue, 17 Feb 2015 00:59:57 GMT
23
+ Content-Type:
24
+ - application/json
25
+ Transfer-Encoding:
26
+ - chunked
27
+ Connection:
28
+ - keep-alive
29
+ Set-Cookie:
30
+ - __cfduid=dd2a04c9919d4c9b905a721816844c5e61424134795; expires=Wed, 17-Feb-16
31
+ 00:59:55 GMT; path=/; domain=.swapi.co; HttpOnly
32
+ Allow:
33
+ - GET, HEAD, OPTIONS
34
+ X-Frame-Options:
35
+ - SAMEORIGIN
36
+ Vary:
37
+ - Accept, Cookie
38
+ Via:
39
+ - 1.1 vegur
40
+ Server:
41
+ - cloudflare-nginx
42
+ Cf-Ray:
43
+ - 1b9e0b8506ab02ff-LHR
44
+ body:
45
+ encoding: UTF-8
46
+ string: '{"count":39,"next":"http://swapi.co/api/vehicles/?page=2","previous":null,"results":[{"name":"Sand
47
+ Crawler","model":"Digger Crawler","manufacturer":"Corellia Mining Corporation","cost_in_credits":"150000","length":"36.8","max_atmosphering_speed":"30","crew":"46","passengers":"30","cargo_capacity":"50000","consumables":"2
48
+ months","vehicle_class":"wheeled","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/5/"],"created":"2014-12-10T15:36:25.724000Z","edited":"2014-12-22T18:21:15.523587Z","url":"http://swapi.co/api/vehicles/4/"},{"name":"T-16
49
+ skyhopper","model":"T-16 skyhopper","manufacturer":"Incom Corporation","cost_in_credits":"14500","length":"10.4","max_atmosphering_speed":"1200","crew":"1","passengers":"1","cargo_capacity":"50","consumables":"0","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:01:52.434000Z","edited":"2014-12-22T18:21:15.552614Z","url":"http://swapi.co/api/vehicles/6/"},{"name":"X-34
50
+ landspeeder","model":"X-34 landspeeder","manufacturer":"SoroSuub Corporation","cost_in_credits":"10550","length":"3.4","max_atmosphering_speed":"250","crew":"1","passengers":"1","cargo_capacity":"5","consumables":"unknown","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/1/"],"created":"2014-12-10T16:13:52.586000Z","edited":"2014-12-22T18:21:15.583700Z","url":"http://swapi.co/api/vehicles/7/"},{"name":"TIE/LN
51
+ starfighter","model":"Twin Ion Engine/Ln Starfighter","manufacturer":"Sienar
52
+ Fleet Systems","cost_in_credits":"unknown","length":"6.4","max_atmosphering_speed":"1200","crew":"1","passengers":"0","cargo_capacity":"65","consumables":"2
53
+ days","vehicle_class":"starfighter","pilots":[],"films":["http://swapi.co/api/films/1/","http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-10T16:33:52.860000Z","edited":"2014-12-22T18:21:15.606149Z","url":"http://swapi.co/api/vehicles/8/"},{"name":"Snowspeeder","model":"t-47
54
+ airspeeder","manufacturer":"Incom corporation","cost_in_credits":"unknown","length":"4.5","max_atmosphering_speed":"650","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"none","vehicle_class":"airspeeder","pilots":["http://swapi.co/api/people/1/","http://swapi.co/api/people/18/"],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:22:12Z","edited":"2014-12-22T18:21:15.623033Z","url":"http://swapi.co/api/vehicles/14/"},{"name":"TIE
55
+ bomber","model":"TIE/sa bomber","manufacturer":"Sienar Fleet Systems","cost_in_credits":"unknown","length":"7.8","max_atmosphering_speed":"850","crew":"1","passengers":"0","cargo_capacity":"none","consumables":"2
56
+ days","vehicle_class":"space/planetary bomber","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:33:15.838000Z","edited":"2014-12-22T18:21:15.667730Z","url":"http://swapi.co/api/vehicles/16/"},{"name":"AT-AT","model":"All
57
+ Terrain Armored Transport","manufacturer":"Kuat Drive Yards, Imperial Department
58
+ of Military Research","cost_in_credits":"unknown","length":"20","max_atmosphering_speed":"60","crew":"5","passengers":"40","cargo_capacity":"1000","consumables":"unknown","vehicle_class":"assault
59
+ walker","pilots":[],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:38:25.937000Z","edited":"2014-12-22T18:21:15.714673Z","url":"http://swapi.co/api/vehicles/18/"},{"name":"AT-ST","model":"All
60
+ Terrain Scout Transport","manufacturer":"Kuat Drive Yards, Imperial Department
61
+ of Military Research","cost_in_credits":"unknown","length":"2","max_atmosphering_speed":"90","crew":"2","passengers":"0","cargo_capacity":"200","consumables":"none","vehicle_class":"walker","pilots":["http://swapi.co/api/people/13/"],"films":["http://swapi.co/api/films/2/","http://swapi.co/api/films/3/"],"created":"2014-12-15T12:46:42.384000Z","edited":"2014-12-22T18:21:15.761584Z","url":"http://swapi.co/api/vehicles/19/"},{"name":"Storm
62
+ IV Twin-Pod cloud car","model":"Storm IV Twin-Pod","manufacturer":"Bespin
63
+ Motors","cost_in_credits":"75000","length":"7","max_atmosphering_speed":"1500","crew":"2","passengers":"0","cargo_capacity":"10","consumables":"1
64
+ day","vehicle_class":"repulsorcraft","pilots":[],"films":["http://swapi.co/api/films/2/"],"created":"2014-12-15T12:58:50.530000Z","edited":"2014-12-22T18:21:15.783232Z","url":"http://swapi.co/api/vehicles/20/"},{"name":"Sail
65
+ barge","model":"Modified Luxury Sail Barge","manufacturer":"Ubrikkian Industries
66
+ Custom Vehicle Division","cost_in_credits":"285000","length":"30","max_atmosphering_speed":"100","crew":"26","passengers":"500","cargo_capacity":"2000000","consumables":"Live
67
+ food tanks","vehicle_class":"sail barge","pilots":[],"films":["http://swapi.co/api/films/3/"],"created":"2014-12-18T10:44:14.217000Z","edited":"2014-12-22T18:21:15.807906Z","url":"http://swapi.co/api/vehicles/24/"}]}'
68
+ http_version:
69
+ recorded_at: Tue, 17 Feb 2015 00:59:58 GMT
70
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,120 @@
1
+ require "./spec/spec_helper"
2
+
3
+ describe Tatooine::Person do
4
+ describe "#schema" do
5
+ before(:all) do
6
+ VCR.use_cassette("person schema") do
7
+ @schema = Tatooine::Person.schema
8
+ end
9
+ end
10
+
11
+ it "should get the description of the class" do
12
+ expect(@schema).to be_instance_of(Hash)
13
+ expect(@schema["description"]).to eq("A person within the Star Wars universe")
14
+ end
15
+ end
16
+
17
+ describe "#count" do
18
+ before(:all) do
19
+ VCR.use_cassette("person count") do
20
+ @count = Tatooine::Person.count
21
+ end
22
+ end
23
+
24
+ it "should return the correct count" do
25
+ expect(@count).to be(82)
26
+ end
27
+ end
28
+
29
+ describe "#list" do
30
+ before(:all) do
31
+ VCR.use_cassette("person list") do
32
+ @people = Tatooine::Person.list
33
+ end
34
+ end
35
+
36
+ it "gets a list of people" do
37
+ expect(@people).to be_instance_of(Array)
38
+ expect(@people.length).to be(10)
39
+ expect(@people.first).to be_instance_of(Tatooine::Person)
40
+ end
41
+
42
+ it "gets the next page" do
43
+ VCR.use_cassette("person next") do
44
+ @next_people = Tatooine::Person.next
45
+ expect(@next_people).to be_instance_of(Array)
46
+ expect(@next_people.first).to be_instance_of(Tatooine::Person)
47
+ end
48
+ end
49
+
50
+ it "gets the previous page" do
51
+ VCR.use_cassette("person previous") do
52
+ @previous_people = Tatooine::Person.previous
53
+ expect(@previous_people.map(&:name)).to match_array(@people.map(&:name))
54
+ end
55
+ end
56
+ end
57
+
58
+ describe "#get" do
59
+ before(:all) do
60
+ VCR.use_cassette("person 1") do
61
+ @person = Tatooine::Person.get(1)
62
+ end
63
+ end
64
+
65
+ it "gets the url of the person" do
66
+ expect(@person.url).to eq("http://swapi.co/api/people/1/")
67
+ end
68
+
69
+ it "gets the attributes of the person" do
70
+ expect(@person.name).to eq("Luke Skywalker")
71
+ end
72
+
73
+ it "gets a planet homeworld" do
74
+ expect(@person.homeworld).to be_instance_of(Tatooine::Planet)
75
+ end
76
+
77
+ it "gets a list of films" do
78
+ expect(@person.films).to be_instance_of(Array)
79
+ expect(@person.films.first).to be_instance_of(Tatooine::Film)
80
+ end
81
+
82
+ it "gets a list of species" do
83
+ expect(@person.species).to be_instance_of(Array)
84
+ expect(@person.species.first).to be_instance_of(Tatooine::Species)
85
+ end
86
+
87
+ it "gets a list of starships" do
88
+ expect(@person.starships).to be_instance_of(Array)
89
+ expect(@person.starships.first).to be_instance_of(Tatooine::Starship)
90
+ end
91
+
92
+ it "gets a list of vehicles" do
93
+ expect(@person.vehicles).to be_instance_of(Array)
94
+ expect(@person.vehicles.first).to be_instance_of(Tatooine::Vehicle)
95
+ end
96
+ end
97
+
98
+ describe "#new" do
99
+ it "primes an object with a url" do
100
+ VCR.use_cassette("person schema") do
101
+ @person = Tatooine::Person.new(:url => "#{Tatooine::API_BASE}people/1/")
102
+ expect(@person).to respond_to(:name)
103
+ end
104
+ end
105
+
106
+ it "gets the object when methods are called" do
107
+ VCR.use_cassette("person 1 and schema") do
108
+ @person = Tatooine::Person.new("url" => "#{Tatooine::API_BASE}people/1/")
109
+ expect(@person.name).to eq("Luke Skywalker")
110
+ end
111
+ end
112
+
113
+ it "sets properties from an object" do
114
+ VCR.use_cassette("person schema") do
115
+ @person = Tatooine::Person.new("name" => "Anything, because I said so")
116
+ expect(@person.name).to eq("Anything, because I said so")
117
+ end
118
+ end
119
+ end
120
+ end