pixela 2.0.0 → 3.0.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: a19da817bef056e3d3cc66258e4bce7813bccdb9d8d6e185f0d348283c424c84
4
- data.tar.gz: cdc62d67befebedfc0c4c4b60c777271d0cacf419b363568f7fd1a923715047d
3
+ metadata.gz: 6eb158057d65be208480f8b727cc4dd4f140e8b181e1ac679db576572c4059f5
4
+ data.tar.gz: 2dd2a0c983bbbedca697acd09f43dfe400010811982ab20a5b01b5f9dfb952b4
5
5
  SHA512:
6
- metadata.gz: 80480cae33a1c20da25abdeca2e2162468b8a0bf0effded2d7ae3cf612cc8fd7aa96ef9149306e9b23e25101ad65894d9d9654e7a48125534b770d0dfd6978ff
7
- data.tar.gz: 6d4ba1cfee75fa49a0c1cdb940437e47fdf6e02326ade8972c98ebbbe4f23274a2fdcd668474c5f7efaf68e4488641284ba9f21a78a403613b14cbcdcfc88bd8
6
+ metadata.gz: 2f7d11b7027cf125a407b7a162b7fd5a8e96849b82b59258dc2c7d23827921cc7ce848c776b0d4760bd6036953cc2566a71d18b79002d2f701933b4ec2f05797
7
+ data.tar.gz: 554e82c827ee5de2d5909c883b320cbf2d8e32de2ec5fce43151290a4f6a240d82c769a321b56fa1a265052b6ed5395547fe4cb3db53ab4fcfad5a335566258e
@@ -12,9 +12,6 @@ on:
12
12
  schedule:
13
13
  - cron: "0 10 * * 5" # JST 19:00 (Fri)
14
14
 
15
- env:
16
- CI: "true"
17
-
18
15
  jobs:
19
16
  test:
20
17
  runs-on: ubuntu-latest
@@ -22,20 +19,20 @@ jobs:
22
19
  container: ${{ matrix.ruby }}
23
20
 
24
21
  env:
25
- BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}
22
+ BUNDLE_GEMFILE: gemfiles/${{ matrix.gemfile }}.gemfile
26
23
 
27
24
  strategy:
28
25
  fail-fast: false
29
26
 
30
27
  matrix:
31
28
  ruby:
32
- - ruby:2.4
33
- - ruby:2.5
34
29
  - ruby:2.6
35
30
  - ruby:2.7
31
+ - ruby:3.0
32
+ - ruby:3.1
36
33
  - rubylang/ruby:master-nightly-bionic
37
34
  gemfile:
38
- - faraday_1.gemfile
35
+ - faraday_2
39
36
  include:
40
37
  - ruby: rubylang/ruby:master-nightly-bionic
41
38
  allow_failures: "true"
@@ -43,7 +40,6 @@ jobs:
43
40
  steps:
44
41
  - uses: actions/checkout@v2
45
42
 
46
-
47
43
  - name: Cache gemfiles/vendor/bundle
48
44
  uses: actions/cache@v1
49
45
  id: cache_gem
@@ -92,7 +88,7 @@ jobs:
92
88
  continue-on-error: true
93
89
 
94
90
  - name: Slack Notification (not success)
95
- uses: homoluctus/slatify@master
91
+ uses: lazy-actions/slatify@master
96
92
  if: "! success()"
97
93
  continue-on-error: true
98
94
  with:
@@ -110,7 +106,7 @@ jobs:
110
106
 
111
107
  steps:
112
108
  - name: Slack Notification (success)
113
- uses: homoluctus/slatify@master
109
+ uses: lazy-actions/slatify@master
114
110
  if: always()
115
111
  continue-on-error: true
116
112
  with:
