pixela 1.0.1 → 1.1.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: '07816d9da5bb534af1596f797a7cb5a82fd3b635c0fbe4c1b42c94266a89868d'
4
- data.tar.gz: 540f47348bba2f20b471b39a04ab4e9ff07c59fb5c983edc0ec6e9cd5dc72706
3
+ metadata.gz: dcc5605956279b4c01b0c67fb573e7c28623c78b488a74b323922790de902e7d
4
+ data.tar.gz: c4f32689c73fe71b27a5fd24530dd4b58220ca6ad9903cf44700c07d5f9215ed
5
5
  SHA512:
6
- metadata.gz: 6ca1181768bf1e080bf5747145c0a8990a2d251c30ffcc7519dd35f745f60c77aa0e1549b68238613ff7df36542474891b319e9a87d8e8478908211d05dadf38
7
- data.tar.gz: 18ce471b6e4de30147bc919b21595e70f9178eec342cfaeff89546d0a2a802f0ea805847c76216575189755600b039d84556ae13184937587ed2ecdeabc13ef0
6
+ metadata.gz: 149f1ee7315422c8d31b6d1fbc0cff9a668be0b044563a16f3c22d2388f313361dbe8d6713b16127612220d7ff670570f4ae2285fef140b1ea46e8d769936b93
7
+ data.tar.gz: 70856d12a2fbe7cc92fcf8c2697aef7a3ba98f6bf8a4659a9708a2edb06b8122f2dfeb3ebd5241550bb0cedd45584d405d822c9d9a5b3e272ffae10a2de54f60
@@ -17,6 +17,7 @@ before_script:
17
17
  script:
18
18
  - bundle exec rspec
19
19
  after_script:
20
+ - if [ "$PIXELA_WEBHOOK_URL" != "" ]; then curl -X POST $PIXELA_WEBHOOK_URL -H 'Content-Length:0'; fi
20
21
  - ./cc-test-reporter after-build --exit-code $TRAVIS_TEST_RESULT
21
22
  branches:
22
23
  only:
@@ -1,5 +1,12 @@
1
1
  ## Unreleased
2
- [full changelog](http://github.com/sue445/pixela/compare/v1.0.1...master)
2
+ [full changelog](http://github.com/sue445/pixela/compare/v1.1.0...master)
3
+
4
+ ## v1.1.0
5
+ [full changelog](http://github.com/sue445/pixela/compare/v1.0.1...v1.1.1)
6
+
7
+ * Add `Pixela::Client#get_pixel_dates` and `Pixela::Graph#pixel_dates`
8
+ * https://github.com/sue445/pixela/pull/49
9
+ * https://github.com/a-know/Pixela/releases/tag/v1.8.0
3
10
 
4
11
  ## v1.0.1
5
12
  [full changelog](http://github.com/sue445/pixela/compare/v1.0.0...v1.0.1)
data/README.md CHANGED
@@ -7,6 +7,8 @@
7
7
  [![Maintainability](https://api.codeclimate.com/v1/badges/4c6316222717ee809b57/maintainability)](https://codeclimate.com/github/sue445/pixela/maintainability)
8
8
  [![Coverage Status](https://coveralls.io/repos/github/sue445/pixela/badge.svg)](https://coveralls.io/github/sue445/pixela)
9
9
 
10
+ [![CI activity of pixela-gem](https://pixe.la/v1/users/sue445/graphs/pixela-gem-ci)](https://pixe.la/v1/users/sue445/graphs/pixela-gem-ci.html)
11
+
10
12
  ## Installation
11
13
 
12
14
  Add this line to your application's Gemfile:
@@ -95,6 +95,8 @@ module Pixela
95
95
  end
96
96
 
97
97
  def to_ymd(date)
98
+ return nil unless date
99
+
98
100
  date.strftime("%Y%m%d")
99
101
  end
100
102
 
@@ -127,4 +127,32 @@ module Pixela::Client::GraphMethods
127
127
  connection.delete("users/#{username}/graphs/#{graph_id}").body
128
128
  end
129
129
  end
130
+
131
+ # Get a Date list of Pixel registered in the graph specified by graphID.
132
+ #
133
+ # @param graph_id [String]
134
+ # @param from [Date] Specify the start position of the period.
135
+ # @param to [Date] Specify the end position of the period.
136
+ #
137
+ # @return [Array<Date>]
138
+ #
139
+ # @raise [Pixela::PixelaError] API is failed
140
+ #
141
+ # @see https://docs.pixe.la/#/get-graph-pixels
142
+ #
143
+ # @example
144
+ # client.get_pixel_dates(graph_id: "test-graph", from: Date.new(2018, 1, 1), to: Date.new(2018, 12, 31))
145
+ def get_pixel_dates(graph_id:, from: nil, to: nil)
146
+ params = {
147
+ from: to_ymd(from),
148
+ to: to_ymd(to),
149
+ }
150
+
151
+ res =
152
+ with_error_handling do
153
+ connection.get("users/#{username}/graphs/#{graph_id}/pixels", compact_hash(params)).body
154
+ end
155
+
156
+ res.pixels.map { |ymd| Date.parse(ymd) }
157
+ end
130
158
  end
@@ -121,5 +121,22 @@ module Pixela
121
121
  def decrement
122
122
  client.decrement_pixel(graph_id: graph_id)
123
123
  end
124
+
125
+ # Get a Date list of Pixel registered in the graph specified by graphID.
126
+ #
127
+ # @param from [Date] Specify the start position of the period.
128
+ # @param to [Date] Specify the end position of the period.
129
+ #
130
+ # @return [Array<Date>]
131
+ #
132
+ # @raise [Pixela::PixelaError] API is failed
133
+ #
134
+ # @see https://docs.pixe.la/#/get-graph-pixels
135
+ #
136
+ # @example
137
+ # client.get_pixels(graph_id: "test-graph", from: Date.new(2018, 1, 1), to: Date.new(2018, 12, 31))
138
+ def pixel_dates(from: nil, to: nil)
139
+ client.get_pixel_dates(graph_id: graph_id, from: from, to: to)
140
+ end
124
141
  end
125
142
  end
@@ -1,3 +1,3 @@
1
1
  module Pixela
2
- VERSION = "1.0.1"
2
+ VERSION = "1.1.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: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - sue445
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2019-01-30 00:00:00.000000000 Z
11
+ date: 2019-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday