pixela 0.5.2 → 1.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: b3394cb63b462a975d8581c96c732e9414398642dd51ef530ee5e556605cb211
4
- data.tar.gz: 202708048e966f0c3a6ee6a44c463041cd357e350d8d6079f2c9d471ac23d921
3
+ metadata.gz: 155cec1f197cd84816e809f718a37b4968ee0ba980a6eae78a839c2da7219d45
4
+ data.tar.gz: b630692c9283f13ef1c0fb9f9a93b3433ac01a54dbfbb56d1fa3546d17a0ec50
5
5
  SHA512:
6
- metadata.gz: 3428d61c83f3ae5bf0a27a8d8caac84698f6f4385fa305df3cad83e6e0c407662b8b046bbd833446d6e0159b2c64336ad2a2ec150318e96ec45891372ecb2e80
7
- data.tar.gz: c649d7dcaa20af08d67378361e11ec910fe6a61f295a0944c02f3c5c0bcf2a1396f6c2f9620c4c294430b988b2ece7940d773b19d02d679477a7723fb1d923bf
6
+ metadata.gz: 2febdb44566fbbf01852150fb06562f5d16fc0ecf8f722d1fcfff1ffdac2cd7cd46fb8f22cdb18fa65dcb6b8e510ecd7789a9c6cab775cf3d215f28fbe58ec47
7
+ data.tar.gz: 03d9f2577154a96a16c87a2efdecd996033c1dee7c7ba9b917f9ab3139579a15d3e9b42f7397ce2e2801f36c9319eadb505b44791112ef5ed3cd2971b99aa4fb
@@ -1,26 +1,39 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.3
4
- - 2.4
5
- - 2.5
6
- - ruby-head
3
+ - 2.3
4
+ - 2.4
5
+ - 2.5
6
+ - 2.6
7
+ - ruby-head
7
8
  bundler_args: "--jobs=2"
8
9
  cache: bundler
9
10
  before_install:
10
- - gem update --system --no-document
11
- - gem install bundler --no-document
11
+ - travis_retry gem update --system || travis_retry gem update --system 2.7.8
12
+ - travis_retry gem install bundler --no-document || travis_retry gem install bundler --no-document -v 1.17.3
12
13
  before_script:
13
- - export CODECLIMATE_REPO_TOKEN=67b1bed21e42834690bb57b148b93d6bd23410d8e013afdf6a89d66f36011a95
14
+ - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter
15
+ - chmod +x ./cc-test-reporter
16
+ - ./cc-test-reporter before-build
14
17
  script:
15
- - bundle exec rspec
18
+ - bundle exec rspec
19
+ after_script:
20
+ - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
16
21
  branches:
17
22
  only:
18
- - master
23
+ - master
19
24
  notifications:
20
25
  email: false
21
26
  slack:
22
27
  secure: ec/Q9tFK+TjW7ZVOWg8NPfa4IFfbU24ljqObG7YhlaYaIN63MMdMITfy17sQahm2T0x7jhAzxDo1pDTb9XoBs12cu2wogZltv+daZwATWYzipvUxQqge1yywnFn3QLfQyzAl5p1MYkxLpJeVDRD8wunmc2OikR4jMtl5KDk9e2sItHGJdfPY8mFhM+sKaLyy9mbGo02aqRqwhgXGFQg1lZ/D6qPZKPSAd+S+uJgma8En4P292APBN9hsgpjC4HGqiqhPumOyjmdiVZ//4QoYhIEaMGJiwKyv9GwS0cTfk6w9MNFRILhj4tN3kP8ZsI7h5oQy8+x0Deac9joTKMNVarvZkVFZWLZ3p8mthdsRNKZeYxkSgnrhwA/3CFe/THjolfROA61iQqWxFycdIqSieiGHZ57EvHo7HOSD5Kc0017X+UITjiWiKiSQPddPmYm5hl9lo9rBo1RaJRr6B5A2qrw2SBmNfH38+BDTMFZprJLN51LBJ4DEy4R0CClbyIk6DbODsWqQC+W+6sOCWOhrVXSeSVlxPz7hT24ezkcMLMvoA5k9f6Gi2cWWDD9CmRI2Upt+5lx0Ui1/9xbk4RG6/hue8L764jdQ2mqNtrAZJSjdfs9KxapoKFllezdwhNVJS4UoU6PT9DU227cHH3SWHYm9GHu/pQ6kdhBGcr/EMiY=
23
28
  matrix:
24
29
  allow_failures:
25
- - rvm: ruby-head
30
+ - rvm: ruby-head
31
+ include:
32
+ - rvm: 2.6
33
+ env: RUBYOPT="--jit"
34
+ - rvm: ruby-head
35
+ env: RUBYOPT="--jit"
26
36
  sudo: false
37
+ env:
38
+ global:
39
+ - CC_TEST_REPORTER_ID=67b1bed21e42834690bb57b148b93d6bd23410d8e013afdf6a89d66f36011a95
@@ -1,5 +1,23 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/pixela/compare/v0.5.2...master)
2
+ [full changelog](http://github.com/sue445/pixela/compare/v1.0.0...master)
3
+
4
+ ## v1.0.0
5
+ [full changelog](http://github.com/sue445/pixela/compare/v0.5.2...v1.0.0)
6
+
7
+ ### :warning: Breaking changes :warning:
8
+ * Drop support ruby 2.2
9
+ * https://github.com/sue445/pixela/pull/42
10
+
11
+ ### Features
12
+ * Add `optional_data` to `create_pixel` and `update_pixel`
13
+ * https://github.com/sue445/pixela/pull/43
14
+ * https://github.com/a-know/Pixela/releases/tag/v1.6.0
15
+ * Returns parsed json instead of json string in `get_pixel`
16
+ * https://github.com/sue445/pixela/pull/44
17
+
18
+ ### Refactorings
19
+ * Refactor: `Pixela::Client#connection`
20
+ * https://github.com/sue445/pixela/pull/37
3
21
 
4
22
  ## v0.5.2
5
23
  [full changelog](http://github.com/sue445/pixela/compare/v0.5.1...v0.5.2)
@@ -9,6 +9,7 @@ module Pixela
9
9
  autoload :Configuration, "pixela/configuration"
10
10
  autoload :Graph, "pixela/graph"
11
11
  autoload :Pixel, "pixela/pixel"
12
+ autoload :Response, "pixela/response"
12
13
  autoload :Webhook, "pixela/webhook"
13
14
 
14
15
  # @return [Pixela::Configuration]
@@ -49,10 +49,13 @@ module Pixela
49
49
  # @return [String]
50
50
  attr_reader :token
51
51
 
52
- def connection
53
- Faraday.new(API_ENDPOINT) do |conn|
52
+ # @param request_headers [Hash]
53
+ #
54
+ # @return [Faraday::Connection]
55
+ def connection(request_headers = user_token_headers)
56
+ Faraday.new(url: API_ENDPOINT, headers: request_headers) do |conn|
54
57
  conn.request :json
55
- conn.response :mashify
58
+ conn.response :mashify, mash_class: Pixela::Response
56
59
  conn.response :json
57
60
  conn.response :raise_error
58
61
 
@@ -8,7 +8,7 @@ module Pixela::Client::GraphMethods
8
8
  # @param color [String]
9
9
  # @param timezone [String]
10
10
  #
11
- # @return [Hashie::Mash]
11
+ # @return [Pixela::Response]
12
12
  #
13
13
  # @raise [Pixela::PixelaError] API is failed
14
14
  #
@@ -27,7 +27,7 @@ module Pixela::Client::GraphMethods
27
27
  }
28
28
 
29
29
  with_error_handling do
30
- connection.post("users/#{username}/graphs", compact_hash(params), user_token_headers).body
30
+ connection.post("users/#{username}/graphs", compact_hash(params)).body
31
31
  end
32
32
  end
33
33
 
@@ -43,7 +43,7 @@ module Pixela::Client::GraphMethods
43
43
  # client.get_graphs
44
44
  def get_graphs
45
45
  with_error_handling do
46
- connection.get("users/#{username}/graphs", nil, user_token_headers).body.graphs
46
+ connection.get("users/#{username}/graphs").body.graphs
47
47
  end
48
48
  end
49
49
 
@@ -81,7 +81,7 @@ module Pixela::Client::GraphMethods
81
81
  # @param timezone [String]
82
82
  # @param purge_cache_urls [String,Array<String>]
83
83
  #
84
- # @return [Hashie::Mash]
84
+ # @return [Pixela::Response]
85
85
  #
86
86
  # @raise [Pixela::PixelaError] API is failed
87
87
  #
@@ -102,7 +102,7 @@ module Pixela::Client::GraphMethods
102
102
  end
103
103
 
104
104
  with_error_handling do
105
- connection.put("users/#{username}/graphs/#{graph_id}", compact_hash(params), user_token_headers).body
105
+ connection.put("users/#{username}/graphs/#{graph_id}", compact_hash(params)).body
106
106
  end
107
107
  end
108
108
 
@@ -110,7 +110,7 @@ module Pixela::Client::GraphMethods
110
110
  #
111
111
  # @param graph_id [String]
112
112
  #
113
- # @return [Hashie::Mash]
113
+ # @return [Pixela::Response]
114
114
  #
115
115
  # @raise [Pixela::PixelaError] API is failed
116
116
  #
@@ -120,7 +120,7 @@ module Pixela::Client::GraphMethods
120
120
  # client.delete_graph("test-graph")
121
121
  def delete_graph(graph_id)
122
122
  with_error_handling do
123
- connection.delete("users/#{username}/graphs/#{graph_id}", nil, user_token_headers).body
123
+ connection.delete("users/#{username}/graphs/#{graph_id}").body
124
124
  end
125
125
  end
126
126
  end
@@ -1,26 +1,28 @@
1
1
  module Pixela::Client::PixelMethods
2
2
  # It records the quantity of the specified date as a "Pixel".
3
3
  #
4
- # @param graph_id [String]
5
- # @param date [Date,Time]
6
- # @param quantity [Integer,Float]
4
+ # @param graph_id [String]
5
+ # @param date [Date,Time]
6
+ # @param quantity [Integer,Float]
7
+ # @param optional_data [Object] Additional information other than quantity
7
8
  #
8
- # @return [Hashie::Mash]
9
+ # @return [Pixela::Response]
9
10
  #
10
11
  # @raise [Pixela::PixelaError] API is failed
11
12
  #
12
13
  # @see https://docs.pixe.la/#/post-pixel
13
14
  #
14
15
  # @example
15
- # client.create_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15), quantity: 5)
16
- def create_pixel(graph_id:, date: Date.today, quantity:)
16
+ # client.create_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15), quantity: 5, optional_data: {key: "value"})
17
+ def create_pixel(graph_id:, date: Date.today, quantity:, optional_data: nil)
17
18
  params = {
18
- date: to_ymd(date),
19
- quantity: quantity.to_s,
19
+ date: to_ymd(date),
20
+ quantity: quantity.to_s,
21
+ optionalData: optional_data&.to_json,
20
22
  }
21
23
 
22
24
  with_error_handling do
23
- connection.post("users/#{username}/graphs/#{graph_id}", params, user_token_headers).body
25
+ connection.post("users/#{username}/graphs/#{graph_id}", compact_hash(params)).body
24
26
  end
25
27
  end
26
28
 
@@ -29,7 +31,7 @@ module Pixela::Client::PixelMethods
29
31
  # @param graph_id [String]
30
32
  # @param date [Date,Time]
31
33
  #
32
- # @return [Hashie::Mash]
34
+ # @return [Pixela::Response]
33
35
  #
34
36
  # @raise [Pixela::PixelaError] API is failed
35
37
  #
@@ -38,32 +40,47 @@ module Pixela::Client::PixelMethods
38
40
  # @example
39
41
  # client.get_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15))
40
42
  def get_pixel(graph_id:, date: Date.today)
41
- with_error_handling do
42
- connection.get("users/#{username}/graphs/#{graph_id}/#{to_ymd(date)}", nil, user_token_headers).body
43
+ res =
44
+ with_error_handling do
45
+ connection.get("users/#{username}/graphs/#{graph_id}/#{to_ymd(date)}").body
46
+ end
47
+
48
+ if res.key?(:optionalData)
49
+ res[:optional_data] =
50
+ begin
51
+ JSON.parse(res[:optionalData])
52
+ rescue JSON::ParserError
53
+ res[:optionalData]
54
+ end
55
+ res.delete(:optionalData)
43
56
  end
57
+
58
+ res
44
59
  end
45
60
 
46
61
  # Update the quantity already registered as a "Pixel".
47
62
  #
48
- # @param graph_id [String]
49
- # @param date [Date,Time]
50
- # @param quantity [Integer,Float]
63
+ # @param graph_id [String]
64
+ # @param date [Date,Time]
65
+ # @param quantity [Integer,Float]
66
+ # @param optional_data [Object] Additional information other than quantity
51
67
  #
52
- # @return [Hashie::Mash]
68
+ # @return [Pixela::Response]
53
69
  #
54
70
  # @raise [Pixela::PixelaError] API is failed
55
71
  #
56
72
  # @see https://docs.pixe.la/#/put-pixel
57
73
  #
58
74
  # @example
59
- # client.update_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15), quantity: 7)
60
- def update_pixel(graph_id:, date: Date.today, quantity:)
75
+ # client.update_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15), quantity: 7, optional_data: {key: "value"})
76
+ def update_pixel(graph_id:, date: Date.today, quantity:, optional_data: nil)
61
77
  params = {
62
- quantity: quantity.to_s,
78
+ quantity: quantity.to_s,
79
+ optionalData: optional_data&.to_json
63
80
  }
64
81
 
65
82
  with_error_handling do
66
- connection.put("users/#{username}/graphs/#{graph_id}/#{to_ymd(date)}", params, user_token_headers).body
83
+ connection.put("users/#{username}/graphs/#{graph_id}/#{to_ymd(date)}", compact_hash(params)).body
67
84
  end
68
85
  end
69
86
 
@@ -72,7 +89,7 @@ module Pixela::Client::PixelMethods
72
89
  # @param graph_id [String]
73
90
  # @param date [Date,Time]
74
91
  #
75
- # @return [Hashie::Mash]
92
+ # @return [Pixela::Response]
76
93
  #
77
94
  # @raise [Pixela::PixelaError] API is failed
78
95
  #
@@ -82,7 +99,7 @@ module Pixela::Client::PixelMethods
82
99
  # client.delete_pixel(graph_id: "test-graph", date: Date.new(2018, 9, 15))
83
100
  def delete_pixel(graph_id:, date: Date.today)
84
101
  with_error_handling do
85
- connection.delete("users/#{username}/graphs/#{graph_id}/#{to_ymd(date)}", nil, user_token_headers).body
102
+ connection.delete("users/#{username}/graphs/#{graph_id}/#{to_ymd(date)}").body
86
103
  end
87
104
  end
88
105
 
@@ -90,7 +107,7 @@ module Pixela::Client::PixelMethods
90
107
  #
91
108
  # @param graph_id [String]
92
109
  #
93
- # @return [Hashie::Mash]
110
+ # @return [Pixela::Response]
94
111
  #
95
112
  # @raise [Pixela::PixelaError] API is failed
96
113
  #
@@ -100,7 +117,7 @@ module Pixela::Client::PixelMethods
100
117
  # client.increment_pixel(graph_id: "test-graph")
101
118
  def increment_pixel(graph_id:)
102
119
  with_error_handling do
103
- connection.put("users/#{username}/graphs/#{graph_id}/increment", nil, user_token_headers).body
120
+ connection.put("users/#{username}/graphs/#{graph_id}/increment").body
104
121
  end
105
122
  end
106
123
 
@@ -108,7 +125,7 @@ module Pixela::Client::PixelMethods
108
125
  #
109
126
  # @param graph_id [String]
110
127
  #
111
- # @return [Hashie::Mash]
128
+ # @return [Pixela::Response]
112
129
  #
113
130
  # @raise [Pixela::PixelaError] API is failed
114
131
  #
@@ -118,7 +135,7 @@ module Pixela::Client::PixelMethods
118
135
  # client.decrement_pixel(graph_id: "test-graph")
119
136
  def decrement_pixel(graph_id:)
120
137
  with_error_handling do
121
- connection.put("users/#{username}/graphs/#{graph_id}/decrement", nil, user_token_headers).body
138
+ connection.put("users/#{username}/graphs/#{graph_id}/decrement").body
122
139
  end
123
140
  end
124
141
  end
@@ -4,7 +4,7 @@ module Pixela::Client::UserMethods
4
4
  # @param agree_terms_of_service [Boolean]
5
5
  # @param not_minor [Boolean]
6
6
  #
7
- # @return [Hashie::Mash]
7
+ # @return [Pixela::Response]
8
8
  #
9
9
  # @raise [Pixela::PixelaError] API is failed
10
10
  #
@@ -21,7 +21,7 @@ module Pixela::Client::UserMethods
21
21
  }
22
22
 
23
23
  with_error_handling do
24
- connection.post("users", params, default_headers).body
24
+ connection(default_headers).post("users", params).body
25
25
  end
26
26
  end
27
27
 
@@ -29,7 +29,7 @@ module Pixela::Client::UserMethods
29
29
  #
30
30
  # @param new_token [String]
31
31
  #
32
- # @return [Hashie::Mash]
32
+ # @return [Pixela::Response]
33
33
  #
34
34
  # @raise [Pixela::PixelaError] API is failed
35
35
  #
@@ -44,7 +44,7 @@ module Pixela::Client::UserMethods
44
44
 
45
45
  response =
46
46
  with_error_handling do
47
- connection.put("users/#{username}", params, user_token_headers).body
47
+ connection.put("users/#{username}", params).body
48
48
  end
49
49
 
50
50
  @token = new_token
@@ -54,7 +54,7 @@ module Pixela::Client::UserMethods
54
54
 
55
55
  # Deletes the specified registered user.
56
56
  #
57
- # @return [Hashie::Mash]
57
+ # @return [Pixela::Response]
58
58
  #
59
59
  # @raise [Pixela::PixelaError] API is failed
60
60
  #
@@ -64,7 +64,7 @@ module Pixela::Client::UserMethods
64
64
  # client.delete_user
65
65
  def delete_user
66
66
  with_error_handling do
67
- connection.delete("users/#{username}", nil, user_token_headers).body
67
+ connection.delete("users/#{username}").body
68
68
  end
69
69
  end
70
70
  end
@@ -4,7 +4,7 @@ module Pixela::Client::WebhookMethods
4
4
  # @param graph_id [String]
5
5
  # @param type [String]
6
6
  #
7
- # @return [Hashie::Mash]
7
+ # @return [Pixela::Response]
8
8
  #
9
9
  # @raise [Pixela::PixelaError] API is failed
10
10
  #
@@ -19,7 +19,7 @@ module Pixela::Client::WebhookMethods
19
19
  }
20
20
 
21
21
  with_error_handling do
22
- connection.post("users/#{username}/webhooks", params, user_token_headers).body
22
+ connection.post("users/#{username}/webhooks", params).body
23
23
  end
24
24
  end
25
25
 
@@ -35,7 +35,7 @@ module Pixela::Client::WebhookMethods
35
35
  # client.get_webhooks
36
36
  def get_webhooks
37
37
  with_error_handling do
38
- connection.get("users/#{username}/webhooks", nil, user_token_headers).body.webhooks
38
+ connection.get("users/#{username}/webhooks").body.webhooks
39
39
  end
40
40
  end
41
41
 
@@ -43,7 +43,7 @@ module Pixela::Client::WebhookMethods
43
43
  #
44
44
  # @param webhook_hash [String]
45
45
  #
46
- # @return [Hashie::Mash]
46
+ # @return [Pixela::Response]
47
47
  #
48
48
  # @raise [Pixela::PixelaError] API is failed
49
49
  #
@@ -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.post("users/#{username}/webhooks/#{webhook_hash}", nil, default_headers).body
56
+ connection(default_headers).post("users/#{username}/webhooks/#{webhook_hash}").body
57
57
  end
58
58
  end
59
59
 
@@ -61,7 +61,7 @@ module Pixela::Client::WebhookMethods
61
61
  #
