bitrise-client 0.3.0 → 0.3.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f15cf920657bd0d807ef0a92126a5acb6d6b6a506eef4052f0b39bc2ab89900
4
- data.tar.gz: 2baa2c6b0f2016b177cbb421542648d48e1a78d0109d7e9b5fe769bc313db278
3
+ metadata.gz: b7821748e7f74345830c188a95a15773c11d839e6b2d66357f6d1d581e3beb5d
4
+ data.tar.gz: 595fc5c50c502a0918a48f4687efceb24614e5a82245dad71df149a3754ac9bf
5
5
  SHA512:
6
- metadata.gz: 77e6523d02be774fde5e19ae4e969641869bb2291fe8c9972b4bf6d219676f7f66d4d17a0a492160bda7267080264258386ed55f6bee2aed4b333153bda2242c
7
- data.tar.gz: 104a524aa88ed749f6ed5e62365e7583d70aecff509dfffcc888f201676d9f4cfc771473f899d322ffed2909b02ff50445dc06bf879ae3b9e419c50c06124bb0
6
+ metadata.gz: 8f6ae368b2311fbebb562524c70ff98e264325281d3eceb7e9bc9da1e4969667f5f0cff52996d980ee4a00d2a657752261eef445b50a0c75924e2804264a2eb6
7
+ data.tar.gz: cee9d446ca68da58390492ba316734e4f626638204497ccbda6ae7481b77d75e99569536b42056a67e0c6f5cbbb99f7f4f9efbea86fc894bea9adf17f9f8c69c
@@ -1,9 +1,10 @@
1
1
  name: Test
2
2
 
3
3
  on:
4
+ pull_request:
4
5
  push:
5
6
  branches:
6
- - "**"
7
+ - develop
7
8
 
8
9
  concurrency:
9
10
  group: ${{ github.ref }}
@@ -16,7 +17,7 @@ jobs:
16
17
  matrix:
17
18
  ruby-version: [head, 3.0, 2.7]
18
19
  steps:
19
- - uses: actions/checkout@v2
20
+ - uses: actions/checkout@v3
20
21
  - name: Set up Ruby
21
22
  uses: ruby/setup-ruby@v1
22
23
  with:
data/CHANGELOG.md CHANGED
@@ -1,6 +1,10 @@
1
+ ## v0.3.1
2
+
3
+ Add GET apps. - [@tomorrowkey](https://github.com/tomorrowkey) [#6](https://github.com/mataku/bitrise-client/pull/6)
4
+
1
5
  ## v0.3.0
2
6
 
3
- Lock faraday version to 1.X because `Faraday::Response::Middleware` is deleted in faraday 2. - [tomorrowkey](https://github.com/tomorrowkey) [#5](https://github.com/mataku/bitrise-client/pull/5)
7
+ Lock faraday version to 1.X because `Faraday::Response::Middleware` is deleted in faraday 2. - [@tomorrowkey](https://github.com/tomorrowkey) [#5](https://github.com/mataku/bitrise-client/pull/5)
4
8
 
5
9
  ## v0.2.0
6
10
 
data/README.md CHANGED
@@ -2,7 +2,11 @@
2
2
 
3
3
  A ruby client for [Bitrise API](https://devcenter.bitrise.io/#bitrise-api).
4
4
 
5
- Now supports v0.1 [Build Trigger API](https://devcenter.bitrise.io/api/build-trigger/) and [Test Devices](https://devcenter.bitrise.io/en/api/api-reference.html#operations-tag-test-devices) only.
5
+ Now supports following APIs.
6
+
7
+ - [Build Trigger](https://devcenter.bitrise.io/api/build-trigger/)
8
+ - [Get Test Devices](https://devcenter.bitrise.io/en/api/api-reference.html#operations-tag-test-devices)
9
+ - [Get Apps](https://devcenter.bitrise.io/en/api/api-reference.html)
6
10
 
7
11
  ## Installation
8
12
 
@@ -41,4 +41,5 @@ Gem::Specification.new do |spec|
41
41
  spec.add_development_dependency "irb"
42
42
  spec.add_development_dependency "rake"
43
43
  spec.add_development_dependency "rspec"
44
+ spec.add_development_dependency "webmock"
44
45
  end
@@ -0,0 +1,34 @@
1
+ require "bitrise/response"
2
+ require "bitrise/app_owner"
3
+
4
+ module Bitrise
5
+ class AppResponse < Response
6
+ include Pagination
7
+
8
+ def data
9
+ @json.fetch("data")&.map do |raw|
10
+ App.new(raw)
11
+ end
12
+ end
13
+ end
14
+
15
+ class App
16
+ attr_reader :slug, :title, :project_type, :provider, :repo_owner, :repo_url, :repo_slug, :is_disabled, :status, :is_public, :is_github_checks_enabled, :owner, :avatar_url
17
+
18
+ def initialize(attrs = {})
19
+ @slug = attrs['slug']
20
+ @title = attrs['title']
21
+ @project_type = attrs['project_type']
22
+ @provider = attrs['provider']
23
+ @repo_owner = attrs['repo_owner']
24
+ @repo_url = attrs['repo_url']
25
+ @repo_slug = attrs['repo_slug']
26
+ @is_disabled = attrs['is_disabled']
27
+ @status = attrs['status']
28
+ @is_public = attrs['is_public']
29
+ @is_github_checks_enabled = attrs['is_github_checks_enabled']
30
+ @owner = AppOwner.new(attrs['owner'])
31
+ @avatar_url = attrs['avatar_url']
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,11 @@
1
+ module Bitrise
2
+ class AppOwner
3
+ attr_reader :account_type, :name, :slug
4
+
5
+ def initialize(attrs = {})
6
+ @account_type = attrs['account_type']
7
+ @name = attrs['name']
8
+ @slug = attrs['slug']
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,32 @@
1
+ require 'bitrise/app'
2
+ require 'json'
3
+
4
+ module Bitrise
5
+ class Client
6
+ module App
7
+
8
+ # List all the apps available for the authenticated account, including those that are owned by other users or Organizations.
9
+ #
10
+ # @param sort_by [String] Order of the applications: sort them based on when they were created or the time of their last build
11
+ # Available values : last_build_at, created_at
12
+ # @param next [String] Slug of the first app in the response
13
+ # @param limit [Integer] Max number of elements per page (default: 50)
14
+ #
15
+ # @return [App]
16
+ def apps(sort_by: nil, _next: nil, limit: nil)
17
+ response = client.get do |request|
18
+ request.url "/v0.1/apps"
19
+ request.params = {
20
+ sort_by: sort_by,
21
+ next: _next,
22
+ limit: limit,
23
+ }.compact
24
+ request.headers['Content-Type'] = 'application/json'
25
+ end
26
+
27
+ result = JSON.parse(response.body)
28
+ AppResponse.new(result)
29
+ end
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  module Bitrise
2
2
  class Client
3
- VERSION = "0.3.0"
3
+ VERSION = "0.3.1"
4
4
  end
5
5
  end
@@ -1,4 +1,5 @@
1
1
  %w(
2
+ bitrise/client/app
2
3
  bitrise/client/build
3
4
  bitrise/client/test_device
4
5
  bitrise/client/middleware/error_handler
@@ -9,6 +10,7 @@ end
9
10
 
10
11
  module Bitrise
11
12
  class Client
13
+ include Bitrise::Client::App
12
14
  include Bitrise::Client::Build
13
15
  include Bitrise::Client::TestDevice
14
16
 
@@ -0,0 +1,23 @@
1
+ module Bitrise
2
+ class Response
3
+ def initialize(json)
4
+ @json = json
5
+ end
6
+ end
7
+
8
+ class Paging
9
+ attr_reader :total_item_count, :page_item_limit, :next
10
+
11
+ def initialize(attrs = {})
12
+ @total_item_count = attrs['total_item_count']
13
+ @page_item_limit = attrs['page_item_limit']
14
+ @next = attrs['next']
15
+ end
16
+ end
17
+
18
+ module Pagination
19
+ def paging
20
+ ::Bitrise::Paging.new(@json["paging"])
21
+ end
22
+ end
23
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitrise-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.3.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - mataku
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-06-28 00:00:00.000000000 Z
11
+ date: 2022-07-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -80,6 +80,20 @@ dependencies:
80
80
  - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: webmock
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ">="
88
+ - !ruby/object:Gem::Version
89
+ version: '0'
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ">="
95
+ - !ruby/object:Gem::Version
96
+ version: '0'
83
97
  description: A ruby client for Bitrise API
84
98
  email:
85
99
  - nagomimatcha@gmail.com
@@ -99,13 +113,17 @@ files:
99
113
  - bin/setup
100
114
  - bitrise-client.gemspec
101
115
  - lib/bitrise.rb
116
+ - lib/bitrise/app.rb
117
+ - lib/bitrise/app_owner.rb
102
118
  - lib/bitrise/build_trigger_result.rb
103
119
  - lib/bitrise/client.rb
120
+ - lib/bitrise/client/app.rb
104
121
  - lib/bitrise/client/build.rb
105
122
  - lib/bitrise/client/middleware/error_handler.rb
106
123
  - lib/bitrise/client/test_device.rb
107
124
  - lib/bitrise/client/version.rb
108
125
  - lib/bitrise/error.rb
126
+ - lib/bitrise/response.rb
109
127
  - lib/bitrise/test_device.rb
110
128
  homepage: https://github.com/mataku/bitrise-client
111
129
  licenses: