rainforest 1.0.7 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (85) hide show
  1. checksums.yaml +4 -4
  2. data/.gitignore +3 -6
  3. data/.travis.yml +13 -1
  4. data/Gemfile +6 -0
  5. data/README.md +72 -21
  6. data/Rakefile +6 -13
  7. data/VERSION +1 -1
  8. data/bin/rainforest-console +1 -1
  9. data/gemfiles/default-with-activesupport.gemfile +8 -1
  10. data/gemfiles/json.gemfile +10 -2
  11. data/gemfiles/yajl.gemfile +10 -2
  12. data/lib/rainforest.rb +61 -240
  13. data/lib/rainforest/apibits/api_client.rb +28 -0
  14. data/lib/rainforest/apibits/api_endpoint.rb +11 -0
  15. data/lib/rainforest/apibits/api_list.rb +88 -0
  16. data/lib/rainforest/apibits/api_method.rb +95 -0
  17. data/lib/rainforest/apibits/api_object.rb +52 -0
  18. data/lib/rainforest/apibits/api_resource.rb +153 -0
  19. data/lib/rainforest/apibits/headers_builder.rb +47 -0
  20. data/lib/rainforest/apibits/params_builder.rb +27 -0
  21. data/lib/rainforest/apibits/path_builder.rb +38 -0
  22. data/lib/rainforest/apibits/requester.rb +104 -0
  23. data/lib/rainforest/apibits/util.rb +51 -0
  24. data/lib/rainforest/clients/default_client.rb +59 -0
  25. data/lib/rainforest/endpoints/client_stats_endpoint.rb +11 -0
  26. data/lib/rainforest/endpoints/environment_runs_endpoint.rb +11 -0
  27. data/lib/rainforest/endpoints/environments_endpoint.rb +48 -0
  28. data/lib/rainforest/endpoints/generator_rows_endpoint.rb +17 -0
  29. data/lib/rainforest/endpoints/generators_endpoint.rb +48 -0
  30. data/lib/rainforest/endpoints/integrations_endpoint.rb +33 -0
  31. data/lib/rainforest/endpoints/run_tests_endpoint.rb +20 -0
  32. data/lib/rainforest/endpoints/runs_endpoint.rb +48 -0
  33. data/lib/rainforest/endpoints/schedules_endpoint.rb +48 -0
  34. data/lib/rainforest/endpoints/site_environments_endpoint.rb +24 -0
  35. data/lib/rainforest/endpoints/sites_endpoint.rb +39 -0
  36. data/lib/rainforest/endpoints/tests_endpoint.rb +57 -0
  37. data/lib/rainforest/endpoints/users_endpoint.rb +48 -0
  38. data/lib/rainforest/errors/api_connection_error.rb +1 -1
  39. data/lib/rainforest/errors/api_error.rb +32 -1
  40. data/lib/rainforest/errors/authentication_error.rb +1 -1
  41. data/lib/rainforest/errors/rainforest_error.rb +2 -9
  42. data/lib/rainforest/resources/client_stats.rb +31 -0
  43. data/lib/rainforest/resources/environment.rb +73 -0
  44. data/lib/rainforest/resources/generator.rb +73 -0
  45. data/lib/rainforest/resources/integration.rb +52 -0
  46. data/lib/rainforest/resources/run.rb +93 -0
  47. data/lib/rainforest/resources/schedule.rb +63 -0
  48. data/lib/rainforest/resources/site.rb +53 -0
  49. data/lib/rainforest/resources/site_environment.rb +40 -0
  50. data/lib/rainforest/resources/test.rb +98 -0
  51. data/lib/rainforest/resources/user.rb +75 -0
  52. data/rainforest.gemspec +8 -6
  53. data/test/rainforest/api_client_test.rb +51 -0
  54. data/test/rainforest/api_endpoint_test.rb +13 -0
  55. data/test/rainforest/api_list_test.rb +49 -0
  56. data/test/rainforest/api_method_test.rb +78 -0
  57. data/test/rainforest/headers_builder_test.rb +28 -0
  58. data/test/rainforest/params_builder_test.rb +57 -0
  59. data/test/rainforest/path_builder_test.rb +50 -0
  60. data/test/rainforest/requester_test.rb +86 -0
  61. data/test/rainforest/util_test.rb +41 -19
  62. data/test/test_data.rb +72 -0
  63. data/test/test_helper.rb +17 -134
  64. metadata +99 -59
  65. data/CONTRIBUTORS +0 -2
  66. data/History.txt +0 -4
  67. data/LICENSE +0 -21
  68. data/lib/data/ca-certificates.crt +0 -3918
  69. data/lib/rainforest/api_operations/create.rb +0 -16
  70. data/lib/rainforest/api_operations/delete.rb +0 -11
  71. data/lib/rainforest/api_operations/list.rb +0 -16
  72. data/lib/rainforest/api_operations/update.rb +0 -61
  73. data/lib/rainforest/api_resource.rb +0 -33
  74. data/lib/rainforest/errors/invalid_request_error.rb +0 -10
  75. data/lib/rainforest/json.rb +0 -21
  76. data/lib/rainforest/list_object.rb +0 -35
  77. data/lib/rainforest/rainforest_object.rb +0 -165
  78. data/lib/rainforest/run.rb +0 -8
  79. data/lib/rainforest/singleton_api_resource.rb +0 -20
  80. data/lib/rainforest/util.rb +0 -100
  81. data/test/rainforest/api_resource_test.rb +0 -11
  82. data/test/rainforest/auth_test.rb +0 -24
  83. data/test/rainforest/list_object_test.rb +0 -7
  84. data/test/rainforest/metadata_test.rb +0 -7
  85. data/test/rainforest/run_test.rb +0 -36