62
62
  # @param webhook_hash [String]
63
63
  #
64
- # @return [Hashie::Mash]
64
+ # @return [Pixela::Response]
65
65
  #
66
66
  # @raise [Pixela::PixelaError] API is failed
67
67
  #
@@ -71,7 +71,7 @@ module Pixela::Client::WebhookMethods
71
71
  # client.delete_webhook(webhook_hash: "<webhookHash>")
72
72
  def delete_webhook(webhook_hash:)
73
73
  with_error_handling do
74
- connection.delete("users/#{username}/webhooks/#{webhook_hash}", nil, user_token_headers).body
74
+ connection.delete("users/#{username}/webhooks/#{webhook_hash}").body
75
75
  end
76
76
  end
77
77
  end
@@ -30,7 +30,7 @@ module Pixela
30
30
  # @param color [String]
31
31
  # @param timezone [String]
32
32
  #
33
- # @return [Hashie::Mash]
33
+ # @return [Pixela::Response]
34
34
  #
35
35
  # @raise [Pixela::PixelaError] API is failed
36
36
  #
@@ -66,7 +66,7 @@ module Pixela
66
66
  # @param timezone [String]
67
67
  # @param purge_cache_urls [String,Array<String>]
68
68
  #
69
- # @return [Hashie::Mash]
69
+ # @return [Pixela::Response]
70
70
  #