data/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/pixela/compare/v2.0.0...master)
2
+ [full changelog](http://github.com/sue445/pixela/compare/v3.0.0...master)
3
+
4
+ ## v3.0.0
5
+ [full changelog](http://github.com/sue445/pixela/compare/v2.2.1...v3.0.0)
6
+
7
+ * Support faraday v2+ and drop support ruby < 2.6
8
+ * https://github.com/sue445/pixela/pull/91
9
+
10
+ ## v2.2.1
11
+ [full changelog](http://github.com/sue445/pixela/compare/v2.2.0...v2.2.1)
12
+
13
+ * Enable MFA requirement for gem releasing
14
+ * https://github.com/sue445/pixela/pull/88
15
+
16
+ ## v2.2.0
17
+ [full changelog](http://github.com/sue445/pixela/compare/v2.1.0...v2.2.0)
18
+
19
+ * Add `Pixela::Client#get_graph_def` and `Pixela::Graph#def`
20
+ * https://github.com/sue445/pixela/pull/83
21
+ * https://github.com/a-know/Pixela/releases/tag/v1.21.0
22
+ * Add `Pixela::Client#get_pixels` and `Pixela::Graph#pixels`
23
+ * https://github.com/sue445/pixela/pull/84
24
+ * https://github.com/a-know/Pixela/releases/tag/v1.21.0
25
+
26
+ ## v2.1.0
27
+ [full changelog](http://github.com/sue445/pixela/compare/v2.0.0...v2.1.0)
28
+
29
+ * Add `Pixela::Client#update_profile`
30
+ * https://github.com/sue445/pixela/pull/81
31
+ * https://github.com/a-know/Pixela/releases/tag/v1.20.0
3
32
 
4
33
  ## v2.0.0
5
34
  [full changelog](http://github.com/sue445/pixela/compare/v1.5.0...v2.0.0)
@@ -5,4 +5,4 @@ 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
- gem "faraday", "~> 1.0"
8
+ gem "faraday", "~> 2.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
@@ -0,0 +1,40 @@
1
+ module Pixela::Client::ProfileMethods
2
+ # Updates the profile information for the user corresponding to username
3
+ #
4
+ # @param display_name [String]
5
+ # @param gravatar_icon_email [String]
6
+ # @param title [String]
7
+ # @param timezone [String]
8
+ # @param about_url [String]
9
+ # @param contribute_urls [Array<String>]
10
+ # @param pinned_graph_id [String]
11
+ #
12
+ # @return [Pixela::Response]
13
+ #
14
+ # @raise [Pixela::PixelaError] API is failed
15
+ #
16
+ # @see https://docs.pixe.la/entry/put-profile
17
+ #
18
+ # @example
19
+ # client.update_profile(display_name: "a-know", gravatar_icon_email: "user@example.com", title: "my title", timezone: "Asia/Tokyo", about_url: "https://home.a-know.me", contribute_urls: ["https://pixe.la/","https://github.com/a-know/pi","https://blog.a-know.me/archive/category/Pixela"])
20
+ def update_profile(display_name: nil, gravatar_icon_email: nil, title: nil, timezone: nil,
21
+ about_url: nil, contribute_urls: [], pinned_graph_id: nil)
22
+
23
+ params = {
24
+ displayName: display_name,
25
+ gravatarIconEmail: gravatar_icon_email,
26
+ title: title,
27
+ timezone: timezone,
28
+ aboutURL: about_url,
29
+ pinnedGraphID: pinned_graph_id
30
+ }
31
+
32
+ unless contribute_urls.empty?
33
+ params[:contributeURLs] = contribute_urls
34
+ end
35
+
36
+ with_error_handling do
37
+ connection(endpoint: Pixela::Client::TOP_ENDPOINT).put("@#{username}", params.compact).body
38
+ end
39
+ end
40
+ end
@@ -21,7 +21,7 @@ module Pixela::Client::UserMethods
21
21
  }
22
22
 
23
23
  with_error_handling do
24
- connection(default_headers).post("users", params).body
24
+ connection(request_headers: default_headers).post("users", params).body
25
25
  end
26
26
  end
27
27
 
@@ -53,7 +53,7 @@ module Pixela::Client::WebhookMethods
53
53
  # client.invoke_webhook(webhook_hash: "<webhookHash>")
54
54
  def invoke_webhook(webhook_hash:)
55
55
  with_error_handling do
56
- connection(default_headers).post("users/#{username}/webhooks/#{webhook_hash}").body
56
+ connection(request_headers: default_headers).post("users/#{username}/webhooks/#{webhook_hash}").body
57
57
  end
58
58
  end
59
59
 
data/lib/pixela/client.rb CHANGED
@@ -2,15 +2,18 @@ module Pixela
2
2
  class Client
3
3
  autoload :GraphMethods, "pixela/client/graph_methods"
4
4
  autoload :PixelMethods, "pixela/client/pixel_methods"
5
+ autoload :ProfileMethods, "pixela/client/profile_methods"
5
6
  autoload :UserMethods, "pixela/client/user_methods"
6
7
  autoload :WebhookMethods, "pixela/client/webhook_methods"
7
8
 
8
9
  include GraphMethods
9
10
  include PixelMethods
11
+ include ProfileMethods
10
12
  include UserMethods
11
13
  include WebhookMethods
12
14
 
13
15
  API_ENDPOINT = "https://pixe.la/v1"
16
+ TOP_ENDPOINT = "https://pixe.la"
14
17
 
15
18
  # @!attribute [r] username
16
19
  # @return [String]
@@ -52,8 +55,8 @@ module Pixela
52
55
  # @param request_headers [Hash]
53
56
  #
54
57
  # @return [Faraday::Connection]
55
- def connection(request_headers = user_token_headers)
56
- Faraday.new(url: API_ENDPOINT, headers: request_headers) do |conn|
58
+ def connection(request_headers: user_token_headers, endpoint: API_ENDPOINT)
59
+ Faraday.new(url: endpoint, headers: request_headers) do |conn|
57
60
  conn.request :json
58
61
  conn.response :mashify, mash_class: Pixela::Response
59
62
  conn.response :json
data/lib/pixela/graph.rb CHANGED
@@ -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.0.0"
2
+ VERSION = "3.0.0"
3
3
  end
data/lib/pixela.rb CHANGED
@@ -1,6 +1,6 @@
1
1
  require "pixela/version"
2
2
  require "faraday"
3
- require "faraday_middleware"
3
+ require "faraday/mashify"
4
4
  require "faraday_curl"
5
5
  require "date"
6
6
 
data/pixela.gemspec CHANGED
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
  spec.metadata["homepage_uri"] = spec.homepage
21
21
  spec.metadata["source_code_uri"] = spec.homepage
22
22
  spec.metadata["changelog_uri"] = spec.homepage + "/blob/master/CHANGELOG.md"
23
+ spec.metadata["rubygems_mfa_required"] = "true"
23
24
  else
24
25
  raise "RubyGems 2.0 or newer is required to protect against " \
25
26
  "public gem pushes."
@@ -34,12 +35,11 @@ Gem::Specification.new do |spec|
34
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
36
  spec.require_paths = ["lib"]
36
37
 
37
- spec.required_ruby_version = ">= 2.4.0"
38
+ spec.required_ruby_version = ">= 2.6.0"
38
39
 
39
- spec.add_dependency "faraday", ">= 1.0.0"
40
+ spec.add_dependency "faraday", ">= 2.0.0"
40
41
  spec.add_dependency "faraday_curl"
41
- spec.add_dependency "faraday_middleware"
42
- spec.add_dependency "hashie"
42
+ spec.add_dependency "faraday-mashify"
43
43
 
44
44
  spec.add_development_dependency "bundler", ">= 1.16"
45
45
  spec.add_development_dependency "coveralls"
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.0.0
4
+ version: 3.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-10-01 00:00:00.000000000 Z
11
+ date: 2022-01-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: 1.0.0
19
+ version: 2.0.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 1.0.0
26
+ version: 2.0.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: faraday_curl
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -39,21 +39,7 @@ dependencies:
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
41
  - !ruby/object:Gem::Dependency
42
- name: faraday_middleware
43
- requirement: !ruby/object:Gem::Requirement
44
- requirements:
45
- - - ">="
46
- - !ruby/object:Gem::Version
47
- version: '0'
48
- type: :runtime
49
- prerelease: false
50
- version_requirements: !ruby/object:Gem::Requirement
51
- requirements:
52
- - - ">="
53
- - !ruby/object:Gem::Version
54
- version: '0'
55
- - !ruby/object:Gem::Dependency
56
- name: hashie
42
+ name: faraday-mashify
57
43
  requirement: !ruby/object:Gem::Requirement
58
44
  requirements:
59
45
  - - ">="
@@ -240,11 +226,12 @@ files:
240
226
  - Rakefile
241
227
  - bin/console
242
228
  - bin/setup
243
- - gemfiles/faraday_1.gemfile
229
+ - gemfiles/faraday_2.gemfile
244
230
  - lib/pixela.rb
245
231
  - lib/pixela/client.rb
246
232
  - lib/pixela/client/graph_methods.rb
247
233
  - lib/pixela/client/pixel_methods.rb
234
+ - lib/pixela/client/profile_methods.rb
248
235
  - lib/pixela/client/user_methods.rb
249
236
  - lib/pixela/client/webhook_methods.rb
250
237
  - lib/pixela/configuration.rb
@@ -261,6 +248,7 @@ metadata:
261
248
  homepage_uri: https://github.com/sue445/pixela
262
249
  source_code_uri: https://github.com/sue445/pixela
263
250
  changelog_uri: https://github.com/sue445/pixela/blob/master/CHANGELOG.md
251
+ rubygems_mfa_required: 'true'
264
252
  post_install_message:
265
253
  rdoc_options: []
266
254
  require_paths:
@@ -269,14 +257,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
269
257
  requirements:
270
258
  - - ">="
271
259
  - !ruby/object:Gem::Version
272
- version: 2.4.0
260
+ version: 2.6.0
273
261
  required_rubygems_version: !ruby/object:Gem::Requirement
274
262
  requirements:
275
263
  - - ">="
276
264
  - !ruby/object:Gem::Version
277
265
  version: '0'
278
266
  requirements: []
279
- rubygems_version: 3.1.2
267
+ rubygems_version: 3.3.3
280
268
  signing_key:
281
269
  specification_version: 4
282
270
  summary: Pixela API client for Ruby