travis-surveillance 0.0.8 → 0.0.9

Sign up to get free protection for your applications and to get access to all the features.
@@ -96,6 +96,10 @@ module Travis
96
96
  end
97
97
  end
98
98
 
99
+ def api_url
100
+ @api_url ||= project.api_url + "/builds/#{@id}"
101
+ end
102
+
99
103
  def url
100
104
  @url ||= project.url + "/builds/#{@id}"
101
105
  end
@@ -106,7 +110,7 @@ module Travis
106
110
  if Travis::Surveillance.mocking?
107
111
  JSON.parse(IO.read(File.dirname(__FILE__) + "/../../../spec/support/builds/#{id}.json"))
108
112
  else
109
- JSON.parse(open("#{url}.json").read)
113
+ JSON.parse(open("#{api_url}", "Accept" => "application/vnd.travis-ci.1+json").read)
110
114
  end
111
115
  end
112
116
 
@@ -88,7 +88,7 @@ module Travis
88
88
  if Travis::Surveillance.mocking?
89
89
  JSON.parse(IO.read(File.dirname(__FILE__) + "/../../../spec/support/jobs/#{id}.json"))
90
90
  else
91
- JSON.parse(open("https://travis-ci.org/jobs/#{id}.json").read)
91
+ JSON.parse(open("https://api.travis-ci.org/jobs/#{id}", "Accept" => "application/vnd.travis-ci.1+json").read)
92
92
  end
93
93
  end
94
94
 
@@ -67,6 +67,10 @@ module Travis
67
67
  builds.last.result if builds.any?
68
68
  end
69
69
 
70
+ def api_url
71
+ @api_url ||= "https://api.travis-ci.org/repos/#{@slug}"
72
+ end
73
+
70
74
  def url
71
75
  @url ||= "https://travis-ci.org/#{@slug}"
72
76
  end
@@ -77,7 +81,7 @@ module Travis
77
81
  if Travis::Surveillance.mocking?
78
82
  JSON.parse(IO.read(File.dirname(__FILE__) + "/../../../spec/support/projects/#{slug.gsub('/', '-')}.json"))
79
83
  else
80
- JSON.parse(open("#{url}.json").read)
84
+ JSON.parse(open("#{api_url}", "Accept" => "application/vnd.travis-ci.1+json").read)
81
85
  end
82
86
  end
83
87
 
@@ -89,7 +93,7 @@ module Travis
89
93
  []
90
94
  end
91
95
  else
92
- JSON.parse(open("#{url}/builds.json").read)
96
+ JSON.parse(open("#{api_url}/builds", "Accept" => "application/vnd.travis-ci.1+json").read)
93
97
  end
94
98
  end
95
99
 
@@ -1,5 +1,5 @@
1
1
  module Travis
2
2
  module Surveillance
3
- VERSION = "0.0.8"
3
+ VERSION = "0.0.9"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: travis-surveillance
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8
4
+ version: 0.0.9
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-10-18 00:00:00.000000000 Z
12
+ date: 2012-11-02 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: clamp