71
71
  # @raise [Pixela::PixelaError] API is failed
72
72
  #
@@ -80,7 +80,7 @@ module Pixela
80
80
 
81
81
  # Delete the predefined pixelation graph definition.
82
82
  #
83
- # @return [Hashie::Mash]
83
+ # @return [Pixela::Response]
84
84
  #
85
85
  # @raise [Pixela::PixelaError] API is failed
86
86
  #
@@ -94,7 +94,7 @@ module Pixela
94
94
 
95
95
  # Increment quantity "Pixel" of the day (UTC).
96
96
  #
97
- # @return [Hashie::Mash]
97
+ # @return [Pixela::Response]
98
98
  #
99
99
  # @raise [Pixela::PixelaError] API is failed
100
100
  #
@@ -108,7 +108,7 @@ module Pixela
108
108
 
109
109
  # Decrement quantity "Pixel" of the day (UTC).
110
110
  #
111
- # @return [Hashie::Mash]
111
+ # @return [Pixela::Response]
112
112
  #
113
113
  # @raise [Pixela::PixelaError] API is failed
114
114
  #
@@ -23,23 +23,24 @@ module Pixela
23
23
 
24
24
  # It records the quantity of the specified date as a "Pixel".
25
25
  #
26
- # @param quantity [Integer,Float]
26
+ # @param quantity [Integer,Float]
27
+ # @param optional_data [Object] Additional information other than quantity
27
28
  #
28
- # @return [Hashie::Mash]
29
+ # @return [Pixela::Response]
29
30
  #
30
31
  # @raise [Pixela::PixelaError] API is failed
31
32
  #
32
33
  # @see https://docs.pixe.la/#/post-pixel
33
34
  #
34
35
  # @example
35
- # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).create(quantity: 5)
36
- def create(quantity:)
37
- client.create_pixel(graph_id: graph_id, date: date, quantity: quantity)
36
+ # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).create(quantity: 5, optional_data: {key: "value"})
37
+ def create(quantity:, optional_data: nil)
38
+ client.create_pixel(graph_id: graph_id, date: date, quantity: quantity, optional_data: optional_data)
38
39
  end
39
40
 
40
41
  # Get registered quantity as "Pixel".
41
42
  #
42
- # @return [Hashie::Mash]
43
+ # @return [Pixela::Response]
43
44
  #
44
45
  # @raise [Pixela::PixelaError] API is failed
45
46
  #
@@ -53,23 +54,24 @@ module Pixela
53
54
 
54
55
  # Update the quantity already registered as a "Pixel".
55
56
  #
56
- # @param quantity [Integer,Float]
57
+ # @param quantity [Integer,Float]
58
+ # @param optional_data [Object] Additional information other than quantity
57
59
  #
58
- # @return [Hashie::Mash]
60
+ # @return [Pixela::Response]
59
61
  #
60
62
  # @raise [Pixela::PixelaError] API is failed
61
63
  #
62
64
  # @see https://docs.pixe.la/#/put-pixel
63
65
  #
64
66
  # @example
65
- # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).update(quantity: 7)
66
- def update(quantity:)
67
- client.update_pixel(graph_id: graph_id, date: date, quantity: quantity)
67
+ # client.graph("test-graph").pixel(Date.new(2018, 9, 15)).update(quantity: 7, optional_data: {key: "value"})
68
+ def update(quantity:, optional_data: nil)
69
+ client.update_pixel(graph_id: graph_id, date: date, quantity: quantity, optional_data: optional_data)
68
70
  end
69
71
 
70
72
  # Delete the registered "Pixel".
71
73
  #
72
- # @return [Hashie::Mash]
74
+ # @return [Pixela::Response]
73
75
  #
74
76
  # @raise [Pixela::PixelaError] API is failed
75
77
  #
@@ -0,0 +1,7 @@
1
+ module Pixela
2
+ require "hashie/mash"
3
+
4
+ class Response < Hashie::Mash
5
+ disable_warnings
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Pixela
2
- VERSION = "0.5.2"
2
+ VERSION = "1.0.0"
3
3
  end
@@ -17,7 +17,7 @@ module Pixela
17
17
 
18
18
  # Invoke the webhook registered in advance.
19
19
  #
20
- # @return [Hashie::Mash]
20
+ # @return [Pixela::Response]
21
21
  #
22
22
  # @raise [Pixela::PixelaError] API is failed
23
23
  #
@@ -31,7 +31,7 @@ module Pixela
31
31
 
32
32
  # Delete the registered Webhook.
33
33
  #
34
- # @return [Hashie::Mash]
34
+ # @return [Pixela::Response]
35
35
  #
36
36
  # @raise [Pixela::PixelaError] API is failed
37
37
  #
@@ -34,13 +34,14 @@ Gem::Specification.new do |spec|
34
34
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
35
35
  spec.require_paths = ["lib"]
36
36
 
37
+ spec.required_ruby_version = ">= 2.3.0"
38
+
37
39
  spec.add_dependency "faraday"
38
40
  spec.add_dependency "faraday_curl"
39
41
  spec.add_dependency "faraday_middleware"
40
42
  spec.add_dependency "hashie"
41
43
 
42
- spec.add_development_dependency "bundler", "~> 1.16"
43
- spec.add_development_dependency "codeclimate-test-reporter", "~> 1.0.0"
44
+ spec.add_development_dependency "bundler", ">= 1.16"
44
45
  spec.add_development_dependency "coveralls"
45
46
  spec.add_development_dependency "dotenv"
46
47
  spec.add_development_dependency "pry-byebug"
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.2
4
+ version: 1.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: 2018-11-10 00:00:00.000000000 Z
11
+ date: 2019-01-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -70,30 +70,16 @@ dependencies:
70
70
  name: bundler
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - "~>"
73
+ - - ">="
74
74
  - !ruby/object:Gem::Version
75
75
  version: '1.16'
76
76
  type: :development
77
77
  prerelease: false
78
78
  version_requirements: !ruby/object:Gem::Requirement
79
79
  requirements:
80
- - - "~>"
80
+ - - ">="
81
81
  - !ruby/object:Gem::Version
82
82
  version: '1.16'
83
- - !ruby/object:Gem::Dependency
84
- name: codeclimate-test-reporter
85
- requirement: !ruby/object:Gem::Requirement
86
- requirements:
87
- - - "~>"
88
- - !ruby/object:Gem::Version
89
- version: 1.0.0
90
- type: :development
91
- prerelease: false
92
- version_requirements: !ruby/object:Gem::Requirement
93
- requirements:
94
- - - "~>"
95
- - !ruby/object:Gem::Version
96
- version: 1.0.0
97
83
  - !ruby/object:Gem::Dependency
98
84
  name: coveralls
99
85
  requirement: !ruby/object:Gem::Requirement
@@ -263,6 +249,7 @@ files:
263
249
  - lib/pixela/configuration.rb
264
250
  - lib/pixela/graph.rb
265
251
  - lib/pixela/pixel.rb
252
+ - lib/pixela/response.rb
266
253
  - lib/pixela/version.rb
267
254
  - lib/pixela/webhook.rb
268
255
  - pixela.gemspec
@@ -281,15 +268,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
281
268
  requirements:
282
269
  - - ">="
283
270
  - !ruby/object:Gem::Version
284
- version: '0'
271
+ version: 2.3.0
285
272
  required_rubygems_version: !ruby/object:Gem::Requirement
286
273
  requirements:
287
274
  - - ">="
288
275
  - !ruby/object:Gem::Version
289
276
  version: '0'
290
277
  requirements: []
291
- rubyforge_project:
292
- rubygems_version: 2.7.7
278
+ rubygems_version: 3.0.1
293
279
  signing_key:
294
280
  specification_version: 4
295
281
  summary: Pixela API client for Ruby