pixela 3.0.0 → 3.2.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: 8a336057a8b3d607b5bdce6259191278d1338995b5a68f3d44551bba1c3918fa
4
+ data.tar.gz: c63183b4a8484f6ac55841ef1362d103ab1e1aeeece0714f364c299239bd3872
5
5
  SHA512:
6
- metadata.gz: 2f7d11b7027cf125a407b7a162b7fd5a8e96849b82b59258dc2c7d23827921cc7ce848c776b0d4760bd6036953cc2566a71d18b79002d2f701933b4ec2f05797
7
- data.tar.gz: 554e82c827ee5de2d5909c883b320cbf2d8e32de2ec5fce43151290a4f6a240d82c769a321b56fa1a265052b6ed5395547fe4cb3db53ab4fcfad5a335566258e
6
+ metadata.gz: b3c14c121dd2df7e48f7f40d9639387685aca2e9925bf88af1803caf7941ce17ca89861615221b55ad7caed22cefe5eec908d953a0542988c814c6e8d50ef3f3
7
+ data.tar.gz: 80967736967c85edb89f6acfb41a713bd594e93f01874a1ddd9e7980ee6726e787297c7b0aa41944602b078227e5cfc5aa303137f12027944ff7c4c42bed05fb
@@ -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@v4
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@v4
44
+ - name: Upload artifact
45
+ uses: actions/upload-pages-artifact@v2
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@v4
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,24 @@
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.2.0...master)
3
+
4
+ ## v3.2.0
5
+ [full changelog](http://github.com/sue445/pixela/compare/v3.1.0...v3.2.0)
6
+
7
+ * Add Impl `Pixela::Client::PixelMethods#create_pixels` and `Pixela::Pixel#create_multi`
8
+ * https://github.com/sue445/pixela/pull/105
9
+ * https://github.com/a-know/Pixela/releases/tag/v1.28.0
10
+
11
+ ## v3.1.0
12
+ [full changelog](http://github.com/sue445/pixela/compare/v3.0.0...v3.1.0)
13
+
14
+ * Add `Pixela::Client#add_pixel` and `Pixela::Client#subtract_pixel`
15
+ * https://github.com/sue445/pixela/pull/101
16
+ * https://github.com/a-know/Pixela/releases/tag/v1.26.0
3
17
 
4
18
  ## v3.0.0
5
19
  [full changelog](http://github.com/sue445/pixela/compare/v2.2.1...v3.0.0)
6
20
 
7
- * Support faraday v2+ and drop support ruby < 2.6
21
+ * :bomb: **[BREAKING CHANGE]** Support faraday v2+ and drop support ruby < 2.6
8
22
  * https://github.com/sue445/pixela/pull/91
9
23
 
10
24
  ## 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"
@@ -26,6 +26,33 @@ module Pixela::Client::PixelMethods
26
26
  end
27
27
  end
28
28
 
29
+ # This API is used to register multiple Pixels (quantities for a specific day) at a time.
30
+ #
31
+ # @param graph_id [String]
32
+ # @param pixels [Array<Hash>] key: date, quantity, optional_data
33
+ #
34
+ # @return [Pixela::Response]
35
+ #
36
+ # @raise [Pixela::PixelaError] API is failed
37
+ #
38
+ # @see https://docs.pixe.la/entry/batch-post-pixels
39
+ #
40
+ # @example
41
+ # client.create_pixels(graph_id: "test-graph", pixels: [{date: Date.new(2018, 9, 15), quantity: 5, optional_data: {key: "value"}}])
42
+ def create_pixels(graph_id:, pixels:)
43
+ pixels = pixels.map do |pixel|
44
+ {
45
+ date: to_ymd(pixel[:date]),
46
+ quantity: pixel[:quantity].to_s,
47
+ optionalData: pixel[:optional_data]&.to_json,
48
+ }.compact
49
+ end
50
+
51
+ with_error_handling do
52
+ connection.post("users/#{username}/graphs/#{graph_id}/pixels", pixels).body
53
+ end
54
+ end
55
+
29
56
  # Get registered quantity as "Pixel".
30
57
  #
31
58
  # @param graph_id [String]
@@ -138,4 +165,50 @@ module Pixela::Client::PixelMethods
138
165
  connection.put("users/#{username}/graphs/#{graph_id}/decrement").body
139
166
  end
140
167
  end
168
+
169
+ # Add quantity to the "Pixel" of the day
170
+ #
171
+ # @param graph_id [String]
172
+ # @param quantity [String]
173
+ #
174
+ # @return [Pixela::Response]
175
+ #
176
+ # @raise [Pixela::PixelaError] API is failed
177
+ #
178
+ # @see https://docs.pixe.la/entry/add-pixel
179
+ #
180
+ # @example
181
+ # client.add_pixel(graph_id: "test-graph", quantity: "1")
182
+ def add_pixel(graph_id:, quantity:)
183
+ params = {
184
+ quantity: quantity.to_s,
185
+ }
186
+
187
+ with_error_handling do
188
+ connection.put("users/#{username}/graphs/#{graph_id}/add", params.compact).body
189
+ end
190
+ end
191
+
192
+ # Subtract quantity from the "Pixel" of the day
193
+ #
194
+ # @param graph_id [String]
195
+ # @param quantity [String]
196
+ #
197
+ # @return [Pixela::Response]
198
+ #
199
+ # @raise [Pixela::PixelaError] API is failed
200
+ #
201
+ # @see https://docs.pixe.la/entry/subtract-pixel
202
+ #
203
+ # @example
204
+ # client.subtract_pixel(graph_id: "test-graph", quantity: "1")
205
+ def subtract_pixel(graph_id:, quantity:)
206
+ params = {
207
+ quantity: quantity.to_s,
208
+ }
209
+
210
+ with_error_handling do
211
+ connection.put("users/#{username}/graphs/#{graph_id}/subtract", params.compact).body
212
+ end
213
+ end
141
214
  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.
data/lib/pixela/pixel.rb CHANGED
@@ -38,6 +38,22 @@ module Pixela
38
38
  client.create_pixel(graph_id: graph_id, date: date, quantity: quantity, optional_data: optional_data)
39
39
  end
40
40
 
41
+ # This API is used to register multiple Pixels (quantities for a specific day) at a time.
42
+ #
43
+ # @param pixels [Array<Hash>] key: date, quantity, optional_data
44
+ #
45
+ # @return [Pixela::Response]
46
+ #
47
+ # @raise [Pixela::PixelaError] API is failed
48
+ #
49
+ # @see https://docs.pixe.la/entry/batch-post-pixels
50
+ #
51
+ # @example
52
+ # client.graph("test-graph").create_multi(pixels: [{date: Date.new(2018, 9, 15), quantity: 5, optional_data: {key: "value"}}])
53
+ def create_multi(pixels:)
54
+ client.create_pixels(graph_id: graph_id, pixels: pixels)
55
+ end
56
+
41
57
  # Get registered quantity as "Pixel".
42
58
  #
43
59
  # @return [Pixela::Response]
@@ -1,3 +1,3 @@
1
1
  module Pixela
2
- VERSION = "3.0.0"
2
+ VERSION = "3.2.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.2.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-12-24 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.10
268
272
  signing_key:
269
273
  specification_version: 4
270
274
  summary: Pixela API client for Ruby