go_api_client 0.5.4 → 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 (84) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +4 -0
  3. data/.travis.yml +26 -0
  4. data/README.md +86 -0
  5. data/go_api_client.gemspec +11 -11
  6. data/lib/go_api_client/api/abstract_api.rb +12 -0
  7. data/lib/go_api_client/api/cctray.rb +53 -0
  8. data/lib/go_api_client/api/config.rb +60 -0
  9. data/lib/go_api_client/api/feed.rb +39 -0
  10. data/lib/go_api_client/api/job.rb +34 -0
  11. data/lib/go_api_client/api/pipeline.rb +87 -0
  12. data/lib/go_api_client/api/properties.rb +43 -0
  13. data/lib/go_api_client/api/stage.rb +45 -0
  14. data/lib/go_api_client/attribute_helper.rb +9 -0
  15. data/lib/go_api_client/client.rb +20 -0
  16. data/lib/go_api_client/domain/artifact.rb +16 -0
  17. data/lib/go_api_client/domain/author.rb +22 -0
  18. data/lib/go_api_client/domain/changeset.rb +13 -0
  19. data/lib/go_api_client/domain/config/job.rb +15 -0
  20. data/lib/go_api_client/domain/config/pipeline.rb +15 -0
  21. data/lib/go_api_client/domain/config/stage.rb +15 -0
  22. data/lib/go_api_client/domain/entry.rb +13 -0
  23. data/lib/go_api_client/domain/feed.rb +13 -0
  24. data/lib/go_api_client/domain/internal_cache.rb +28 -0
  25. data/lib/go_api_client/domain/job.rb +17 -0
  26. data/lib/go_api_client/domain/material.rb +14 -0
  27. data/lib/go_api_client/domain/pipeline.rb +27 -0
  28. data/lib/go_api_client/domain/project.rb +14 -0
  29. data/lib/go_api_client/domain/scheduled_job.rb +12 -0
  30. data/lib/go_api_client/domain/stage.rb +28 -0
  31. data/lib/go_api_client/domain/user.rb +30 -0
  32. data/lib/go_api_client/http_fetcher.rb +73 -48
  33. data/lib/go_api_client/parsers/artifact_parser.rb +17 -0
  34. data/lib/go_api_client/parsers/author_parser.rb +24 -0
  35. data/lib/go_api_client/parsers/changeset.rb +26 -0
  36. data/lib/go_api_client/parsers/config/job_parser.rb +48 -0
  37. data/lib/go_api_client/parsers/config/pipeline_parser.rb +42 -0
  38. data/lib/go_api_client/parsers/config/stage_parser.rb +33 -0
  39. data/lib/go_api_client/parsers/entry_parser.rb +27 -0
  40. data/lib/go_api_client/parsers/feed_parser.rb +27 -0
  41. data/lib/go_api_client/parsers/job_parser.rb +47 -0
  42. data/lib/go_api_client/parsers/material_parser.rb +29 -0
  43. data/lib/go_api_client/parsers/parser_helper.rb +11 -0
  44. data/lib/go_api_client/parsers/pipeline_parser.rb +30 -0
  45. data/lib/go_api_client/parsers/project_parser.rb +26 -0
  46. data/lib/go_api_client/parsers/scheduled_job_parser.rb +28 -0
  47. data/lib/go_api_client/parsers/stage_parser.rb +31 -0
  48. data/lib/go_api_client/parsers/user_parser.rb +12 -0
  49. data/lib/go_api_client/version.rb +4 -4
  50. data/lib/go_api_client.rb +56 -110
  51. data/test/go_api_client/artifact_test.rb +8 -8
  52. data/test/go_api_client/author_test.rb +27 -0
  53. data/test/go_api_client/building_test.rb +21 -19
  54. data/test/go_api_client/{atom/entry_test.rb → entry_test.rb} +8 -8
  55. data/test/go_api_client/job_test.rb +15 -14
  56. data/test/go_api_client/pipeline_test.rb +24 -27
  57. data/test/go_api_client/stage_test.rb +21 -74
  58. data/test/go_api_client/user_test.rb +15 -20
  59. metadata +108 -78
  60. data/.init.sh +0 -8
  61. data/.rbenv-gemsets +0 -1
  62. data/.ruby-version +0 -1
  63. data/.rvmrc +0 -1
  64. data/.yardopts +0 -6
  65. data/Gemfile.lock +0 -32
  66. data/README.textile +0 -64
  67. data/lib/go_api_client/artifact.rb +0 -27
  68. data/lib/go_api_client/atom/author.rb +0 -42
  69. data/lib/go_api_client/atom/entry.rb +0 -34
  70. data/lib/go_api_client/atom/feed.rb +0 -40
  71. data/lib/go_api_client/atom/feed_page.rb +0 -49
  72. data/lib/go_api_client/atom.rb +0 -4
  73. data/lib/go_api_client/commit.rb +0 -30
  74. data/lib/go_api_client/helpers/simple_attribute_support.rb +0 -11
  75. data/lib/go_api_client/helpers.rb +0 -1
  76. data/lib/go_api_client/job.rb +0 -68
  77. data/lib/go_api_client/pipeline.rb +0 -48
  78. data/lib/go_api_client/stage.rb +0 -57
  79. data/lib/go_api_client/user.rb +0 -36
  80. data/test/go_api_client/atom/author_test.rb +0 -27
  81. data/test/go_api_client/atom/feed_page_test.rb +0 -41
  82. data/test/go_api_client/atom/feed_test.rb +0 -39
  83. data/test/go_api_client/commit_test.rb +0 -38
  84. data/test/schedule_test.rb +0 -12
@@ -1,4 +1,4 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module GoApiClient
4
4
  module Atom
@@ -9,18 +9,18 @@ module GoApiClient
9
9
  @entry_node = @root.xpath('./xmlns:entry')[12]
10
10
  end
11
11
 
12
- test "should parse entry node" do
13
- entry = Entry.new(@entry_node).parse!
12
+ test 'should parse entry node' do
13
+ entry = GoApiClient::Parsers::Entry.parse(@entry_node)
14
14
  assert_equal 'https://go-server.example.com/go/pipelines/tlb/177/ant_count_go/1', entry.id
15
- assert_equal Time.parse('2012-01-22 11:32:57 UTC'), entry.updated_at
15
+ assert_equal Time.parse('2012-01-22 11:32:57 UTC'), entry.updated
16
16
  assert_equal 'tlb(177) stage ant_count_go(1) Passed', entry.title
17
- assert_equal 'https://go-server.example.com/go/api/stages/210161.xml', entry.stage_href
17
+ assert_equal 'https://go-server.example.com/go/api/stages/210161.xml', entry.stage_uri
18
18
  expected_authors = [
19
- Author.new(nil, :name => 'Pavan', :email => 'itspanzi@gmail.com'),
20
- Author.new(nil, :name => 'Pavan Sudarshan', :email => 'itspanzi@gmail.com')
19
+ GoApiClient::Domain::Author.new({:name => 'Pavan', :email => 'itspanzi@gmail.com'}),
20
+ GoApiClient::Domain::Author.new({:name => 'Pavan Sudarshan', :email => 'itspanzi@gmail.com'})
21
21
  ]
22
22
 
23
- assert_equal expected_authors, entry.authors
23
+ assert_equal expected_authors, entry.parsed_authors
24
24
  end
25
25
  end
26
26
  end
@@ -1,23 +1,23 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module GoApiClient
4
4
  class JobTest < Test::Unit::TestCase
5
- test "should fetch the job xml and populate itself" do
6
- stub_request(:get, "http://localhost:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_1.xml"))
5
+ test 'should fetch the job xml and populate itself' do
6
+ link = 'http://localhost:8153/go/api/jobs/1.xml'
7
+ stub_request(:get, link).to_return(:body => file_contents('jobs_1.xml'))
7
8
 
8
- link = "http://localhost:8153/go/api/jobs/1.xml"
9
- job = GoApiClient::Job.from(link)
9
+ job = GoApiClient::Client.new.api(:job).job({:job_uri => link})
10
10
 
11
- assert_equal 'http://localhost:8153/go/api/jobs/1.xml', job.url
11
+ assert_equal 'http://localhost:8153/go/api/jobs/1.xml', job.self_uri
12
12
  assert_equal 'http://localhost:8153/go/files/defaultPipeline/1/Units/1/Test', job.artifacts_uri
13
13
  assert_equal 'http://localhost:8153/go/files/defaultPipeline/1/Units/1/Test/cruise-output/console.log', job.console_log_url
14
14
 
15
15
 
16
- assert_equal 'urn:x-go.studios.thoughtworks.com:job-id:defaultPipeline:1:Units:1:Test', job.identifier
16
+ assert_equal 'urn:x-go.studios.thoughtworks.com:job-id:defaultPipeline:1:Units:1:Test', job.id
17
17
 
18
18
  assert_equal 900, job.duration
19
- assert_equal "Test", job.name
20
- assert_equal "Failed", job.result
19
+ assert_equal 'Test', job.name
20
+ assert_equal 'Failed', job.result
21
21
  assert_equal Time.parse('2012-02-23 11:46:15 UTC'), job.scheduled
22
22
  assert_equal Time.parse('2012-02-23 11:46:27 UTC'), job.assigned
23
23
  assert_equal Time.parse('2012-02-23 11:46:37 UTC'), job.preparing
