pixela 0.5.0 → 0.5.1

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: 0f3751766bfd2903143fe8f0e49836b3b040383dcbdd76271000b22c9771821e
4
- data.tar.gz: 011a0100cc329b56e4e2049e6d65b8c17635b7497f96f919b0c3f272c97b4999
3
+ metadata.gz: 6ed72075c34fa2860d04f2caa1abdba37dacb9a6fcc01b0e413d12ae5a75bf40
4
+ data.tar.gz: ace8f125523d761d69d70dd3d91b1cf472efd299162f217aa512735c291d98bc
5
5
  SHA512:
6
- metadata.gz: 461873a36898a96e8698d3401a0c36d897e1dbbb96d38f9824cc40829ff79b0b152c2da391fb7b7b4b7afb892453437875a3b78649a9334e313b5ba132b9feeb
7
- data.tar.gz: 8e5feab90d3e9827fa662d75b3d0351bb95db3299c7dd34cfe228a3e5eea46690d063eb11c6f92adf20f2eb9130eb946455302e1efc7e6a27beed6e681061cd6
6
+ metadata.gz: e3c99eb01857e37f6284030b1f02b594c7ae729132601d4ab2d20737e227c61968b13a6dc62c8aa288b3420719158bfb7a52fef1503d6b472ed9f25eebd35a02
7
+ data.tar.gz: 5f06cb6df775d8849b1da6ed1daa4b7c2aa10634b245e23db7491de99abff23928690a6cb88564bd5e12441bcbdf01815763f04fa60c5b70159a26bd5b53ac3a
@@ -1,5 +1,16 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/pixela/compare/v0.5.0...master)
2
+ [full changelog](http://github.com/sue445/pixela/compare/v0.5.1...master)
3
+
4
+ ## v0.5.1
5
+ [full changelog](http://github.com/sue445/pixela/compare/v0.5.0...v0.5.1)
6
+
7
+ * Arguments of `Pixela::Client#update_graph` and `Pixela::Graph#update` change to optional
8
+ * https://github.com/sue445/pixela/pull/28
9
+ * https://github.com/a-know/Pixela/releases/tag/v1.3.1
10
+ * Add `Pixela::Graph#delete`
11
+ * https://github.com/sue445/pixela/pull/27
12
+ * Update API link
13
+ * https://github.com/sue445/pixela/pull/26
3
14
 
4
15
  ## v0.5.0
5
16
  [full changelog](http://github.com/sue445/pixela/compare/v0.4.0...v0.5.0)
@@ -94,5 +94,10 @@ module Pixela
94
94
  def to_ymd(date)
95
95
  date.strftime("%Y%m%d")
96
96
  end
97
+
98
+ def compact_hash(hash)
99
+ # NOTE: Hash#compact is available since MRI 2.4+
100
+ hash.reject { |_, v| v.nil? }
101
+ end
97
102
  end
98
103
  end
@@ -11,7 +11,7 @@ module Pixela::Client::GraphMethods
11
11
  #
12
12
  # @raise [Pixela::PixelaError] API is failed
13
13
  #
14
- # @see https://pixe.la/#api-graph
14
+ # @see https://pixe.la/#api-detail-post-graphs
15
15
  #
16
16
  # @example
17
17
  # client.create_graph(graph_id: "test-graph", name: "graph-name", unit: "commit", type: "int", color: "shibafu")
@@ -35,7 +35,7 @@ module Pixela::Client::GraphMethods
35
35
  #
36
36
  # @raise [Pixela::PixelaError] API is failed
37
37
  #
38
- # @see https://pixe.la/#api-graph
38
+ # @see https://pixe.la/#api-detail-get-graphs
39
39
  #
40
40
  # @example
41
41
  # client.get_graphs
@@ -53,7 +53,7 @@ module Pixela::Client::GraphMethods
53
53
  #
54
54
  # @return [String]
55
55
  #
56
- # @see https://pixe.la/#api-graph
56
+ # @see https://pixe.la/#api-detail-get-graph
57
57
  #
58
58
  # @example
59
59
  # client.graph_url(graph_id: "test-graph")
@@ -82,11 +82,11 @@ module Pixela::Client::GraphMethods
82
82
  #
83
83
  # @raise [Pixela::PixelaError] API is failed
84
84
  #
85
- # @see https://pixe.la/#api-graph
85
+ # @see https://pixe.la/#api-detail-put-graph
86
86
  #
87
87
  # @example
88
88
  # client.update_graph(graph_id: "test-graph", name: "graph-name", unit: "commit", color: "shibafu", purge_cache_urls: ["https://camo.githubusercontent.com/xxx/xxxx"])
89
- def update_graph(graph_id:, name:, unit:, color:, purge_cache_urls: nil)
89
+ def update_graph(graph_id:, name: nil, unit: nil, color: nil, purge_cache_urls: nil)
90
90
  params = {
91
91
  name: name,
92
92
  unit: unit,
@@ -98,7 +98,7 @@ module Pixela::Client::GraphMethods
98
98
  end
99
99
 
100
100
  with_error_handling do
101
- connection.put("users/#{username}/graphs/#{graph_id}", params, user_token_headers).body
101
+ connection.put("users/#{username}/graphs/#{graph_id}", compact_hash(params), user_token_headers).body
102
102
  end
103
103
  end
104
104
 
@@ -110,7 +110,7 @@ module Pixela::Client::GraphMethods
110
110
  #
111
111
  # @raise [Pixela::PixelaError] API is failed
112
112
  #
113
- # @see https://pixe.la/#api-graph
113
+ # @see https://pixe.la/#api-detail-delete-graph
114
114
  #
115
115
  # @example
116
116
  # client.delete_graph("test-graph")
@@ -9,7 +9,7 @@ module Pixela::Client::PixelMethods
9
9
  #
10
10
  # @raise [Pixela::PixelaError] API is failed
11
11
  #
12
- # @see https://pixe.la/#api-pixel
12
+ # @see https://pixe.la/#api-detail-post-pixels
13
13
  #
14
14
  # @example
15
15
  # client.create_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15), quantity: 5)
@@ -33,7 +33,7 @@ module Pixela::Client::PixelMethods
33
33
  #
34
34
  # @raise [Pixela::PixelaError] API is failed
35
35
  #
36
- # @see https://pixe.la/#api-pixel
36
+ # @see https://pixe.la/#api-detail-get-pixel
37
37
  #
38
38
  # @example
39
39
  # client.get_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15))
@@ -53,7 +53,7 @@ module Pixela::Client::PixelMethods
53
53
  #
54
54
  # @raise [Pixela::PixelaError] API is failed
55
55
  #
56
- # @see https://pixe.la/#api-pixel
56
+ # @see https://pixe.la/#api-detail-put-pixel
57
57
  #
58
58
  # @example
59
59
  # client.update_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15), quantity: 7)
@@ -76,7 +76,7 @@ module Pixela::Client::PixelMethods
76
76
  #
77
77
  # @raise [Pixela::PixelaError] API is failed
78
78
  #
79
- # @see https://pixe.la/#api-pixel
79
+ # @see https://pixe.la/#api-detail-delete-pixel
80
80
  #
81
81
  # @example
82
82
  # client.delete_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15))
@@ -94,7 +94,7 @@ module Pixela::Client::PixelMethods
94
94
  #
95
95
  # @raise [Pixela::PixelaError] API is failed
96
96
  #
97
- # @see https://pixe.la/#api-pixel
97
+ # @see https://pixe.la/#api-detail-pixel-increment
98
98
  #
99
99
  # @example
100
100
  # client.increment_pixel(graph_id: "test-graph")
@@ -112,7 +112,7 @@ module Pixela::Client::PixelMethods
112
112
  #
113
113
  # @raise [Pixela::PixelaError] API is failed
114
114
  #
115
- # @see https://pixe.la/#api-pixel
115
+ # @see https://pixe.la/#api-detail-pixel-decrement
116
116
  #
117
117
  # @example
118
118
  # client.decrement_pixel(graph_id: "test-graph")
@@ -8,7 +8,7 @@ module Pixela::Client::UserMethods
8
8
  #
9
9
  # @raise [Pixela::PixelaError] API is failed
10
10
  #
11
- # @see https://pixe.la/#api-user
11
+ # @see https://pixe.la/#api-detail-post-users
12
12
  #
13
13
  # @example
14
14
  # client.create_user(agree_terms_of_service: true, not_minor: true)
@@ -33,7 +33,7 @@ module Pixela::Client::UserMethods
33
33
  #
34
34
  # @raise [Pixela::PixelaError] API is failed
35
35
  #
36
- # @see https://pixe.la/#api-user
36
+ # @see https://pixe.la/#api-detail-put-user
37
37
  #
38
38
  # @example
39
39
  # client.update_user(new_token: "thisissecret")
@@ -58,7 +58,7 @@ module Pixela::Client::UserMethods
58
58
  #
59
59
  # @raise [Pixela::PixelaError] API is failed
60
60
  #
61
- # @see https://pixe.la/#api-user
61
+ # @see https://pixe.la/#api-detail-delete-user
62
62
  #
63
63
  # @example
64
64
  # client.delete_user
@@ -8,7 +8,7 @@ module Pixela::Client::WebhookMethods
8
8
  #
9
9
  # @raise [Pixela::PixelaError] API is failed
10
10
  #
11
- # @see https://pixe.la/#api-webhook
11
+ # @see https://pixe.la/#api-detail-post-webhooks
12
12
  #
13
13
  # @example
14
14
  # client.create_webhook(graph_id: "test-graph", type: "increment")
@@ -29,7 +29,7 @@ module Pixela::Client::WebhookMethods
29
29
  #
30
30
  # @raise [Pixela::PixelaError] API is failed
31
31
  #
32
- # @see https://pixe.la/#api-webhook
32
+ # @see https://pixe.la/#api-detail-get-webhooks
33
33
  #
34
34
  # @example
35
35
  # client.get_webhooks
@@ -47,7 +47,7 @@ module Pixela::Client::WebhookMethods
47
47
  #
48
48
  # @raise [Pixela::PixelaError] API is failed
49
49
  #
50
- # @see https://pixe.la/#api-webhook
50
+ # @see https://pixe.la/#api-detail-post-webhook
51
51
  #
52
52
  # @example
53
53
  # client.invoke_webhook(webhook_hash: "<webhookHash>")
@@ -65,7 +65,7 @@ module Pixela::Client::WebhookMethods
65
65
  #
66
66
  # @raise [Pixela::PixelaError] API is failed
67
67
  #
68
- # @see https://pixe.la/#api-webhook
68
+ # @see https://pixe.la/#api-detail-delete-webhook
69
69
  #
70
70
  # @example
71
71
  # client.delete_webhook(webhook_hash: "<webhookHash>")
@@ -33,7 +33,7 @@ module Pixela
33
33
  #
34
34
  # @raise [Pixela::PixelaError] API is failed
35
35
  #
36
- # @see https://pixe.la/#api-graph
36
+ # @see https://pixe.la/#api-detail-post-graphs
37
37
  #
38
38
  # @example
39
39
  # client.graph("test-graph").create(name: "graph-name", unit: "commit", type: "int", color: "shibafu")
@@ -48,7 +48,7 @@ module Pixela
48
48
  #
49
49
  # @return [String]
50
50
  #
51
- # @see https://pixe.la/#api-graph
51
+ # @see https://pixe.la/#api-detail-get-graph
52
52
  #
53
53
  # @example
54
54
  # client.graph("test-graph").url
@@ -68,21 +68,35 @@ module Pixela
68
68
  #
69
69
  # @raise [Pixela::PixelaError] API is failed
70
70
  #
71
- # @see https://pixe.la/#api-graph
71
+ # @see https://pixe.la/#api-detail-put-graph
72
72
  #
73
73
  # @example
74
74
  # client.graph("test-graph").update(name: "graph-name", unit: "commit", color: "shibafu", purge_cache_urls: ["https://camo.githubusercontent.com/xxx/xxxx"])
75
- def update(name:, unit:, color:, purge_cache_urls: nil)
75
+ def update(name: nil, unit: nil, color: nil, purge_cache_urls: nil)
76
76
  client.update_graph(graph_id: graph_id, name: name, unit: unit, color: color, purge_cache_urls: purge_cache_urls)
77
77
  end
78
78
 
79
+ # Delete the predefined pixelation graph definition.
80
+ #
81
+ # @return [Hashie::Mash]
82
+ #
83
+ # @raise [Pixela::PixelaError] API is failed
84
+ #
85
+ # @see https://pixe.la/#api-detail-put-graph
86
+ #
87
+ # @example
88
+ # client.graph("test-graph").delete
89
+ def delete
90
+ client.delete_graph(graph_id)
91
+ end
92
+
79
93
  # Increment quantity "Pixel" of the day (UTC).
80
94
  #
81
95
  # @return [Hashie::Mash]
82
96
  #
83
97
  # @raise [Pixela::PixelaError] API is failed
84
98
  #
85
- # @see https://pixe.la/#api-pixel
99
+ # @see https://pixe.la/#api-detail-pixel-increment
86
100
  #
87
101
  # @example
88
102
  # client.graph("test-graph").increment
@@ -96,7 +110,7 @@ module Pixela
96
110
  #
97
111
  # @raise [Pixela::PixelaError] API is failed
98
112
  #
99
- # @see https://pixe.la/#api-pixel
113
+ # @see https://pixe.la/#api-detail-pixel-decrement
100
114
  #
101
115
  # @example
102
116
  # client.graph("test-graph").decrement
@@ -29,7 +29,7 @@ module Pixela
29
29
  #
30
30
  # @raise [Pixela::PixelaError] API is failed
31
31
  #
32
- # @see https://pixe.la/#api-pixel
32
+ # @see https://pixe.la/#api-detail-post-pixels
33
33
  #
34
34
  # @example
35
35
  # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).create(quantity: 5)
@@ -43,7 +43,7 @@ module Pixela
43
43
  #
44
44
  # @raise [Pixela::PixelaError] API is failed
45
45
  #
46
- # @see https://pixe.la/#api-pixel
46
+ # @see https://pixe.la/#api-detail-get-pixel
47
47
  #
48
48
  # @example
49
49
  # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).get
@@ -59,7 +59,7 @@ module Pixela
59
59
  #
60
60
  # @raise [Pixela::PixelaError] API is failed
61
61
  #
62
- # @see https://pixe.la/#api-pixel
62
+ # @see https://pixe.la/#api-detail-put-pixel
63
63
  #
64
64
  # @example
65
65
  # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).update(quantity: 7)
@@ -73,7 +73,7 @@ module Pixela
73
73
  #
74
74
  # @raise [Pixela::PixelaError] API is failed
75
75
  #
76
- # @see https://pixe.la/#api-pixel
76
+ # @see https://pixe.la/#api-detail-delete-pixel
77
77
  #
78
78
  # @example
79
79
  # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).delete
@@ -1,3 +1,3 @@
1
1
  module Pixela
2
- VERSION = "0.5.0"
2
+ VERSION = "0.5.1"
3
3
  end
@@ -21,7 +21,7 @@ module Pixela
21
21
  #
22
22
  # @raise [Pixela::PixelaError] API is failed
23
23
  #
24
- # @see https://pixe.la/#api-webhook
24
+ # @see https://pixe.la/#api-detail-post-webhook
25
25
  #
26
26
  # @example
27
27
  # client.webhook("<webhookHash>").invoke
@@ -35,7 +35,7 @@ module Pixela
35
35
  #
36
36
  # @raise [Pixela::PixelaError] API is failed
37
37
  #
38
- # @see https://pixe.la/#api-webhook
38
+ # @see https://pixe.la/#api-detail-delete-webhook
39
39
  #
40
40
  # @example
41
41
  # client.webhook("<webhookHash>").delete
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: 0.5.0
4
+ version: 0.5.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2018-10-23 00:00:00.000000000 Z
11
+ date: 2018-10-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday