pixela 2.1.0 → 2.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: a3df84dc9f4591de4d69003caafb28e57d787a269dc70f9fed967d8787183579
4
- data.tar.gz: 0e23cf942470fd6cbec58c8df6d157bc3bdd045cc7438162b67d170a241d327d
3
+ metadata.gz: 9c101809b9328378863924ee2adc9aef94dd543cf93db7dc4f21e4916a02f5af
4
+ data.tar.gz: 89f280b63c454a27d90ef20762c3f6ccd0c7b2b724097bb9bdd762268e08b257
5
5
  SHA512:
6
- metadata.gz: d4abcca60067437ac06d9b6dc76b92bc10edf54eed1260412ab7570b8d18153d297908f7339bebe5fb41c91c1170bb636b6c8dd9791108201cea72035fca02c3
7
- data.tar.gz: 36f6d832bfaf3b7a470ec39ef365a261180a7b34fededd5d0e196322807f1aa811db23f643ac6c29d5de4e426f110096478f8414d12f343c2fa8ea7f23e195f5
6
+ metadata.gz: bfb71e70e9d65a5da0c60104dfbab46dbface426054adaf93cebb6e74104091c67994afe7268b2ad03c39fa0ba3218be758f8e6152bea468d81af0be29d4531b
7
+ data.tar.gz: 82845eee4380ffc77297f441a6acd5c37604a24d7f9522a52abb3b5d22e4b4cb847f2bad4429159c8768344878e31d443e0d5429b8cebc192d114319c8b24444
@@ -1,5 +1,15 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/pixela/compare/v2.1.0...master)
2
+ [full changelog](http://github.com/sue445/pixela/compare/v2.2.0...master)
3
+
4
+ ## v2.2.0
5
+ [full changelog](http://github.com/sue445/pixela/compare/v2.1.0...v2.2.0)
6
+
7
+ * Add `Pixela::Client#get_graph_def` and `Pixela::Graph#def`
8
+ * https://github.com/sue445/pixela/pull/83
9
+ * https://github.com/a-know/Pixela/releases/tag/v1.21.0
10
+ * Add `Pixela::Client#get_pixels` and `Pixela::Graph#pixels`
11
+ * https://github.com/sue445/pixela/pull/84
12
+ * https://github.com/a-know/Pixela/releases/tag/v1.21.0
3
13
 
4
14
  ## v2.1.0
5
15
  [full changelog](http://github.com/sue445/pixela/compare/v2.0.0...v2.1.0)
@@ -176,6 +176,32 @@ module Pixela::Client::GraphMethods
176
176
  res.pixels.map { |ymd| Date.parse(ymd) }
177
177
  end
178
178
 
179
+ # Get a Date list of Pixel registered in the graph specified by graphID.
180
+ #
181
+ # @param graph_id [String]
182
+ # @param from [Date] Specify the start position of the period.
183
+ # @param to [Date] Specify the end position of the period.
184
+ #
185
+ # @return [Array<Hashie::Mash>]
186
+ #
187
+ # @raise [Pixela::PixelaError] API is failed
188
+ #
189
+ # @see https://docs.pixe.la/entry/get-graph-pixels
190
+ #
191
+ # @example
192
+ # client.get_pixels(graph_id: "test-graph", from: Date.new(2018, 1, 1), to: Date.new(2018, 12, 31))
193
+ def get_pixels(graph_id:, from: nil, to: nil)
194
+ params = {
195
+ from: to_ymd(from),
196
+ to: to_ymd(to),
197
+ withBody: true,
198
+ }
199
+
200
+ with_error_handling do
201
+ connection.get("users/#{username}/graphs/#{graph_id}/pixels", params.compact).body.pixels
202
+ end
203
+ end
204
+
179
205
  # Based on the registered information, get various statistics.
180
206
  #
181
207
  # @param graph_id [String]
@@ -214,4 +240,22 @@ module Pixela::Client::GraphMethods
214
240
 
215
241
  alias_method :start_stopwatch, :run_stopwatch
216
242
  alias_method :end_stopwatch, :run_stopwatch
243
+
244
+ # Get a predefined pixelation graph definition.
245
+ #
246
+ # @param graph_id [String]
247
+ #
248
+ # @return [Pixela::Response]
249
+ #
250
+ # @raise [Pixela::PixelaError] API is failed
251
+ #
252
+ # @see https://docs.pixe.la/entry/get-a-graph-def
253
+ #
254
+ # @example
255
+ # client.get_graph_def(graph_id: "test-graph")
256
+ def get_graph_def(graph_id:)
257
+ with_error_handling do
258
+ connection.get("users/#{username}/graphs/#{graph_id}/graph-def").body
259
+ end
260
+ end
217
261
  end
@@ -149,6 +149,23 @@ module Pixela
149
149
  client.get_pixel_dates(graph_id: graph_id, from: from, to: to)
150
150
  end
151
151
 
152
+ # Get a Date list of Pixel registered in the graph specified by graphID.
153
+ #
154
+ # @param from [Date] Specify the start position of the period.
155
+ # @param to [Date] Specify the end position of the period.
156
+ #
157
+ # @return [Array<Hashie::Mash>]
158
+ #
159
+ # @raise [Pixela::PixelaError] API is failed
160
+ #
161
+ # @see https://docs.pixe.la/entry/get-graph-pixels
162
+ #
163
+ # @example
164
+ # client.graph("test-graph").pixels(from: Date.new(2018, 1, 1), to: Date.new(2018, 12, 31))
165
+ def pixels(from: nil, to: nil)
166
+ client.get_pixels(graph_id: graph_id, from: from, to: to)
167
+ end
168
+
152
169
  # Based on the registered information, get various statistics.
153
170
  #
154
171
  # @return [Pixela::Response]
@@ -179,5 +196,21 @@ module Pixela
179
196
 
180
197
  alias_method :start_stopwatch, :run_stopwatch
181
198
  alias_method :end_stopwatch, :run_stopwatch
199
+
200
+ # Get a predefined pixelation graph definition.
201
+ #
202
+ # @return [Pixela::Response]
203
+ #
204
+ # @raise [Pixela::PixelaError] API is failed
205
+ #
206
+ # @see https://docs.pixe.la/entry/get-a-graph-def
207
+ #
208
+ # @example
209
+ # client.graph("test-graph").def
210
+ def def
211
+ client.get_graph_def(graph_id: graph_id)
212
+ end
213
+
214
+ alias_method :definition, :def
182
215
  end
183
216
  end
@@ -1,3 +1,3 @@
1
1
  module Pixela
2
- VERSION = "2.1.0"
2
+ VERSION = "2.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: 2.1.0
4
+ version: 2.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-16 00:00:00.000000000 Z
11
+ date: 2020-11-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -262,7 +262,7 @@ metadata:
262
262
  homepage_uri: https://github.com/sue445/pixela
263
263
  source_code_uri: https://github.com/sue445/pixela
264
264
  changelog_uri: https://github.com/sue445/pixela/blob/master/CHANGELOG.md
265
- post_install_message:
265
+ post_install_message:
266
266
  rdoc_options: []
267
267
  require_paths:
268
268
  - lib
@@ -278,7 +278,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
278
278
  version: '0'
279
279
  requirements: []
280
280
  rubygems_version: 3.1.2
281
- signing_key:
281
+ signing_key:
282
282
  specification_version: 4
283
283
  summary: Pixela API client for Ruby
284
284
  test_files: []