@@ -26,13 +26,14 @@ module GoApiClient
26
26
  assert_equal Time.parse('2012-02-23 11:46:45 UTC'), job.completed
27
27
  end
28
28
 
29
- test "should parse job even when some properties are missing" do
30
- stub_request(:get, "http://go-server.1.project:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_with_no_properties.xml"))
31
- link = "http://go-server.1.project:8153/go/api/jobs/1.xml"
32
- job = GoApiClient::Job.from(link)
29
+ test 'should parse job even when some properties are missing' do
30
+ link = 'http://go-server.1.project:8153/go/api/jobs/1.xml'
31
+ stub_request(:get, link).to_return(:body => file_contents('jobs_with_no_properties.xml'))
32
+
33
+ job = GoApiClient::Client.new({:host => 'go-server.1.project'}).api(:job).job({:job_uri => link})
33
34
 
34
35
  assert_equal 80, job.duration
35
- assert_equal "Failed", job.result
36
+ assert_equal 'Failed', job.result
36
37
  %w(scheduled assigned preparing building completing completed).each do |property|
37
38
  assert_nil job.send(property)
38
39
  end
@@ -1,36 +1,25 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module GoApiClient
4
4
  class PipelineTest < Test::Unit::TestCase
5
5
 
6
+ LINK = 'http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml'
6
7
  def setup
7
- stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
8
+ stub_request(:get, LINK).to_return(:body => file_contents('pipelines_1.xml'))
8
9
  end
9
10
 
10
- test "should fetch the pipeline xml and populate itself" do
11
- link = "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml"
12
- pipeline = GoApiClient::Pipeline.from(link)
11
+ test 'should fetch the pipeline xml and populate itself' do
12
+ pipeline = GoApiClient::Client.new.api(:pipeline).pipeline({:pipeline_uri => LINK})
13
13
 
14
- assert_equal "1", pipeline.label
14
+ assert_equal '1', pipeline.label
15
15
  assert_equal 99, pipeline.counter
16
- assert_equal "defaultPipeline", pipeline.name
17
- assert_equal "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml", pipeline.url
18
- assert_equal ["Update README", "Fixed build"], pipeline.commits.collect(&:message)
19
- assert_equal "urn:x-go.studios.thoughtworks.com:job-id:defaultPipeline:1", pipeline.identifier
16
+ assert_equal 'defaultPipeline', pipeline.name
17
+ assert_equal 'http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml', pipeline.self_uri
18
+ assert_equal 'urn:x-go.studios.thoughtworks.com:job-id:defaultPipeline:1', pipeline.id
20
19
  assert_equal Time.parse('2012-02-23 11:46:15 UTC'), pipeline.schedule_time
21
20
  end
22
21
 
23
- test "should return a list of authors from the first stage" do
24
- link = "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml"
25
- pipeline = GoApiClient::Pipeline.from(link)
26
- author_foo = Atom::Author.new(nil, :name => 'foo', :email => 'foo@example.com', :uri => 'http://foo.example.com')
27
- author_bar = Atom::Author.new(nil, :name => 'bar', :email => 'bar@example.com', :uri => 'http://bar.example.com')
28
-
29
- pipeline.stages << OpenStruct.new(:authors => [author_foo, author_bar])
30
- assert_equal [author_foo, author_bar], pipeline.authors
31
- end
32
-
33
- test "should only parse materials with type=GitMaterial" do
22
+ test 'should only parse materials with type=GitMaterial' do
34
23
  doc = Nokogiri::XML.parse %q{<?xml version="1.0" encoding="UTF-8"?>
35
24
 
36
25
  <pipeline name="GreenInstallers" counter="286" label="286">
@@ -71,14 +60,22 @@ module GoApiClient
71
60
  </pipeline>
72
61
  }
73
62
 
74
- pipeline = GoApiClient::Pipeline.new(doc.root).parse!
75
- assert_equal 1, pipeline.commits.count
76
- commit = pipeline.commits.first
63
+ pipeline = GoApiClient::Parsers::Pipeline.parse(doc.root)
64
+ assert_equal 2, pipeline.parsed_materials.count
65
+ material = pipeline.parsed_materials.first
66
+ assert_equal 1, material.parsed_changesets.count
67
+ changeset = material.parsed_changesets.first
77
68
 
78
- assert_equal 'bc9cc9401b816d753f267227934e535affcb4028', commit.revision
79
- assert_equal User.new('wdephill', 'wdephill@thoughtworks.com'), commit.user
80
- assert_equal Time.parse("2013-02-09 00:19:18 UTC"), commit.time
69
+ assert_equal 'bc9cc9401b816d753f267227934e535affcb4028', changeset.revision
70
+ assert_equal GoApiClient::Domain::User.new('wdephill', 'wdephill@thoughtworks.com'), changeset.parsed_user
71
+ assert_equal Time.parse('2013-02-09 00:19:18 UTC'), changeset.checkin_time
81
72
  end
82
73
 
74
+ test 'should schedule a build specified' do
75
+ stub_request(:post, 'http://go-server.2.project:8153/go/api/pipelines/defaultPipeline/schedule')
76
+ GoApiClient::Client.new({:host => 'go-server.2.project'}).api(:pipeline).schedule({:pipeline_name => 'defaultPipeline'})
77
+
78
+ assert_requested(:post, 'http://go-server.2.project:8153/go/api/pipelines/defaultPipeline/schedule', :body => '')
79
+ end
83
80
  end
84
81
  end
@@ -1,96 +1,43 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module GoApiClient
4
4
  class StageTest < Test::Unit::TestCase
5
+ test 'should parse stage' do
6
+ stub_request(:get, 'http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml').to_return(:body => file_contents('pipelines_1.xml'))
7
+ stub_request(:get, 'http://localhost:8153/go/api/stages/1.xml').to_return(:body => file_contents('stages_1.xml'))
8
+ stub_request(:get, 'http://localhost:8153/go/api/stages/2.xml').to_return(:body => file_contents('stages_2.xml'))
9
+ stub_request(:get, 'http://localhost:8153/go/api/jobs/1.xml').to_return(:body => file_contents('jobs_1.xml'))
10
+ stub_request(:get, 'http://localhost:8153/go/api/jobs/2.xml').to_return(:body => file_contents('jobs_2.xml'))
5
11
 
6
- test "should return stages in order" do
7
- stub_request(:any, /.*go-server.2.project.*/).
8
- to_return(
9
- lambda do |request|
10
- { :body => file_contents("ordering/#{request.uri.path}")}
11
- end
12
- ).times(9999)
12
+ stub_request(:get, 'http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml').to_return(:body => file_contents('stages.xml'))
13
13
 
14
- runs = GoApiClient.runs(:host => 'go-server.2.project')
14
+ papi = GoApiClient::Client.new.api(:pipeline)
15
+ pipeline = papi.pipeline({:pipeline_name => 'defaultPipeline', :pipeline_id => 1, :eager_parser => [:stage, :job]})
16
+ stages = pipeline.parsed_stages
15
17
 
16
- assert_equal runs.pipelines.collect(&:counter).sort, runs.pipelines.collect(&:counter)
17
-
18
- runs.pipelines.each do |pipeline|
19
- assert_equal pipeline.stages.collect(&:completed_at).sort, pipeline.stages.collect(&:completed_at)
20
- end
21
- end
22
-
23
- test "should parse stage" do
24
- stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
25
- stub_request(:get, "http://localhost:8153/go/api/stages/1.xml").to_return(:body => file_contents("stages_1.xml"))
26
- stub_request(:get, "http://localhost:8153/go/api/stages/2.xml").to_return(:body => file_contents("stages_2.xml"))
27
- stub_request(:get, "http://localhost:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_1.xml"))
28
- stub_request(:get, "http://localhost:8153/go/api/jobs/2.xml").to_return(:body => file_contents("jobs_2.xml"))
29
-
30
- stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml").to_return(:body => file_contents("stages.xml"))
31
- runs = GoApiClient.runs(:host => "localhost", :port => 8153)
32
- pipelines = runs.pipelines
33
- assert_equal "http://localhost:8153/go/pipelines/defaultPipeline/1/Acceptance/1", runs.latest_atom_entry_id
34
- stages = pipelines.first.stages
35
-
36
- assert_equal 1, pipelines.count
37
18
  assert_equal 2, stages.count
38
19
 
39
- assert_equal "http://localhost:8153/go/api/stages/1.xml", stages.first.url
40
- assert_equal "http://localhost:8153/go/api/stages/2.xml", stages.last.url
20
+ assert_equal 'http://localhost:8153/go/api/stages/1.xml', stages.first.self_uri
21
+ assert_equal 'http://localhost:8153/go/api/stages/2.xml', stages.last.self_uri
41
22
 
42
23
  assert_equal 1, stages.first.counter
43
24
  assert_equal 1, stages.last.counter
44
25
 
45
- assert_equal [Time.parse("2012-02-23T17:16:41+05:30").utc, Time.parse("2012-02-23T17:19:31+05:30").utc], stages.collect(&:completed_at)
46
-
47
- assert_equal [Atom::Author.new(nil, :name => 'oogabooga', :email => 'twgosaas@gmail.com')], pipelines.first.authors
48
-
26
+ assert_equal [Time.parse('2012-02-23T17:16:41+05:30').utc, Time.parse('2012-02-23T17:19:31+05:30').utc], stages.collect(&:updated)
49
27
  stages.each do |stage|
50
- assert_equal Atom::Author.new(nil, :name => 'oogabooga', :email => 'twgosaas@gmail.com'), stage.authors.first
51
- assert_equal "Failed", stage.result
28
+ assert_equal 'Failed', stage.result
52
29
  assert stage.failed?
53
30
  assert false == stage.passed?
54
31
  end
55
32
 
56
- assert_equal "Units", stages.first.name
57
- assert_equal "Acceptance", stages.last.name
58
-
59
- assert_equal ["Update README", "Fixed build"], pipelines.first.commits.collect(&:message)
60
-
61
- assert_equal "http://localhost:8153/go/files/defaultPipeline/1/Units/1/Test/cruise-output/console.log", stages.first.jobs.first.console_log_url
62
- assert_equal "http://localhost:8153/go/files/defaultPipeline/1/Acceptance/1/Test/cruise-output/console.log", stages.last.jobs.first.console_log_url
63
-
64
- assert_equal 'urn:x-go.studios.thoughtworks.com:stage-id:defaultPipeline:1:Units:1', stages.first.identifier
65
- assert_equal 'urn:x-go.studios.thoughtworks.com:stage-id:defaultPipeline:1:Acceptance:1', stages.last.identifier
66
- end
67
-
68
- test "empty atom feed should not throw up" do
69
- stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml").to_return(:body => file_contents("stages_empty.xml"))
70
- runs = GoApiClient.runs(:host => "localhost", :port => 8153)
71
-
72
- assert runs.pipelines.empty?
73
-
74
- end
75
-
76
- test "should returns feed data for all pipelines available on the server" do
77
- stub_request(:get,"http://localhost:8153/go/api/pipelines.xml" ).to_return(:body => file_contents("pipelines.xml"))
78
-
79
- stub_request(:get,"http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml" ).to_return(:body => file_contents("default_pipeline.xml"))
80
- stub_request(:get, "http://localhost:8153/go/api/pipelines/defaultPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
81
- stub_request(:get, "http://localhost:8153/go/api/stages/1.xml").to_return(:body => file_contents("stages_1.xml"))
82
- stub_request(:get, "http://localhost:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_1.xml"))
83
-
84
-
85
- stub_request(:get,"http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml" ).to_return(:body => file_contents("integration_pipeline.xml"))
86
- stub_request(:get, "http://localhost:8153/go/api/pipelines/integrationPipeline/1.xml").to_return(:body => file_contents("pipelines_1.xml"))
87
- stub_request(:get, "http://localhost:8153/go/api/stages/1.xml").to_return(:body => file_contents("stages_1.xml"))
88
- stub_request(:get, "http://localhost:8153/go/api/jobs/1.xml").to_return(:body => file_contents("jobs_1.xml"))
89
-
33
+ assert_equal 'Units', stages.first.name
34
+ assert_equal 'Acceptance', stages.last.name
90
35
 
36
+ assert_equal 'http://localhost:8153/go/files/defaultPipeline/1/Units/1/Test/cruise-output/console.log', stages.first.parsed_jobs.first.console_log_url
37
+ assert_equal 'http://localhost:8153/go/files/defaultPipeline/1/Acceptance/1/Test/cruise-output/console.log', stages.last.parsed_jobs.first.console_log_url
91
38
 