@@ -1,11 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path('../../test_helper', __FILE__)
3
-
4
- module Rainforest
5
- class ApiResourceTest < ::Test::Unit::TestCase
6
- should "creating a new APIResource should not fetch over the network" do
7
- @mock.expects(:get).never
8
- c = Rainforest::Run.new("someid")
9
- end
10
- end
11
- end
@@ -1,24 +0,0 @@
1
- # -*- coding: utf-8 -*-
2
- require File.expand_path('../../test_helper', __FILE__)
3
-
4
- module Rainforest
5
- class AuthTest < ::Test::Unit::TestCase
6
- context "With a valid api token, any request" do
7
- should "not raise an exception" do
8
- response = test_response({}, 200)
9
- @mock.expects(:get).once.returns(response)
10
- Rainforest::Run.retrieve("1")
11
- end
12
- end
13
-
14
- context "With an invalid api token, any request" do
15
- should "raise an exception" do
16
- response = test_response({error:"Authentication required"}, 401)
17
- assert_raises AuthenticationError do
18
- @mock.expects(:get).once.raises(RestClient::ExceptionWithResponse.new(response, 401))
19
- Rainforest::Run.retrieve("1")
20
- end
21
- end
22
- end
23
- end
24
- end
@@ -1,7 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module Rainforest
4
- class ListObjectTest < ::Test::Unit::TestCase
5
- should_eventually "implement some tests"
6
- end
7
- end
@@ -1,7 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module Rainforest
4
- class MetadataTest < ::Test::Unit::TestCase
5
- should_eventually "implement some tests"
6
- end
7
- end
@@ -1,36 +0,0 @@
1
- require File.expand_path('../../test_helper', __FILE__)
2
-
3
- module Rainforest
4
- class RunTest < ::Test::Unit::TestCase
5
- should "be listable" do
6
- @mock.expects(:get).once.returns(test_response(test_run_array))
7
- runs = Rainforest::Run.all
8
- assert runs.data.kind_of? Array
9
-
10
- runs.data.each do |run|
11
- assert run.kind_of?(Rainforest::Run)
12
- end
13
- end
14
-
15
- should "be retrievable individually" do
16
- @mock.expects(:get).once.returns(test_response(test_run))
17
- run = Rainforest::Run.retrieve("test_run")
18
- assert run.kind_of?(Rainforest::Run)
19
- end
20
-
21
- should "be abortable" do
22
- @mock.expects(:get).once.returns(test_response(test_run))
23
- @mock.expects(:delete).once.returns(test_response(test_run(state: "aborted")))
24
- run = Rainforest::Run.retrieve("test_run")
25
- run = run.delete
26
-
27
- assert_equal("aborted", run.state)
28
- end
29
-
30
- should "be createable" do
31
- @mock.expects(:post).once.returns(test_response(test_run))
32
- run = Rainforest::Run.create(tests: ["all"])
33
- assert run.kind_of?(Rainforest::Run)
34
- end
35
- end
36
- end