pixela 3.3.0 → 3.5.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 +4 -4
- data/.github/workflows/test.yml +1 -0
- data/CHANGELOG.md +15 -1
- data/README.md +1 -1
- data/gemfiles/common.gemfile +5 -0
- data/lib/pixela/client/graph_methods.rb +34 -4
- data/lib/pixela/graph.rb +23 -4
- data/lib/pixela/version.rb +1 -1
- data/pixela.gemspec +1 -0
- metadata +17 -6
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2294c4ab50d90e3081e699ad2c99b33b7a8e4c37e271fe061e45433910508080
|
4
|
+
data.tar.gz: 1421993d12f16a5243526cefa580a06a9c3415385297055af0223510c72bb095
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d35da5fef54b3493635999a382ccb473af3e98e46dee0f014f3dfbcf99eeae4068e8d25a81523ccf525661e94139ab0755b9768ce11be84db8d921c9e9d2757e
|
7
|
+
data.tar.gz: 907b8a988c388f3a40656173441e9f3727cbb869c8723313d4bbcb00c44b149a7e18d5a0a6ffd26ff0a5d90d429e69a694b1fb45093a2b17c0af03bdbd5436b8
|
data/.github/workflows/test.yml
CHANGED
data/CHANGELOG.md
CHANGED
@@ -1,5 +1,19 @@
|
|
1
1
|
## Unreleased
|
2
|
-
[full changelog](http://github.com/sue445/pixela/compare/v3.
|
2
|
+
[full changelog](http://github.com/sue445/pixela/compare/v3.5.0...master)
|
3
|
+
|
4
|
+
## [v3.5.0](https://github.com/sue445/pixela/releases/tag/v3.5.0)
|
5
|
+
[full changelog](http://github.com/sue445/pixela/compare/v3.4.0...v3.5.0)
|
6
|
+
|
7
|
+
* Add `Pixela::Client::GraphMethods#get_graph_today` and `Pixela::Graph#today`
|
8
|
+
* https://github.com/sue445/pixela/pull/117
|
9
|
+
* https://github.com/a-know/Pixela/releases/tag/v1.32.0
|
10
|
+
|
11
|
+
## [v3.4.0](https://github.com/sue445/pixela/releases/tag/v3.4.0)
|
12
|
+
[full changelog](http://github.com/sue445/pixela/compare/v3.3.0...v3.4.0)
|
13
|
+
|
14
|
+
* Add `appearance`, `less_than` and `greather_than` to `Pixela::Client::GraphMethods#graph_url` and `Pixela::Graph#url`
|
15
|
+
* https://github.com/sue445/pixela/pull/115
|
16
|
+
* https://github.com/a-know/Pixela/releases/tag/v1.30.0
|
3
17
|
|
4
18
|
## v3.3.0
|
5
19
|
[full changelog](http://github.com/sue445/pixela/compare/v3.2.0...v3.3.0)
|
data/README.md
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
[](https://badge.fury.io/rb/pixela)
|
6
6
|
[](https://pixe.la/v1/users/sue445/graphs/pixela-gem-ci.html)
|
7
|
-
[](https://github.com/sue445/pixela/actions/workflows/test.yml)
|
8
8
|
[](https://codeclimate.com/github/sue445/pixela/maintainability)
|
9
9
|
[](https://coveralls.io/github/sue445/pixela)
|
10
10
|
|
data/gemfiles/common.gemfile
CHANGED
@@ -2,3 +2,8 @@ if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.7.0")
|
|
2
2
|
# unparser v0.6.5+ requires ruby 2.7.0+
|
3
3
|
gem "unparser", "< 0.6.5"
|
4
4
|
end
|
5
|
+
|
6
|
+
if Gem::Version.create(RUBY_VERSION) < Gem::Version.create("2.7.0")
|
7
|
+
# term-ansicolor 1.9.0+ doesn't work on Ruby < 2.7
|
8
|
+
gem "term-ansicolor", "< 1.9.0"
|
9
|
+
end
|
@@ -55,9 +55,12 @@ module Pixela::Client::GraphMethods
|
|
55
55
|
|
56
56
|
# Get graph url
|
57
57
|
#
|
58
|
-
# @param graph_id
|
59
|
-
# @param date
|
60
|
-
# @param mode
|
58
|
+
# @param graph_id [String]
|
59
|
+
# @param date [Date,Time]
|
60
|
+
# @param mode [String] e.g) `short`
|
61
|
+
# @param appearance [String] e.g) `dark`
|
62
|
+
# @param less_than [String]
|
63
|
+
# @param greater_than [String]
|
61
64
|
#
|
62
65
|
# @return [String]
|
63
66
|
#
|
@@ -66,12 +69,15 @@ module Pixela::Client::GraphMethods
|
|
66
69
|
# @example
|
67
70
|
# client.graph_url(graph_id: "test-graph")
|
68
71
|
# client.graph_url(graph_id: "test-graph", date: Date.new(2018, 3, 31), mode: "short")
|
69
|
-
def graph_url(graph_id:, date: nil, mode: nil)
|
72
|
+
def graph_url(graph_id:, date: nil, mode: nil, appearance: nil, less_than: nil, greater_than: nil)
|
70
73
|
url = "#{Pixela::Client::API_ENDPOINT}/users/#{username}/graphs/#{graph_id}"
|
71
74
|
|
72
75
|
params = Faraday::Utils::ParamsHash.new
|
73
76
|
params[:date] = to_ymd(date) if date
|
74
77
|
params[:mode] = mode if mode
|
78
|
+
params[:appearance] = appearance if appearance
|
79
|
+
params[:lessThan] = less_than if less_than
|
80
|
+
params[:greaterThan] = greater_than if greater_than
|
75
81
|
|
76
82
|
url << "?#{params.to_query}" unless params.empty?
|
77
83
|
|
@@ -276,4 +282,28 @@ module Pixela::Client::GraphMethods
|
|
276
282
|
connection.get("users/#{username}/graphs/#{graph_id}/latest").body
|
277
283
|
end
|
278
284
|
end
|
285
|
+
|
286
|
+
# This is an endpoint that responds with the Pixel of the day you requested this API.
|
287
|
+
#
|
288
|
+
# @param graph_id [String]
|
289
|
+
# @param return_empty [Boolean] Specifying `true` for this param will return an empty Pixel instead of `404 Not Found` if the Pixel is unregistered on the day of the request.
|
290
|
+
#
|
291
|
+
# @return [Pixela::Response]
|
292
|
+
#
|
293
|
+
# @raise [Pixela::PixelaError] API is failed
|
294
|
+
#
|
295
|
+
# @see https://docs.pixe.la/entry/get-today-pixel
|
296
|
+
#
|
297
|
+
# @example
|
298
|
+
# client.get_graph_today(graph_id: "test-graph", return_empty: true)
|
299
|
+
def get_graph_today(graph_id:, return_empty: false)
|
300
|
+
params = {}
|
301
|
+
if return_empty
|
302
|
+
params[:returnEmpty] = return_empty
|
303
|
+
end
|
304
|
+
|
305
|
+
with_error_handling do
|
306
|
+
connection.get("users/#{username}/graphs/#{graph_id}/today", params.compact).body
|
307
|
+
end
|
308
|
+
end
|
279
309
|
end
|
data/lib/pixela/graph.rb
CHANGED
@@ -50,8 +50,11 @@ module Pixela
|
|
50
50
|
|
51
51
|
# Get graph url
|
52
52
|
#
|
53
|
-
# @param date
|
54
|
-
# @param mode
|
53
|
+
# @param date [Date,Time]
|
54
|
+
# @param mode [String] e.g) `short`
|
55
|
+
# @param appearance [String] e.g) `dark`
|
56
|
+
# @param less_than [String]
|
57
|
+
# @param greater_than [String]
|
55
58
|
#
|
56
59
|
# @return [String]
|
57
60
|
#
|
@@ -60,8 +63,8 @@ module Pixela
|
|
60
63
|
# @example
|
61
64
|
# client.graph("test-graph").url
|
62
65
|
# client.graph("test-graph").url(date: Date.new(2018, 3, 31), mode: "short")
|
63
|
-
def url(date: nil, mode: nil)
|
64
|
-
client.graph_url(graph_id: graph_id, date: date, mode: mode)
|
66
|
+
def url(date: nil, mode: nil, appearance: nil, less_than: nil, greater_than: nil)
|
67
|
+
client.graph_url(graph_id: graph_id, date: date, mode: mode, appearance: appearance, less_than: less_than, greater_than: greater_than)
|
65
68
|
end
|
66
69
|
|
67
70
|
# Update predefined pixelation graph definitions.
|
@@ -258,5 +261,21 @@ module Pixela
|
|
258
261
|
def latest
|
259
262
|
client.get_graph_latest(graph_id: graph_id)
|
260
263
|
end
|
264
|
+
|
265
|
+
# This is an endpoint that responds with the Pixel of the day you requested this API.
|
266
|
+
#
|
267
|
+
# @param return_empty [Boolean] Specifying `true` for this param will return an empty Pixel instead of `404 Not Found` if the Pixel is unregistered on the day of the request.
|
268
|
+
#
|
269
|
+
# @return [Pixela::Response]
|
270
|
+
#
|
271
|
+
# @raise [Pixela::PixelaError] API is failed
|
272
|
+
#
|
273
|
+
# @see https://docs.pixe.la/entry/get-today-pixel
|
274
|
+
#
|
275
|
+
# @example
|
276
|
+
# client.graph("test-graph").today(return_empty: true)
|
277
|
+
def today(return_empty: false)
|
278
|
+
client.get_graph_today(graph_id: graph_id, return_empty: return_empty)
|
279
|
+
end
|
261
280
|
end
|
262
281
|
end
|
data/lib/pixela/version.rb
CHANGED
data/pixela.gemspec
CHANGED
@@ -43,6 +43,7 @@ Gem::Specification.new do |spec|
|
|
43
43
|
spec.add_development_dependency "rspec-its"
|
44
44
|
spec.add_development_dependency "rspec-parameterized"
|
45
45
|
spec.add_development_dependency "simplecov"
|
46
|
+
spec.add_development_dependency "term-ansicolor", "!= 1.11.1" # ref. https://github.com/flori/term-ansicolor/issues/41
|
46
47
|
spec.add_development_dependency "unparser", ">= 0.4.5"
|
47
48
|
spec.add_development_dependency "webmock"
|
48
49
|
spec.add_development_dependency "yard"
|
metadata
CHANGED
@@ -1,14 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: pixela
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.
|
4
|
+
version: 3.5.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- sue445
|
8
|
-
autorequire:
|
9
8
|
bindir: exe
|
10
9
|
cert_chain: []
|
11
|
-
date:
|
10
|
+
date: 2025-02-25 00:00:00.000000000 Z
|
12
11
|
dependencies:
|
13
12
|
- !ruby/object:Gem::Dependency
|
14
13
|
name: faraday
|
@@ -164,6 +163,20 @@ dependencies:
|
|
164
163
|
- - ">="
|
165
164
|
- !ruby/object:Gem::Version
|
166
165
|
version: '0'
|
166
|
+
- !ruby/object:Gem::Dependency
|
167
|
+
name: term-ansicolor
|
168
|
+
requirement: !ruby/object:Gem::Requirement
|
169
|
+
requirements:
|
170
|
+
- - "!="
|
171
|
+
- !ruby/object:Gem::Version
|
172
|
+
version: 1.11.1
|
173
|
+
type: :development
|
174
|
+
prerelease: false
|
175
|
+
version_requirements: !ruby/object:Gem::Requirement
|
176
|
+
requirements:
|
177
|
+
- - "!="
|
178
|
+
- !ruby/object:Gem::Version
|
179
|
+
version: 1.11.1
|
167
180
|
- !ruby/object:Gem::Dependency
|
168
181
|
name: unparser
|
169
182
|
requirement: !ruby/object:Gem::Requirement
|
@@ -253,7 +266,6 @@ metadata:
|
|
253
266
|
changelog_uri: https://github.com/sue445/pixela/blob/master/CHANGELOG.md
|
254
267
|
documentation_uri: https://sue445.github.io/pixela/
|
255
268
|
rubygems_mfa_required: 'true'
|
256
|
-
post_install_message:
|
257
269
|
rdoc_options: []
|
258
270
|
require_paths:
|
259
271
|
- lib
|
@@ -268,8 +280,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
268
280
|
- !ruby/object:Gem::Version
|
269
281
|
version: '0'
|
270
282
|
requirements: []
|
271
|
-
rubygems_version: 3.
|
272
|
-
signing_key:
|
283
|
+
rubygems_version: 3.6.2
|
273
284
|
specification_version: 4
|
274
285
|
summary: Pixela API client for Ruby
|
275
286
|
test_files: []
|