pixela 3.1.0 → 3.2.0

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: '0758a0f7230d97159b28dc76c5a840bf60542c800e0cb3424315ceaae6e00daf'
4
- data.tar.gz: 79b3d72e7d69c326f413d5c4810f9fcb4568be7aabc711135a3580754f349d09
3
+ metadata.gz: 8a336057a8b3d607b5bdce6259191278d1338995b5a68f3d44551bba1c3918fa
4
+ data.tar.gz: c63183b4a8484f6ac55841ef1362d103ab1e1aeeece0714f364c299239bd3872
5
5
  SHA512:
6
- metadata.gz: 523cfa26b5678985aeea71992d4d60b5816bcb64fc256b9420cc32c050b35b49ba532d567d39c66e9fe5008bdfa6c83efce1434b766e594d8e1a7e92ca2781f5
7
- data.tar.gz: a804acd66cf17fac4387a987d5453989202e02f91b359fbd921a1c9638921f0c4f3ce60c6842b84fcde1d95cd1439ac50037bb1603a3d9e57201c99f53c5752b
6
+ metadata.gz: b3c14c121dd2df7e48f7f40d9639387685aca2e9925bf88af1803caf7941ce17ca89861615221b55ad7caed22cefe5eec908d953a0542988c814c6e8d50ef3f3
7
+ data.tar.gz: 80967736967c85edb89f6acfb41a713bd594e93f01874a1ddd9e7980ee6726e787297c7b0aa41944602b078227e5cfc5aa303137f12027944ff7c4c42bed05fb
@@ -30,7 +30,7 @@ jobs:
30
30
  runs-on: ubuntu-latest
31
31
  steps:
32
32
  - name: Checkout
33
- uses: actions/checkout@v3
33
+ uses: actions/checkout@v4
34
34
 
35
35
  - uses: ruby/setup-ruby@v1
36
36
  with:
@@ -40,9 +40,9 @@ jobs:
40
40
  - run: bundle exec yard
41
41
 
42
42
  - name: Setup Pages
43
- uses: actions/configure-pages@v3
43
+ uses: actions/configure-pages@v4
44
44
  - name: Upload artifact
45
- uses: actions/upload-pages-artifact@v1
45
+ uses: actions/upload-pages-artifact@v2
46
46
  with:
47
47
  # Upload entire repository
48
48
  path: './doc'
@@ -33,7 +33,7 @@ jobs:
33
33
  - faraday_2
34
34
 
35
35
  steps:
36
- - uses: actions/checkout@v3
36
+ - uses: actions/checkout@v4
37
37
 
38
38
  - uses: ruby/setup-ruby@v1
39
39
  with:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,12 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/pixela/compare/v3.1.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
3
10
 
4
11
  ## v3.1.0
5
12
  [full changelog](http://github.com/sue445/pixela/compare/v3.0.0...v3.1.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]
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.1.0"
2
+ VERSION = "3.2.0"
3
3
  end
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.1.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: 2023-03-20 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
@@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
268
268
  - !ruby/object:Gem::Version
269
269
  version: '0'
270
270
  requirements: []
271
- rubygems_version: 3.4.6
271
+ rubygems_version: 3.4.10
272
272
  signing_key:
273
273
  specification_version: 4
274
274
  summary: Pixela API client for Ruby