spage 0.2.0 → 0.3.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 35eb8fd43c5337e98c631c59eb397344965292b8a31b41e374f892e9ef78b5ad
4
- data.tar.gz: 789bb45f03127d6ffeda448880b9adf7a16f94511a49325c1ca9765c7ed2d9d9
3
+ metadata.gz: 5421a83cd6c6b4c844246c6b8c6bf02508bbef9c076bcf01cd1f7cfd84ca5c22
4
+ data.tar.gz: 90e6b9d8a6c2edad29db9629448b591a5c29557745edaece8ccc974992783fd8
5
5
  SHA512:
6
- metadata.gz: c55f9a3bfa318905236d38dd8eac141f78302a87d40686875921664183b72330126985af57ff66bbc7377f7c804b7a201dd877f3a09f5733c08fcd2d17284b25
7
- data.tar.gz: a56f9e1c53e87c1ed3bee822e194d760e319eb6f7d4a78b53da341adadf2305aff2c4687949f1b7af3b7261bb6dd999626c531382081f5c31fd16fd6caee00ba
6
+ metadata.gz: 828fe255b3d0296cf3d1a2e9e6aaeff4fa197c853dc01dc220898c3fb0985a2bcc3e0fa1a637acc705621a3df3ef02fef6baf6412c93eb3416f2f8bc6afa4f7b
7
+ data.tar.gz: 12ea7d1c3e3c65b8eaad820fbc003bb812af4db3d566d25f4918a7d2a4ccfd85455e882f66ecd49ad68de415b7da4e3e7fa2ad5e21c9e79820b78b721b3f9f6a
@@ -0,0 +1,25 @@
1
+ name: Publish Ruby Gem
2
+
3
+ # Publish the gem to RubyGems when the git tag is pushed
4
+ on:
5
+ push:
6
+ tags: 'v*'
7
+ jobs:
8
+ test:
9
+ uses: ./.github/workflows/reusable-test.yml
10
+ publish:
11
+ name: Publish to RubyGems
12
+ needs: test
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - run: |
17
+ mkdir -p $HOME/.gem
18
+ touch $HOME/.gem/credentials
19
+ chmod 0600 $HOME/.gem/credentials
20
+ printf -- "---\n:rubygems_api_key: ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials
21
+ echo "Running Successfully"
22
+ gem build *.gemspec
23
+ gem push *.gem
24
+ env:
25
+ GEM_HOST_API_KEY: "${{secrets.RUBYGEMS_AUTH_TOKEN}}"
@@ -0,0 +1,23 @@
1
+ name: Reusable Test Workflow
2
+
3
+ # This workflow runs when the branch is pushed/merged to master
4
+ # and when a PR is opened against master
5
+ on:
6
+ workflow_call:
7
+ jobs:
8
+ test:
9
+ name: Test
10
+ runs-on: ubuntu-latest
11
+ strategy:
12
+ matrix:
13
+ ruby: [2.6, 2.7, 3.0, 3.1, 3.2]
14
+ steps:
15
+ - uses: actions/checkout@v3
16
+ - name: Set up Ruby
17
+ uses: ruby/setup-ruby@v1
18
+ with:
19
+ ruby-version: ${{ matrix.ruby }}
20
+ - run: bundle install
21
+ name: Bundle
22
+ - run: bundle exec rspec
23
+ name: RSpec
@@ -0,0 +1,13 @@
1
+ name: Test
2
+
3
+ # This workflow runs when the branch is pushed/merged to master
4
+ # and when a PR is opened against master
5
+ on:
6
+ push:
7
+ branches: [ master ]
8
+ pull_request:
9
+ branches: [ master ]
10
+
11
+ jobs:
12
+ test:
13
+ uses: './.github/workflows/reusable-test.yml'
data/.rubocop.yml CHANGED
@@ -1,6 +1,8 @@
1
1
  Style/SymbolArray:
2
2
  Enabled: false
3
3
 
4
+ AllCops:
5
+ TargetRubyVersion: 2.6
4
6
  # Want to be able to assign config
5
7
  # without using =
6
8
  Style/TrivialAccessors:
data/CHANGELOG.md CHANGED
@@ -1,19 +1,32 @@
1
1
  # Changelog
2
2
 
3
- ## [v0.2.0](https://github.com/nulty/spage/tree/v0.2.0) (2020-11-01)
3
+ ## [Unreleased](https://github.com/nulty/spage/tree/HEAD)
4
4
 
5
- - Add CRUD Component API features
5
+ [Full Changelog](https://github.com/nulty/spage/compare/v0.2.0...v0.3.0)
6
6
 
7
+ **Merged pull requests:**
8
+
9
+ - Add gem publish workflow for GitHub Actions [\#6](https://github.com/nulty/spage/pull/6) ([nulty](https://github.com/nulty))
10
+ - Build against latest rubies [\#5](https://github.com/nulty/spage/pull/5) ([nulty](https://github.com/nulty))
11
+ - Add pagination to Incident and Component clients [\#4](https://github.com/nulty/spage/pull/4) ([nulty](https://github.com/nulty))
12
+ - Change ruby binary workflow [\#3](https://github.com/nulty/spage/pull/3) ([nulty](https://github.com/nulty))
13
+
14
+ ## [v0.2.0](https://github.com/nulty/spage/tree/v0.2.0) (2020-11-02)
15
+
16
+ [Full Changelog](https://github.com/nulty/spage/compare/v0.1.0...v0.2.0)
7
17
 
8
- \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
9
18
  ## [v0.1.0](https://github.com/nulty/spage/tree/v0.1.0) (2020-10-20)
10
19
 
11
- [Full Changelog](https://github.com/nulty/spage/compare/a0bab1b42c6762ceaaa448a100763ca57d5f3449...v0.1.0)
20
+ [Full Changelog](https://github.com/nulty/spage/compare/0.0.1...v0.1.0)
12
21
 
13
22
  **Merged pull requests:**
14
23
 
15
24
  - Rename project to Spage [\#1](https://github.com/nulty/spage/pull/1) ([nulty](https://github.com/nulty))
16
25
 
26
+ ## [0.0.1](https://github.com/nulty/spage/tree/0.0.1) (2020-10-20)
27
+
28
+ [Full Changelog](https://github.com/nulty/spage/compare/a0bab1b42c6762ceaaa448a100763ca57d5f3449...0.0.1)
29
+
17
30
 
18
31
 
19
32
  \* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/github-changelog-generator/github-changelog-generator)*
data/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # Spage
2
2
 
3
+ [![Gem Version](https://badge.fury.io/rb/spage.svg)](https://badge.fury.io/rb/spage)
4
+
3
5
  Spage is a Ruby client for integrating Statuspage.io into your ruby app. The idea is for it to be more than just a set of http requests to the server. It tries to model the data on the server for you so you don't have to.
4
6
 
5
7
  ## Installation
@@ -38,8 +40,8 @@ end
38
40
 
39
41
  ### Client
40
42
 
41
- `Spage::Api::Page.new.all` returns all the pages for your account
42
- `Spage::Api::Page.new.find(id)` returns a single page
43
+ `Spage::Api::Page.new.all` returns all the pages for your account \
44
+ `Spage::Api::Page.new.find(id)` returns a single page \
43
45
  `Spage::Api::Page.new.update(id, page)` updates the page
44
46
 
45
47
 
data/Rakefile CHANGED
@@ -1,6 +1,13 @@
1
- require "bundler/gem_tasks"
2
- require "rspec/core/rake_task"
1
+ require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+ require 'github_changelog_generator/task'
3
4
 
4
5
  RSpec::Core::RakeTask.new(:spec)
5
6
 
6
- task :default => :spec
7
+ task default: :spec
8
+
9
+ GitHubChangelogGenerator::RakeTask.new :changelog do |config|
10
+ config.user = 'nulty'
11
+ config.project = 'spage'
12
+ config.exclude_labels = %w[duplicate question invalid wontfix weekly-digest]
13
+ end
@@ -9,8 +9,8 @@ module Spage
9
9
  class Component
10
10
  include Api
11
11
 
12
- def all(page_id:)
13
- response = client.get("pages/#{page_id}/components")
12
+ def all(page_id:, per_page: 100, page: 1)
13
+ response = client.get("pages/#{page_id}/components", query: "per_page=#{per_page}&page=#{page}")
14
14
 
15
15
  handle_response(response) do
16
16
  response.body.map do |component|
@@ -9,8 +9,8 @@ module Spage
9
9
  class Incident
10
10
  include Api
11
11
 
12
- def all(page_id:)
13
- response = client.get("pages/#{page_id}/incidents")
12
+ def all(page_id:, per_page: 100, page: 1)
13
+ response = client.get("pages/#{page_id}/incidents", query: "per_page=#{per_page}&page=#{page}")
14
14
 
15
15
  handle_response(response) do
16
16
  response.body.map do |incident|
data/lib/spage/client.rb CHANGED
@@ -14,8 +14,8 @@ module Spage
14
14
  @api_version = Spage.config.api_version
15
15
  end
16
16
 
17
- def get(resource, id = nil)
18
- make_request(Net::HTTP::Get, resource, id)
17
+ def get(resource, id = nil, query: nil)
18
+ make_request(Net::HTTP::Get, resource, id, query: query)
19
19
  end
20
20
 
21
21
  def put(resource, id, body)
@@ -31,9 +31,9 @@ module Spage
31
31
  end
32
32
 
33
33
  # rubocop: disable Metrics/MethodLength, Metrics/AbcSize
34
- def make_request(http_method, resource, id, body = nil)
34
+ def make_request(http_method, resource, id, body = nil, query: nil)
35
35
  path = [@api_version, resource, id].compact.join('/')
36
- uri = URI::HTTP.build(host: BASE_URL, path: "/#{path}")
36
+ uri = URI::HTTP.build(host: BASE_URL, path: "/#{path}", query: query)
37
37
 
38
38
  request = http_method.new(uri)
39
39
  request.add_field('Authorization', "OAuth #{@api_key}")
data/lib/spage/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Spage
2
- VERSION = "0.2.0"
2
+ VERSION = "0.3.0"
3
3
  end
data/spage.gemspec CHANGED
@@ -12,7 +12,7 @@ Gem::Specification.new do |spec|
12
12
  spec.description = 'Ruby client for making requests the statuspage.io API'
13
13
  spec.homepage = 'https://github.com/nulty/spage'
14
14
  spec.license = 'MIT'
15
- spec.required_ruby_version = Gem::Requirement.new('>= 2.5.0')
15
+ spec.required_ruby_version = Gem::Requirement.new('>= 2.6.0')
16
16
 
17
17
  spec.metadata['homepage_uri'] = spec.homepage
18
18
  spec.metadata['source_code_uri'] = 'https://github.com/nulty/spage'
@@ -29,4 +29,5 @@ Gem::Specification.new do |spec|
29
29
  spec.add_development_dependency 'simplecov'
30
30
  spec.add_development_dependency 'vcr'
31
31
  spec.add_development_dependency 'webmock'
32
+ spec.add_development_dependency 'github_changelog_generator'
32
33
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: spage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Iain McNulty
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-11-02 00:00:00.000000000 Z
11
+ date: 2023-02-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: pry
@@ -66,6 +66,20 @@ dependencies:
66
66
  - - ">="
67
67
  - !ruby/object:Gem::Version
68
68
  version: '0'
69
+ - !ruby/object:Gem::Dependency
70
+ name: github_changelog_generator
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ">="
74
+ - !ruby/object:Gem::Version
75
+ version: '0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ">="
81
+ - !ruby/object:Gem::Version
82
+ version: '0'
69
83
  description: Ruby client for making requests the statuspage.io API
70
84
  email:
71
85
  - iain@inulty.com
@@ -73,10 +87,12 @@ executables: []
73
87
  extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
90
+ - ".github/workflows/gem-push.yml"
91
+ - ".github/workflows/reusable-test.yml"
92
+ - ".github/workflows/test.yml"
76
93
  - ".gitignore"
77
94
  - ".rspec"
78
95
  - ".rubocop.yml"
79
- - ".travis.yml"
80
96
  - CHANGELOG.md
81
97
  - Gemfile
82
98
  - LICENSE.txt
@@ -114,14 +130,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
114
130
  requirements:
115
131
  - - ">="
116
132
  - !ruby/object:Gem::Version
117
- version: 2.5.0
133
+ version: 2.6.0
118
134
  required_rubygems_version: !ruby/object:Gem::Requirement
119
135
  requirements:
120
136
  - - ">="
121
137
  - !ruby/object:Gem::Version
122
138
  version: '0'
123
139
  requirements: []
124
- rubygems_version: 3.0.3
140
+ rubygems_version: 3.3.5
125
141
  signing_key:
126
142
  specification_version: 4
127
143
  summary: Ruby client for using the statuspage.io API
data/.travis.yml DELETED
@@ -1,6 +0,0 @@
1
- ---
2
- language: ruby
3
- cache: bundler
4
- rvm:
5
- - 2.6.3
6
- before_install: gem install bundler -v 2.1.4