pixela 3.0.0 → 3.1.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: 6eb158057d65be208480f8b727cc4dd4f140e8b181e1ac679db576572c4059f5
4
- data.tar.gz: 2dd2a0c983bbbedca697acd09f43dfe400010811982ab20a5b01b5f9dfb952b4
3
+ metadata.gz: '0758a0f7230d97159b28dc76c5a840bf60542c800e0cb3424315ceaae6e00daf'
4
+ data.tar.gz: 79b3d72e7d69c326f413d5c4810f9fcb4568be7aabc711135a3580754f349d09
5
5
  SHA512:
6
- metadata.gz: 2f7d11b7027cf125a407b7a162b7fd5a8e96849b82b59258dc2c7d23827921cc7ce848c776b0d4760bd6036953cc2566a71d18b79002d2f701933b4ec2f05797
7
- data.tar.gz: 554e82c827ee5de2d5909c883b320cbf2d8e32de2ec5fce43151290a4f6a240d82c769a321b56fa1a265052b6ed5395547fe4cb3db53ab4fcfad5a335566258e
6
+ metadata.gz: 523cfa26b5678985aeea71992d4d60b5816bcb64fc256b9420cc32c050b35b49ba532d567d39c66e9fe5008bdfa6c83efce1434b766e594d8e1a7e92ca2781f5
7
+ data.tar.gz: a804acd66cf17fac4387a987d5453989202e02f91b359fbd921a1c9638921f0c4f3ce60c6842b84fcde1d95cd1439ac50037bb1603a3d9e57201c99f53c5752b
@@ -0,0 +1,10 @@
1
+ # c.f. https://docs.github.com/en/code-security/dependabot/dependabot-version-updates/configuration-options-for-the-dependabot.yml-file
2
+ version: 2
3
+
4
+ updates:
5
+ - package-ecosystem: github-actions
6
+ directory: /
7
+ schedule:
8
+ interval: weekly
9
+ assignees:
10
+ - sue445
@@ -0,0 +1,62 @@
1
+ # Simple workflow for deploying static content to GitHub Pages
2
+ name: Deploy static content to Pages
3
+
4
+ on:
5
+ # Runs on pushes targeting the default branch
6
+ push:
7
+ branches:
8
+ - master
9
+
10
+ # Allows you to run this workflow manually from the Actions tab
11
+ workflow_dispatch:
12
+
13
+ # Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
14
+ permissions:
15
+ contents: read
16
+ pages: write
17
+ id-token: write
18
+
19
+ # Allow one concurrent deployment
20
+ concurrency:
21
+ group: "pages"
22
+ cancel-in-progress: true
23
+
24
+ jobs:
25
+ # Single deploy job since we're just deploying
26
+ deploy:
27
+ environment:
28
+ name: github-pages
29
+ url: ${{ steps.deployment.outputs.page_url }}
30
+ runs-on: ubuntu-latest
31
+ steps:
32
+ - name: Checkout
33
+ uses: actions/checkout@v3
34
+
35
+ - uses: ruby/setup-ruby@v1
36
+ with:
37
+ ruby-version: ruby
38
+ bundler-cache: true
39
+
40
+ - run: bundle exec yard
41
+
42
+ - name: Setup Pages
43
+ uses: actions/configure-pages@v3
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v1
46
+ with:
47
+ # Upload entire repository
48
+ path: './doc'
49
+ - name: Deploy to GitHub Pages
50
+ id: deployment
51
+ uses: actions/deploy-pages@main
52
+
53
+ - name: Slack Notification (not success)
54
+ uses: lazy-actions/slatify@master
55
+ if: "! success()"
56
+ continue-on-error: true
57
+ with:
58
+ job_name: "*pages*"
59
+ type: ${{ job.status }}
60
+ icon_emoji: ":octocat:"
61
+ url: ${{ secrets.SLACK_WEBHOOK }}
62
+ token: ${{ secrets.GITHUB_TOKEN }}
@@ -16,8 +16,6 @@ jobs:
16
16
  test:
17
17
  runs-on: ubuntu-latest
18
18
 
19
- container: ${{ matrix.ruby }}
20
-
21
19
  env:
22
20
  BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
23
21
 
@@ -26,36 +24,24 @@ jobs:
26
24
 
27
25
  matrix:
28
26
  ruby:
29
- - ruby:2.6
30
- - ruby:2.7
31
- - ruby:3.0
32
- - ruby:3.1
33
- - rubylang/ruby:master-nightly-bionic
27
+ - "2.6"
28
+ - "2.7"
29
+ - "3.0"
30
+ - "3.1"
31
+ - "3.2"
34
32
  gemfile:
35
33
  - faraday_2
36
- include:
37
- - ruby: rubylang/ruby:master-nightly-bionic
38
- allow_failures: "true"
39
34
 
40
35
  steps:
41
- - uses: actions/checkout@v2
36
+ - uses: actions/checkout@v3
42
37
 
43
- - name: Cache gemfiles/vendor/bundle
44
- uses: actions/cache@v1
45
- id: cache_gem
38
+ - uses: ruby/setup-ruby@v1
46
39
  with:
47
- path: gemfiles/vendor/bundle
48
- key: v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ matrix.gemfile }}-${{ github.sha }}
49
- restore-keys: |
50
- v1-gem-${{ runner.os }}-${{ matrix.ruby }}-${{ matrix.gemfile }}-
51
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
40
+ ruby-version: ${{ matrix.ruby }}
41
+ bundler-cache: true
42
+ cache-version: ${{ matrix.gemfile }}
52
43
 
53
- - name: bundle update
54
- run: |
55
- set -xe
56
- bundle config path vendor/bundle
57
- bundle update --jobs $(nproc) --retry 3
58
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
44
+ - run: bundle update --jobs $(nproc) --retry 3
59
45
 
60
46
  - name: Setup Code Climate Test Reporter
61
47
  uses: aktions/codeclimate-test-reporter@v1
@@ -64,11 +50,7 @@ jobs:
64
50
  command: before-build
65
51
  continue-on-error: true
66
52
 
67
- - name: Run test
68
- run: |
69
- set -xe
70
- bundle exec rspec
71
- continue-on-error: ${{ matrix.allow_failures == 'true' }}
53
+ - run: bundle exec rspec
72
54
 
73
55
  - name: Teardown Code Climate Test Reporter
74
56
  uses: aktions/codeclimate-test-reporter@v1
data/CHANGELOG.md CHANGED
@@ -1,10 +1,17 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/pixela/compare/v3.0.0...master)
2
+ [full changelog](http://github.com/sue445/pixela/compare/v3.1.0...master)
3
+
4
+ ## v3.1.0
5
+ [full changelog](http://github.com/sue445/pixela/compare/v3.0.0...v3.1.0)
6
+
7
+ * Add `Pixela::Client#add_pixel` and `Pixela::Client#subtract_pixel`
8
+ * https://github.com/sue445/pixela/pull/101
9
+ * https://github.com/a-know/Pixela/releases/tag/v1.26.0
3
10
 
4
11
  ## v3.0.0
5
12
  [full changelog](http://github.com/sue445/pixela/compare/v2.2.1...v3.0.0)
6
13
 
7
- * Support faraday v2+ and drop support ruby < 2.6
14
+ * :bomb: **[BREAKING CHANGE]** Support faraday v2+ and drop support ruby < 2.6
8
15
  * https://github.com/sue445/pixela/pull/91
9
16
 
10
17
  ## v2.2.1
data/Gemfile CHANGED
@@ -4,3 +4,5 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
4
4
 
5
5
  # Specify your gem's dependencies in pixela.gemspec
6
6
  gemspec
7
+
8
+ eval_gemfile "./gemfiles/common.gemfile"
data/README.md CHANGED
@@ -57,7 +57,7 @@ client.graph("test-graph").pixel(Date.today).create(quantity: 5)
57
57
 
58
58
  All methods are followings
59
59
 
60
- https://www.rubydoc.info/gems/pixela/Pixela/Client
60
+ https://sue445.github.io/pixela/Pixela/Client
61
61
 
62
62
  ## Configuration
63
63
  ```ruby
@@ -0,0 +1,4 @@
1
+ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.7.0")
2
+ # unparser v0.6.5+ requires ruby 2.7.0+
3
+ gem "unparser", "< 0.6.5"
4
+ end
@@ -5,4 +5,6 @@ git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
5
5
  # Specify your gem's dependencies in pixela.gemspec
6
6
  gemspec path: "../"
7
7
 
8
+ eval_gemfile "./common.gemfile"
9
+
8
10
  gem "faraday", "~> 2.0"
@@ -138,4 +138,50 @@ module Pixela::Client::PixelMethods
138
138
  connection.put("users/#{username}/graphs/#{graph_id}/decrement").body
139
139
  end
140
140
  end
141
+
142
+ # Add quantity to the "Pixel" of the day
143
+ #
144
+ # @param graph_id [String]
145
+ # @param quantity [String]
146
+ #
147
+ # @return [Pixela::Response]
148
+ #
149
+ # @raise [Pixela::PixelaError] API is failed
150
+ #
151
+ # @see https://docs.pixe.la/entry/add-pixel
152
+ #
153
+ # @example
154
+ # client.add_pixel(graph_id: "test-graph", quantity: "1")
155
+ def add_pixel(graph_id:, quantity:)
156
+ params = {
157
+ quantity: quantity.to_s,
158
+ }
159
+
160
+ with_error_handling do
161
+ connection.put("users/#{username}/graphs/#{graph_id}/add", params.compact).body
162
+ end
163
+ end
164
+
165
+ # Subtract quantity from the "Pixel" of the day
166
+ #
167
+ # @param graph_id [String]
168
+ # @param quantity [String]
169
+ #
170
+ # @return [Pixela::Response]
171
+ #
172
+ # @raise [Pixela::PixelaError] API is failed
173
+ #
174
+ # @see https://docs.pixe.la/entry/subtract-pixel
175
+ #
176
+ # @example
177
+ # client.subtract_pixel(graph_id: "test-graph", quantity: "1")
178
+ def subtract_pixel(graph_id:, quantity:)
179
+ params = {
180
+ quantity: quantity.to_s,
181
+ }
182
+
183
+ with_error_handling do
184
+ connection.put("users/#{username}/graphs/#{graph_id}/subtract", params.compact).body
185
+ end
186
+ end
141
187
  end
data/lib/pixela/graph.rb CHANGED
@@ -132,6 +132,38 @@ module Pixela
132
132
  client.decrement_pixel(graph_id: graph_id)
133
133
  end
134
134
 
135
+ # Add quantity to the "Pixel" of the day
136
+ #
137
+ # @param quantity [String]
138
+ #
139
+ # @return [Pixela::Response]
140
+ #
141
+ # @raise [Pixela::PixelaError] API is failed
142
+ #
143
+ # @see https://docs.pixe.la/entry/add-pixel
144
+ #
145
+ # @example
146
+ # client.graph("test-graph").add(quantity: "1")
147
+ def add(quantity:)
148
+ client.add_pixel(graph_id: graph_id, quantity: quantity)
149
+ end
150
+
151
+ # Subtract quantity from the "Pixel" of the day
152
+ #
153
+ # @param quantity [String]
154
+ #
155
+ # @return [Pixela::Response]
156
+ #
157
+ # @raise [Pixela::PixelaError] API is failed
158
+ #
159
+ # @see https://docs.pixe.la/entry/subtract-pixel
160
+ #
161
+ # @example
162
+ # client.graph("test-graph").subtract(quantity: "1")
163
+ def subtract(quantity:)
164
+ client.subtract_pixel(graph_id: graph_id, quantity: quantity)
165
+ end
166
+
135
167
  # Get a Date list of Pixel registered in the graph specified by graphID.
136
168
  #
137
169
  # @param from [Date] Specify the start position of the period.
@@ -1,3 +1,3 @@
1
1
  module Pixela
2
- VERSION = "3.0.0"
2
+ VERSION = "3.1.0"
3
3
  end
data/pixela.gemspec CHANGED
@@ -14,17 +14,11 @@ Gem::Specification.new do |spec|
14
14
  spec.homepage = "https://github.com/sue445/pixela"
15
15
  spec.license = "MIT"
16
16
 
17
- # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
18
- # to allow pushing to a single host or delete this section to allow pushing to any host.
19
- if spec.respond_to?(:metadata)
20
- spec.metadata["homepage_uri"] = spec.homepage
21
- spec.metadata["source_code_uri"] = spec.homepage
22
- spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/CHANGELOG.md"
23
- spec.metadata["rubygems_mfa_required"] = "true"
24
- else
25
- raise "RubyGems 2.0 or newer is required to protect against " \
26
- "public gem pushes."
27
- end
17
+ spec.metadata["homepage_uri"] = spec.homepage
18
+ spec.metadata["source_code_uri"] = spec.homepage
19
+ spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/CHANGELOG.md"
20
+ spec.metadata["documentation_uri"] = "https://sue445.github.io/pixela/"
21
+ spec.metadata["rubygems_mfa_required"] = "true"
28
22
 
29
23
  # Specify which files should be added to the gem when it is released.
30
24
  # The `git ls-files -z` loads the files in the RubyGem that have been added into git.
@@ -42,7 +36,7 @@ Gem::Specification.new do |spec|
42
36
  spec.add_dependency "faraday-mashify"
43
37
 
44
38
  spec.add_development_dependency "bundler", ">= 1.16"
45
- spec.add_development_dependency "coveralls"
39
+ spec.add_development_dependency "coveralls_reborn"
46
40
  spec.add_development_dependency "dotenv"
47
41
  spec.add_development_dependency "rake", ">= 10.0"
48
42
  spec.add_development_dependency "rspec", "~> 3.0"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pixela
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-08 00:00:00.000000000 Z
11
+ date: 2023-03-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -67,7 +67,7 @@ dependencies:
67
67
  - !ruby/object:Gem::Version
68
68
  version: '1.16'
69
69
  - !ruby/object:Gem::Dependency
70
- name: coveralls
70
+ name: coveralls_reborn
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
73
  - - ">="
@@ -215,6 +215,8 @@ extra_rdoc_files: []
215
215
  files:
216
216
  - ".coveralls.yml"
217
217
  - ".env.example"
218
+ - ".github/dependabot.yml"
219
+ - ".github/workflows/pages.yml"
218
220
  - ".github/workflows/test.yml"
219
221
  - ".gitignore"
220
222
  - ".rspec"
@@ -226,6 +228,7 @@ files:
226
228
  - Rakefile
227
229
  - bin/console
228
230
  - bin/setup
231
+ - gemfiles/common.gemfile
229
232
  - gemfiles/faraday_2.gemfile
230
233
  - lib/pixela.rb
231
234
  - lib/pixela/client.rb
@@ -248,6 +251,7 @@ metadata:
248
251
  homepage_uri: https://github.com/sue445/pixela
249
252
  source_code_uri: https://github.com/sue445/pixela
250
253
  changelog_uri: https://github.com/sue445/pixela/blob/master/CHANGELOG.md
254
+ documentation_uri: https://sue445.github.io/pixela/
251
255
  rubygems_mfa_required: 'true'
252
256
  post_install_message:
253
257
  rdoc_options: []
@@ -264,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
264
268
  - !ruby/object:Gem::Version
265
269
  version: '0'
266
270
  requirements: []
267
- rubygems_version: 3.3.3
271
+ rubygems_version: 3.4.6
268
272
  signing_key:
269
273
  specification_version: 4
270
274
  summary: Pixela API client for Ruby