travis-client 0.1.0 → 3.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (62) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -2
  3. data/.rspec +3 -2
  4. data/.travis.yml +2 -9
  5. data/.yardopts +2 -0
  6. data/Gemfile +1 -3
  7. data/Gemfile.lock +59 -0
  8. data/lib/travis/client.rb +20 -104
  9. data/lib/travis/client/action.rb +128 -0
  10. data/lib/travis/client/collection.rb +66 -0
  11. data/lib/travis/client/connection.rb +104 -0
  12. data/lib/travis/client/context.rb +52 -0
  13. data/lib/travis/client/entity.rb +77 -0
  14. data/lib/travis/client/error.rb +47 -0
  15. data/lib/travis/client/generated.rb +2073 -0
  16. data/lib/travis/client/link.rb +34 -0
  17. data/lib/travis/client/session.rb +101 -0
  18. data/lib/travis/client/unknown.rb +5 -0
  19. data/lib/travis/client/version.rb +6 -0
  20. data/readme.md +187 -0
  21. data/script/generate +44 -0
  22. data/spec/http_responses/default/branches.http +715 -0
  23. data/spec/http_responses/default/find_owner.http +23 -0
  24. data/spec/http_responses/default/index.http +1518 -0
  25. data/spec/http_responses/default/repo.http +44 -0
  26. data/spec/http_responses/default/repo_branches_10.http +347 -0
  27. data/spec/http_responses/default/repo_branches_10_0.http +347 -0
  28. data/spec/http_responses/default/repo_branches_10_10.http +351 -0
  29. data/spec/http_responses/default/repo_branches_10_20.http +99 -0
  30. data/spec/http_responses/default/sync.http +12 -0
  31. data/spec/http_responses/default/user_repos.http +6315 -0
  32. data/spec/spec_helper.rb +4 -2
  33. data/spec/support/coverage.rb +8 -0
  34. data/spec/support/generate_http_response.rb +16 -0
  35. data/spec/support/http.rb +54 -0
  36. data/spec/travis/collection_spec.rb +19 -0
  37. data/spec/travis/connection_spec.rb +26 -0
  38. data/spec/travis/entity_spec.rb +27 -0
  39. data/spec/travis_spec.rb +18 -0
  40. data/travis-client.gemspec +21 -21
  41. metadata +103 -75
  42. data/README.textile +0 -111
  43. data/Rakefile +0 -8
  44. data/bin/travis +0 -21
  45. data/features/repositories.feature +0 -117
  46. data/features/step_definitions/repositories_steps.rb +0 -51
  47. data/features/support/env.rb +0 -2
  48. data/lib/travis.rb +0 -2
  49. data/lib/travis/api.rb +0 -3
  50. data/lib/travis/api/client.rb +0 -95
  51. data/lib/travis/api/client/repositories.rb +0 -234
  52. data/lib/travis/api/entity.rb +0 -44
  53. data/lib/travis/api/entity/build.rb +0 -129
  54. data/lib/travis/api/entity/repository.rb +0 -79
  55. data/lib/travis/client/repositories.rb +0 -345
  56. data/spec/travis/api/client/repositories_spec.rb +0 -2
  57. data/spec/travis/api/client_spec.rb +0 -15
  58. data/spec/travis/api/entity/build_spec.rb +0 -84
  59. data/spec/travis/api/entity/repository_spec.rb +0 -79
  60. data/spec/travis/api/entity_spec.rb +0 -46
  61. data/spec/travis/api/shared_client_examples.rb +0 -3
  62. data/spec/travis/api/shared_entity_examples.rb +0 -16