92
- all_runs = GoApiClient::all_runs({:host => "localhost"})
93
- assert_equal all_runs.keys, %w(http://localhost:8153/go/api/pipelines/defaultPipeline/stages.xml http://localhost:8153/go/api/pipelines/integrationPipeline/stages.xml)
39
+ assert_equal 'urn:x-go.studios.thoughtworks.com:stage-id:defaultPipeline:1:Units:1', stages.first.id
40
+ assert_equal 'urn:x-go.studios.thoughtworks.com:stage-id:defaultPipeline:1:Acceptance:1', stages.last.id
94
41
  end
95
42
  end
96
43
  end
@@ -1,27 +1,22 @@
1
- require "test_helper"
1
+ require 'test_helper'
2
2
 
3
3
  module GoApiClient
4
4
  class UserTest < Test::Unit::TestCase
5
-
6
- test "should parse user name and email address" do
7
- user = User.parse("foobar <foo@example.com>")
8
- assert_equal 'foobar', user.name
9
- assert_equal 'foo@example.com', user.email
5
+ test 'should parse user name and email address' do
6
+ doc = Nokogiri::XML.parse %q{<user><![CDATA[Foo Bar <foo.bar@example.com>]]></user>}
7
+ user = GoApiClient::Parsers::User.parse(doc.root)
8
+ assert_equal 'Foo Bar', user.name
9
+ assert_equal 'foo.bar@example.com', user.email
10
10
  end
11
-
12
- test "should strip name and email when parsing" do
13
- user = User.parse("foobar1 <foo1@example.com>")
14
- assert_equal 'foobar1', user.name
15
- assert_equal 'foo1@example.com', user.email
11
+ test 'equality' do
12
+ doc = Nokogiri::XML.parse %q{<user><![CDATA[Foo Bar <foo.bar@example.com>]]></user>}
13
+ assert_equal GoApiClient::Parsers::User.parse(doc.root), GoApiClient::Parsers::User.parse(doc.root)
16
14
  end
17
-
18
- test "equality" do
19
- assert_equal User.parse("foobar <foo@example.com>"), User.parse("foobar <foo@example.com>")
20
- end
21
-
22
- test "hashcode" do
23
- assert_equal User.parse("foobar <foo@example.com>").hash, User.parse("foobar <foo@example.com>").hash
24
- assert_not_equal User.parse("bar <bar@example.com>").hash, User.parse("foo <foo@example.com>").hash
15
+ test 'hashcode' do
16
+ doc1 = Nokogiri::XML.parse %q{<user><![CDATA[Foo Bar <foo.bar@example.com>]]></user>}
17
+ doc2 = Nokogiri::XML.parse %q{<user><![CDATA[Foo Bar <foo@bar.com>]]></user>}
18
+ assert_equal GoApiClient::Parsers::User.parse(doc1.root).hash, GoApiClient::Parsers::User.parse(doc1.root).hash
19
+ assert_not_equal GoApiClient::Parsers::User.parse(doc1.root).hash, GoApiClient::Parsers::User.parse(doc2.root).hash
25
20
  end
26
21
  end
27
- end
22
+ end
metadata CHANGED
@@ -1,136 +1,181 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: go_api_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.4
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Nikhil Mungel
9
8
  - Ketan Padegaonkar
10
9
  - Shishir Das
10
+ - Ilja Bobkevic
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2013-06-04 00:00:00.000000000 Z
14
+ date: 2014-11-18 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: webmock
18
18
  requirement: !ruby/object:Gem::Requirement
19
- none: false
20
19
  requirements:
21
- - - ! '>='
20
+ - - "~>"
22
21
  - !ruby/object:Gem::Version
23
- version: '0'
22
+ version: '1'
23
+ - - ">="
24
+ - !ruby/object:Gem::Version
25
+ version: '1.8'
24
26
  type: :development
25
27
  prerelease: false
26
28
  version_requirements: !ruby/object:Gem::Requirement
27
- none: false
28
29
  requirements:
29
- - - ! '>='
30
+ - - "~>"
31
+ - !ruby/object:Gem::Version
32
+ version: '1'
33
+ - - ">="
30
34
  - !ruby/object:Gem::Version
31
- version: '0'
35
+ version: '1.8'
32
36
  - !ruby/object:Gem::Dependency
33
37
  name: simplecov
34
38
  requirement: !ruby/object:Gem::Requirement
35
- none: false
36
39
  requirements:
37
- - - ! '>='
40
+ - - "~>"
41
+ - !ruby/object:Gem::Version
42
+ version: '0.6'
43
+ - - ">="
38
44
  - !ruby/object:Gem::Version
39
- version: '0'
45
+ version: 0.6.1
40
46
  type: :development
41
47
  prerelease: false
42
48
  version_requirements: !ruby/object:Gem::Requirement
43
- none: false
44
49
  requirements:
45
- - - ! '>='
50
+ - - "~>"
46
51
  - !ruby/object:Gem::Version
47
- version: '0'
52
+ version: '0.6'
53
+ - - ">="
54
+ - !ruby/object:Gem::Version
55
+ version: 0.6.1
48
56
  - !ruby/object:Gem::Dependency
49
57
  name: rake
50
58
  requirement: !ruby/object:Gem::Requirement
51
- none: false
52
59
  requirements:
53
- - - ! '>='
60
+ - - "~>"
61
+ - !ruby/object:Gem::Version
62
+ version: '0.9'
63
+ - - ">="
54
64
  - !ruby/object:Gem::Version
55
- version: '0'
65
+ version: 0.9.2.2
56
66
  type: :development
57
67
  prerelease: false
58
68
  version_requirements: !ruby/object:Gem::Requirement
59
- none: false
60
69
  requirements:
61
- - - ! '>='
70
+ - - "~>"
62
71
  - !ruby/object:Gem::Version
63
- version: '0'
72
+ version: '0.9'
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: 0.9.2.2
64
76
  - !ruby/object:Gem::Dependency
65
77
  name: test-unit
66
78
  requirement: !ruby/object:Gem::Requirement
67
- none: false
68
79
  requirements:
69
- - - ! '>='
80
+ - - "~>"
81
+ - !ruby/object:Gem::Version
82
+ version: '2'
83
+ - - ">="
70
84
  - !ruby/object:Gem::Version
71
- version: '0'
85
+ version: '2.0'
72
86
  type: :development
73
87
  prerelease: false
74
88
  version_requirements: !ruby/object:Gem::Requirement
75
- none: false
76
89
  requirements:
77
- - - ! '>='
90
+ - - "~>"
91
+ - !ruby/object:Gem::Version
92
+ version: '2'
93
+ - - ">="
78
94
  - !ruby/object:Gem::Version
79
- version: '0'
95
+ version: '2.0'
80
96
  - !ruby/object:Gem::Dependency
81
97
  name: nokogiri
82
98
  requirement: !ruby/object:Gem::Requirement
83
- none: false
84
99
  requirements:
85
- - - ! '>='
100
+ - - "~>"
86
101
  - !ruby/object:Gem::Version
87
- version: '0'
102
+ version: '1.5'
103
+ - - ">="
104
+ - !ruby/object:Gem::Version
105
+ version: 1.5.2
88
106
  type: :runtime
89
107
  prerelease: false
90
108
  version_requirements: !ruby/object:Gem::Requirement
91
- none: false
92
109
  requirements:
93
- - - ! '>='
110
+ - - "~>"
111
+ - !ruby/object:Gem::Version
112
+ version: '1.5'
113
+ - - ">="
94
114
  - !ruby/object:Gem::Version
95
- version: '0'
115
+ version: 1.5.2
96
116
  description: This gem parses atom feed generated by the Go Continuous Integration
97
117
  server and provides an OO representation of the pipelines and stages.
98
118
  email:
99
119
  - hyfather@gmail.com
100
120
  - KetanPadegaonkar@gmail.com
101
121
  - shishir.das@gmail.com
122
+ - iljb.bobkevic@unibet.com
102
123
  executables: []
103
124
  extensions: []
104
125
  extra_rdoc_files: []
105
126
  files:
106
- - .gitignore
107
- - .init.sh
108
- - .rbenv-gemsets
109
- - .ruby-version
110
- - .rvmrc
111
- - .yardopts
127
+ - ".gitignore"
128
+ - ".travis.yml"
112
129
  - Gemfile
113
- - Gemfile.lock
114
- - README.textile
130
+ - README.md
115
131
  - Rakefile
116
132
  - go_api_client.gemspec
117
133
  - lib/go_api_client.rb
118
- - lib/go_api_client/artifact.rb
119
- - lib/go_api_client/atom.rb
120
- - lib/go_api_client/atom/author.rb
121
- - lib/go_api_client/atom/entry.rb
122
- - lib/go_api_client/atom/feed.rb
123
- - lib/go_api_client/atom/feed_page.rb
124
- - lib/go_api_client/commit.rb
134
+ - lib/go_api_client/api/abstract_api.rb
135
+ - lib/go_api_client/api/cctray.rb
136
+ - lib/go_api_client/api/config.rb
137
+ - lib/go_api_client/api/feed.rb
138
+ - lib/go_api_client/api/job.rb
139
+ - lib/go_api_client/api/pipeline.rb
140
+ - lib/go_api_client/api/properties.rb
141
+ - lib/go_api_client/api/stage.rb
142
+ - lib/go_api_client/attribute_helper.rb
143
+ - lib/go_api_client/client.rb
144
+ - lib/go_api_client/domain/artifact.rb
145
+ - lib/go_api_client/domain/author.rb
146
+ - lib/go_api_client/domain/changeset.rb
147
+ - lib/go_api_client/domain/config/job.rb
148
+ - lib/go_api_client/domain/config/pipeline.rb
149
+ - lib/go_api_client/domain/config/stage.rb
150
+ - lib/go_api_client/domain/entry.rb
151
+ - lib/go_api_client/domain/feed.rb
152
+ - lib/go_api_client/domain/internal_cache.rb
153
+ - lib/go_api_client/domain/job.rb
154
+ - lib/go_api_client/domain/material.rb
155
+ - lib/go_api_client/domain/pipeline.rb
156
+ - lib/go_api_client/domain/project.rb
157
+ - lib/go_api_client/domain/scheduled_job.rb
158
+ - lib/go_api_client/domain/stage.rb
159
+ - lib/go_api_client/domain/user.rb
125
160
  - lib/go_api_client/engine.rb
126
- - lib/go_api_client/helpers.rb
127
- - lib/go_api_client/helpers/simple_attribute_support.rb
128
161
  - lib/go_api_client/http_fetcher.rb
129
- - lib/go_api_client/job.rb
130
162
  - lib/go_api_client/logger.rb
131
- - lib/go_api_client/pipeline.rb
132
- - lib/go_api_client/stage.rb
133
- - lib/go_api_client/user.rb
163
+ - lib/go_api_client/parsers/artifact_parser.rb
164
+ - lib/go_api_client/parsers/author_parser.rb
165
+ - lib/go_api_client/parsers/changeset.rb
166
+ - lib/go_api_client/parsers/config/job_parser.rb
167
+ - lib/go_api_client/parsers/config/pipeline_parser.rb
168
+ - lib/go_api_client/parsers/config/stage_parser.rb
169
+ - lib/go_api_client/parsers/entry_parser.rb
170
+ - lib/go_api_client/parsers/feed_parser.rb
171
+ - lib/go_api_client/parsers/job_parser.rb
172
+ - lib/go_api_client/parsers/material_parser.rb
173
+ - lib/go_api_client/parsers/parser_helper.rb
174
+ - lib/go_api_client/parsers/pipeline_parser.rb
175
+ - lib/go_api_client/parsers/project_parser.rb
176
+ - lib/go_api_client/parsers/scheduled_job_parser.rb
177
+ - lib/go_api_client/parsers/stage_parser.rb
178
+ - lib/go_api_client/parsers/user_parser.rb
134
179
  - lib/go_api_client/version.rb
135
180
  - test/fixtures/building/job_1.xml
136
181
  - test/fixtures/building/job_2.xml
@@ -188,48 +233,37 @@ files:
188
233
  - test/fixtures/stages_2.xml
189
234
  - test/fixtures/stages_empty.xml
190
235
  - test/go_api_client/artifact_test.rb
191
- - test/go_api_client/atom/author_test.rb
192
- - test/go_api_client/atom/entry_test.rb
193
- - test/go_api_client/atom/feed_page_test.rb
194
- - test/go_api_client/atom/feed_test.rb
236
+ - test/go_api_client/author_test.rb
195
237
  - test/go_api_client/building_test.rb
196
- - test/go_api_client/commit_test.rb
238
+ - test/go_api_client/entry_test.rb
197
239
  - test/go_api_client/job_test.rb
198
240
  - test/go_api_client/pipeline_test.rb
199
241
  - test/go_api_client/stage_test.rb
200
242
  - test/go_api_client/user_test.rb
201
- - test/schedule_test.rb
202
243
  - test/test_helper.rb
203
244
  homepage: https://github.com/ThoughtWorksInc/go-api-client
204
245
  licenses:
205
246
  - MIT
247
+ metadata: {}
206
248
  post_install_message:
207
249
  rdoc_options: []
208
250
  require_paths:
209
251
  - lib
210
252
  required_ruby_version: !ruby/object:Gem::Requirement
211
- none: false
212
253
  requirements:
213
- - - ! '>='
254
+ - - ">="
214
255
  - !ruby/object:Gem::Version
215
256
  version: '0'
216
- segments:
217
- - 0
218
- hash: 4287728317400893528
219
257
  required_rubygems_version: !ruby/object:Gem::Requirement
220
- none: false
221
258
  requirements:
222
- - - ! '>='
259
+ - - ">="
223
260
  - !ruby/object:Gem::Version
224
261
  version: '0'
225
- segments:
226
- - 0
227
- hash: 4287728317400893528
228
262
  requirements: []
229
263
  rubyforge_project: go_api_client
230
- rubygems_version: 1.8.23
264
+ rubygems_version: 2.4.1
231
265
  signing_key:
232
- specification_version: 3
266
+ specification_version: 4
233
267
  summary: Client to parse Go CI atom feed
234
268
  test_files:
235
269
  - test/fixtures/building/job_1.xml
@@ -288,15 +322,11 @@ test_files:
288
322
  - test/fixtures/stages_2.xml
289
323
  - test/fixtures/stages_empty.xml
290
324
  - test/go_api_client/artifact_test.rb
291
- - test/go_api_client/atom/author_test.rb
292
- - test/go_api_client/atom/entry_test.rb
293
- - test/go_api_client/atom/feed_page_test.rb
294
- - test/go_api_client/atom/feed_test.rb
325
+ - test/go_api_client/author_test.rb
295
326
  - test/go_api_client/building_test.rb
296
- - test/go_api_client/commit_test.rb
327
+ - test/go_api_client/entry_test.rb
297
328
  - test/go_api_client/job_test.rb
298
329
  - test/go_api_client/pipeline_test.rb
299
330
  - test/go_api_client/stage_test.rb
300
331
  - test/go_api_client/user_test.rb
301
- - test/schedule_test.rb
302
332
  - test/test_helper.rb