trav3 0.2.1 → 0.2.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -0
- data/Gemfile +1 -0
- data/README.md +1 -1
- data/lib/trav3.rb +49 -3
- data/lib/trav3/get.rb +2 -2
- data/lib/trav3/options.rb +7 -10
- data/lib/trav3/post.rb +2 -2
- data/lib/trav3/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ec72696776f9747858b7651d1995adae3f75846de1078f79d166dceb9cebd3aa
|
4
|
+
data.tar.gz: 2640ff730d6fe51bd4898f1f62690a24b48230dea7e03c6eda122a358fb66c62
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cb082ad8b24ca68f5e03c76a92de944e61dfe46fcf66f631cfc5cf4c6ed4b6f2e5613021a09628e8ff0f9af95cf614cdc9d076b78424b6ce876a5a019bb02ca
|
7
|
+
data.tar.gz: a5a282d39eeaa1d12e14179a91d53ee49396ed04e55fa65153468fa2fc8defead7fd3f085d9dda510d9d324e5f9431db07e2fb8d2e9dc5b592097a1ff47ea72f
|
data/.travis.yml
CHANGED
data/Gemfile
CHANGED
data/README.md
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
[![Build Status](https://travis-ci.org/danielpclark/trav3.svg?branch=master)](https://travis-ci.org/danielpclark/trav3)
|
3
3
|
[![Maintainability](https://api.codeclimate.com/v1/badges/1ed07a4baea3832b6207/maintainability)](https://codeclimate.com/github/danielpclark/trav3/maintainability)
|
4
4
|
[![Test Coverage](https://api.codeclimate.com/v1/badges/1ed07a4baea3832b6207/test_coverage)](https://codeclimate.com/github/danielpclark/trav3/test_coverage)
|
5
|
-
[![Red The Docs](https://img.shields.io/badge/Read-the%20docs-blue.svg)](
|
5
|
+
[![Red The Docs](https://img.shields.io/badge/Read-the%20docs-blue.svg)](http://danielpclark.github.io/trav3/Trav3/Travis.html)
|
6
6
|
[![SayThanks.io](https://img.shields.io/badge/SayThanks.io-%E2%98%BC-1EAEDB.svg)](https://saythanks.io/to/danielpclark)
|
7
7
|
|
8
8
|
# Trav3
|
data/lib/trav3.rb
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/ClassLength
|
3
4
|
require 'trav3/version'
|
4
5
|
require 'trav3/pagination'
|
5
6
|
require 'trav3/options'
|
@@ -21,7 +22,6 @@ module Trav3
|
|
21
22
|
# @return [Options] Request options object
|
22
23
|
# @!attribute [r] headers
|
23
24
|
# @return [Headers] Request headers object
|
24
|
-
# rubocop:disable Metrics/ClassLength
|
25
25
|
class Travis
|
26
26
|
API_ENDPOINT = API_ROOT
|
27
27
|
attr_reader :api_endpoint
|
@@ -133,7 +133,7 @@ module Trav3
|
|
133
133
|
#
|
134
134
|
# Example:GET /repo/rails%2Frails/branch/master
|
135
135
|
#
|
136
|
-
# @param
|
136
|
+
# @param name [String] the branch name for the current repository
|
137
137
|
# @return [Success, RequestError]
|
138
138
|
def branch(name)
|
139
139
|
get("#{with_repo}/branch/#{name}#{opts}")
|
@@ -1173,6 +1173,52 @@ module Trav3
|
|
1173
1173
|
end
|
1174
1174
|
end
|
1175
1175
|
|
1176
|
+
# A list of stages.
|
1177
|
+
#
|
1178
|
+
# Currently this is nested within a build.
|
1179
|
+
#
|
1180
|
+
# ## Attributes
|
1181
|
+
#
|
1182
|
+
# Name Type Description
|
1183
|
+
# stages [Stage] List of stages.
|
1184
|
+
#
|
1185
|
+
# **Collection Items**
|
1186
|
+
#
|
1187
|
+
# Each entry in the stages array has the following attributes:
|
1188
|
+
#
|
1189
|
+
# Name Type Description
|
1190
|
+
# id Integer Value uniquely identifying the stage.
|
1191
|
+
# number Integer Incremental number for a stage.
|
1192
|
+
# name String The name of the stage.
|
1193
|
+
# state String Current state of the stage.
|
1194
|
+
# started_at String When the stage started.
|
1195
|
+
# finished_at String When the stage finished.
|
1196
|
+
# jobs [Job] The jobs of a stage.
|
1197
|
+
#
|
1198
|
+
# ## Actions
|
1199
|
+
#
|
1200
|
+
# **Find**
|
1201
|
+
#
|
1202
|
+
# This returns a list of stages belonging to an individual build.
|
1203
|
+
#
|
1204
|
+
# GET <code>/build/{build.id}/stages</code>
|
1205
|
+
#
|
1206
|
+
# Template Variable Type Description
|
1207
|
+
# build.id Integer Value uniquely identifying the build.
|
1208
|
+
# Query Parameter Type Description
|
1209
|
+
# include [String] List of attributes to eager load.
|
1210
|
+
#
|
1211
|
+
# Example:GET /build/86601346/stages
|
1212
|
+
#
|
1213
|
+
# @param build_id [String, Integer] build id
|
1214
|
+
# @raise [TypeError] if given build id is not a number
|
1215
|
+
# @return [Success, RequestError]
|
1216
|
+
def stages(build_id)
|
1217
|
+
raise TypeError, 'Integer expected for build id' unless /^\d+$/.match? build_id.to_s
|
1218
|
+
|
1219
|
+
get("#{without_repo}/build/#{build_id}/stages")
|
1220
|
+
end
|
1221
|
+
|
1176
1222
|
# An individual user.
|
1177
1223
|
#
|
1178
1224
|
# ## Attributes
|
@@ -1307,5 +1353,5 @@ module Trav3
|
|
1307
1353
|
api_endpoint
|
1308
1354
|
end
|
1309
1355
|
end
|
1310
|
-
# rubocop:enable Metrics/ClassLength
|
1311
1356
|
end
|
1357
|
+
# rubocop:enable Metrics/ClassLength
|
data/lib/trav3/get.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/MethodLength
|
3
4
|
require 'net/http'
|
4
5
|
require 'uri'
|
5
6
|
require 'json'
|
6
7
|
|
7
8
|
module Trav3
|
8
9
|
module GET
|
9
|
-
# rubocop:disable Metrics/MethodLength
|
10
10
|
def self.call(travis, url, raw_reply = false)
|
11
11
|
uri = URI(url)
|
12
12
|
req = Net::HTTP::Get.new(uri.request_uri)
|
@@ -25,6 +25,6 @@ module Trav3
|
|
25
25
|
RequestError.new(travis, response)
|
26
26
|
end
|
27
27
|
end
|
28
|
-
# rubocop:enable Metrics/MethodLength
|
29
28
|
end
|
30
29
|
end
|
30
|
+
# rubocop:enable Metrics/MethodLength
|
data/lib/trav3/options.rb
CHANGED
@@ -26,13 +26,10 @@ module Trav3
|
|
26
26
|
def remove(key)
|
27
27
|
return_value = nil
|
28
28
|
|
29
|
-
@opts = @opts.
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
else
|
34
|
-
true
|
35
|
-
end
|
29
|
+
@opts = @opts.delete_if do |item|
|
30
|
+
head, tail = split.call item
|
31
|
+
|
32
|
+
return_value = tail if head == key.to_s
|
36
33
|
end
|
37
34
|
|
38
35
|
return_value
|
@@ -55,13 +52,13 @@ module Trav3
|
|
55
52
|
end
|
56
53
|
|
57
54
|
def to_h
|
58
|
-
@opts.map
|
55
|
+
@opts.map(&split).to_h
|
59
56
|
end
|
60
57
|
|
61
58
|
private
|
62
59
|
|
63
|
-
def
|
64
|
-
|
60
|
+
def split
|
61
|
+
->(entry) { entry.split('=') }
|
65
62
|
end
|
66
63
|
end
|
67
64
|
end
|
data/lib/trav3/post.rb
CHANGED
@@ -1,12 +1,12 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
# rubocop:disable Metrics/MethodLength
|
3
4
|
require 'net/http'
|
4
5
|
require 'uri'
|
5
6
|
require 'json'
|
6
7
|
|
7
8
|
module Trav3
|
8
9
|
module POST
|
9
|
-
# rubocop:disable Metrics/MethodLength
|
10
10
|
def self.call(travis, url, **fields)
|
11
11
|
uri = URI( url.sub(/\?.*$/, '') )
|
12
12
|
req = Net::HTTP::Post.new(uri.request_uri)
|
@@ -26,6 +26,6 @@ module Trav3
|
|
26
26
|
RequestError.new(travis, response)
|
27
27
|
end
|
28
28
|
end
|
29
|
-
# rubocop:enable Metrics/MethodLength
|
30
29
|
end
|
31
30
|
end
|
31
|
+
# rubocop:enable Metrics/MethodLength
|
data/lib/trav3/version.rb
CHANGED