@@ -1,2 +0,0 @@
1
- require './spec/spec_helper'
2
- require './spec/travis/api/shared_client_examples'
@@ -1,15 +0,0 @@
1
- require './spec/spec_helper'
2
- require './spec/travis/api/shared_client_examples'
3
-
4
- module Travis
5
-
6
- module API
7
-
8
- describe Client do
9
-
10
- end
11
-
12
- end
13
-
14
- end
15
-
@@ -1,84 +0,0 @@
1
- require './spec/spec_helper'
2
- require './spec/travis/api/shared_entity_examples'
3
-
4
- module Travis
5
-
6
- module API
7
-
8
- class Entity
9
-
10
- describe Build do
11
-
12
- describe 'when initialized without attributes, owner or name' do
13
-
14
- before(:each) do
15
- @attributes = {}
16
- @entity = Build.new
17
- end
18
-
19
- it_should_behave_like 'An Entity'
20
-
21
- it 'should be successfully initialized' do
22
- @entity.should be_instance_of Build
23
- end
24
-
25
- end
26
-
27
- describe 'when initialized with valid attributes' do
28
-
29
- before(:each) do
30
- @attributes = {
31
- 'number' => 100,
32
- 'committed_at' => '2011-08-08T21:40:05Z',
33
- 'commit' => 'df44d6862626d383ce755d02cd3de234bee72df9',
34
- 'finished_at' => '2011-08-08T21:48:00Z',
35
- 'config' => %{{"bundler_args":"--without development","script":"bundle exec rake","rvm":"ruby-head","notifications":{"irc":"irc.freenode.org#john"},".configured":"true"}},
36
- 'author_name' => 'John Doe',
37
- 'log' => %{Just the good ol' boys, never meanin' no harm. Beats all you've ever saw, been in trouble with the law since the day they was born. Straight'nin' the curve, flat'nin' the hills. Someday the mountain might get 'em, but the law never will. Makin' their way, the only way they know how, that's just a little bit more than the law will allow. Just good ol' boys, wouldn't change if they could, fightin' the system like a true modern day Robin Hood.},
38
- 'branch' => 'master',
39
- 'id' => 1,
40
- 'parent_id' => 3,
41
- 'started_at' => '2011-08-08T20:48:00Z',
42
- 'author_email' => 'john@doe.com',
43
- 'status' => 1,
44
- 'repository_id' => 1,
45
- 'message' => 'Changing this and that',
46
- 'compare_url' => 'https://github.com/johndoe/travis-ci/compare/132df3e...hf44365',
47
- }
48
-
49
-
50
- end
51
-
52
- describe 'whithout repository owner/name' do
53
-
54
- before(:each) do
55
- @entity = Build.new(@attributes)
56
- end
57
-
58
- it_should_behave_like 'An Entity'
59
-
60
- end
61
-
62
- describe 'with repository owner/name' do
63
-
64
- before(:each) do
65
- @repository_owner = 'johndoe'
66
- @repository_name = 'travis-ci'
67
-
68
- @entity = Build.new(@attributes, @repository_owner, @repository_name)
69
- end
70
-
71
- it_should_behave_like 'An Entity'
72
-
73
- end
74
-
75
- end
76
-
77
- end
78
-
79
- end
80
-
81
- end
82
-
83
- end
84
-
@@ -1,79 +0,0 @@
1
- require './spec/spec_helper'
2
- require './spec/travis/api/shared_entity_examples'
3
-
4
- module Travis
5
-
6
- module API
7
-
8
- class Entity
9
-
10
- describe Repository do
11
-
12
- describe 'when initialized without attributes, owner or name' do
13
-
14
- before(:each) do
15
- @attributes = {}
16
- @entity = Repository.new
17
- end
18
-
19
- it_should_behave_like 'An Entity'
20
-
21
- it 'should be successfully initialized' do
22
- @entity.should be_instance_of Repository
23
- end
24
-
25
- end
26
-
27
- describe 'when initialized with valid attributes' do
28
-
29
- before(:each) do
30
- @attributes = {
31
- "id" => 10,
32
- "last_build_id" => 100,
33
- "last_build_number" => "255",
34
- "last_build_status" => 1,
35
- "last_build_start_at" => "2011-08-08T21:45:13Z",
36
- "last_build_finished_at" => "2011-08-08T21:48:00Z",
37
- "slug" => "johndoe/travis-ci",
38
- "status" => "unstable"
39
- }
40
- end
41
-
42
- describe 'whithout owner/name' do
43
-
44
- before(:each) do
45
- @entity = Repository.new(@attributes)
46
- end
47
-
48
- it_should_behave_like 'An Entity'
49
-
50
- it 'should recognize the name and the owner from the slug' do
51
- @entity.owner.should == 'johndoe'
52
- @entity.name.should == 'travis-ci'
53
- end
54
-
55
- end
56
-
57
- describe 'with owner/name' do
58
-
59
- before(:each) do
60
- @repository_owner = 'johndoe'
61
- @repository_name = 'travis-ci'
62
-
63
- @entity = Repository.new(@attributes, @repository_owner, @repository_name)
64
- end
65
-
66
- it_should_behave_like 'An Entity'
67
-
68
- end
69
-
70
- end
71
-
72
- end
73
-
74
- end
75
-
76
- end
77
-
78
- end
79
-
@@ -1,46 +0,0 @@
1
- require './spec/spec_helper'
2
- require './spec/travis/api/shared_entity_examples'
3
-
4
- module Travis
5
-
6
- module API
7
-
8
- describe Entity do
9
-
10
- describe 'when initialized without attributes' do
11
-
12
- before(:each) do
13
- @attributes = {}
14
- @entity = Entity.new
15
- end
16
-
17
- it_should_behave_like 'An Entity'
18
-
19
- it 'should be successfully initialized' do
20
- @entity.should be_instance_of Entity
21
- end
22
-
23
- end
24
-
25
- describe 'when initialized with valid attributes' do
26
-
27
- before(:each) do
28
- @attributes = {
29
- 'number' => 1,
30
- 'string' => "string",
31
- 'array' => [1,2,3]
32
- }
33
-
34
- @entity = Entity.new(@attributes)
35
- end
36
-
37
- it_should_behave_like 'An Entity'
38
-
39
- end
40
-
41
- end
42
-
43
- end
44
-
45
- end
46
-
@@ -1,3 +0,0 @@
1
- shared_examples_for "A Client" do
2
- end
3
-
@@ -1,16 +0,0 @@
1
- shared_examples_for "An Entity" do
2
-
3
- it 'should respond to any of the attribute names' do
4
- @attributes.each_key do |method|
5
- @entity.should respond_to method
6
- end
7
- end
8
-
9
- it 'should return any of the attributes' do
10
- @attributes.each_key do |method|
11
- @entity.send(method).should equal @attributes[method]
12
- end
13
- end
14
-
15
- end
16
-