pixela 3.1.0 → 3.3.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/pages.yml +6 -9
 - data/.github/workflows/test.yml +9 -13
 - data/CHANGELOG.md +15 -1
 - data/lib/pixela/client/graph_methods.rb +18 -0
 - data/lib/pixela/client/pixel_methods.rb +27 -0
 - data/lib/pixela/graph.rb +14 -0
 - data/lib/pixela/pixel.rb +16 -0
 - data/lib/pixela/version.rb +1 -1
 - metadata +3 -3
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 70ad266dd772aa47bb3201ceeb05f8f68c5ec6aac5f9f42f6955065d36459214
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 4d5431713d481a5115eedd74ec96507217420d260407d44576179b436df873ca
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: ce88158d30ec96dbe366f37a944bd2227a816666459fcac18b36a975e8ff135995a7db4ddc25ad6b45dd802c6591cac54d0d2b07d5ea7accfa2ee7f018889f96
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: a93bf0966fbd6fefb7f8fe8101e20b30e951ff2ea2b9c55d61de8a434ad436bd96cb1a0904f7ebf79cbe4bfbe6b35eb2de142d9b561e8a4eec3aa98ce7ad75fa
         
     | 
    
        data/.github/workflows/pages.yml
    CHANGED
    
    | 
         @@ -30,7 +30,7 @@ jobs: 
     | 
|
| 
       30 
30 
     | 
    
         
             
                runs-on: ubuntu-latest
         
     | 
| 
       31 
31 
     | 
    
         
             
                steps:
         
     | 
| 
       32 
32 
     | 
    
         
             
                  - name: Checkout
         
     | 
| 
       33 
     | 
    
         
            -
                    uses: actions/checkout@ 
     | 
| 
      
 33 
     | 
    
         
            +
                    uses: actions/checkout@v4
         
     | 
| 
       34 
34 
     | 
    
         | 
| 
       35 
35 
     | 
    
         
             
                  - uses: ruby/setup-ruby@v1
         
     | 
| 
       36 
36 
     | 
    
         
             
                    with:
         
     | 
| 
         @@ -40,9 +40,9 @@ jobs: 
     | 
|
| 
       40 
40 
     | 
    
         
             
                  - run: bundle exec yard
         
     | 
| 
       41 
41 
     | 
    
         | 
| 
       42 
42 
     | 
    
         
             
                  - name: Setup Pages
         
     | 
| 
       43 
     | 
    
         
            -
                    uses: actions/configure-pages@ 
     | 
| 
      
 43 
     | 
    
         
            +
                    uses: actions/configure-pages@v5
         
     | 
| 
       44 
44 
     | 
    
         
             
                  - name: Upload artifact
         
     | 
| 
       45 
     | 
    
         
            -
                    uses: actions/upload-pages-artifact@ 
     | 
| 
      
 45 
     | 
    
         
            +
                    uses: actions/upload-pages-artifact@v3
         
     | 
| 
       46 
46 
     | 
    
         
             
                    with:
         
     | 
| 
       47 
47 
     | 
    
         
             
                      # Upload entire repository
         
     | 
| 
       48 
48 
     | 
    
         
             
                      path: './doc'
         
     | 
| 
         @@ -51,12 +51,9 @@ jobs: 
     | 
|
| 
       51 
51 
     | 
    
         
             
                    uses: actions/deploy-pages@main
         
     | 
| 
       52 
52 
     | 
    
         | 
| 
       53 
53 
     | 
    
         
             
                  - name: Slack Notification (not success)
         
     | 
| 
       54 
     | 
    
         
            -
                    uses:  
     | 
| 
      
 54 
     | 
    
         
            +
                    uses: act10ns/slack@v2
         
     | 
| 
       55 
55 
     | 
    
         
             
                    if: "! success()"
         
     | 
| 
       56 
56 
     | 
    
         
             
                    continue-on-error: true
         
     | 
| 
       57 
57 
     | 
    
         
             
                    with:
         
     | 
| 
       58 
     | 
    
         
            -
                       
     | 
| 
       59 
     | 
    
         
            -
                       
     | 
| 
       60 
     | 
    
         
            -
                      icon_emoji: ":octocat:"
         
     | 
| 
       61 
     | 
    
         
            -
                      url: ${{ secrets.SLACK_WEBHOOK }}
         
     | 
| 
       62 
     | 
    
         
            -
                      token: ${{ secrets.GITHUB_TOKEN }}
         
     | 
| 
      
 58 
     | 
    
         
            +
                      status: ${{ job.status }}
         
     | 
| 
      
 59 
     | 
    
         
            +
                      webhook-url: ${{ secrets.SLACK_WEBHOOK }}
         
     | 
    
        data/.github/workflows/test.yml
    CHANGED
    
    | 
         @@ -29,11 +29,12 @@ jobs: 
     | 
|
| 
       29 
29 
     | 
    
         
             
                      - "3.0"
         
     | 
| 
       30 
30 
     | 
    
         
             
                      - "3.1"
         
     | 
| 
       31 
31 
     | 
    
         
             
                      - "3.2"
         
     | 
| 
      
 32 
     | 
    
         
            +
                      - "3.3"
         
     | 
| 
       32 
33 
     | 
    
         
             
                    gemfile:
         
     | 
| 
       33 
34 
     | 
    
         
             
                      - faraday_2
         
     | 
| 
       34 
35 
     | 
    
         | 
| 
       35 
36 
     | 
    
         
             
                steps:
         
     | 
| 
       36 
     | 
    
         
            -
                  - uses: actions/checkout@ 
     | 
| 
      
 37 
     | 
    
         
            +
                  - uses: actions/checkout@v4
         
     | 
| 
       37 
38 
     | 
    
         | 
| 
       38 
39 
     | 
    
         
             
                  - uses: ruby/setup-ruby@v1
         
     | 
| 
       39 
40 
     | 
    
         
             
                    with:
         
     | 
| 
         @@ -70,15 +71,13 @@ jobs: 
     | 
|
| 
       70 
71 
     | 
    
         
             
                    continue-on-error: true
         
     | 
| 
       71 
72 
     | 
    
         | 
| 
       72 
73 
     | 
    
         
             
                  - name: Slack Notification (not success)
         
     | 
| 
       73 
     | 
    
         
            -
                    uses:  
     | 
| 
      
 74 
     | 
    
         
            +
                    uses: act10ns/slack@v2
         
     | 
| 
       74 
75 
     | 
    
         
             
                    if: "! success()"
         
     | 
| 
       75 
76 
     | 
    
         
             
                    continue-on-error: true
         
     | 
| 
       76 
77 
     | 
    
         
             
                    with:
         
     | 
| 
       77 
     | 
    
         
            -
                       
     | 
| 
       78 
     | 
    
         
            -
                       
     | 
| 
       79 
     | 
    
         
            -
                       
     | 
| 
       80 
     | 
    
         
            -
                      url: ${{ secrets.SLACK_WEBHOOK }}
         
     | 
| 
       81 
     | 
    
         
            -
                      token: ${{ secrets.GITHUB_TOKEN }}
         
     | 
| 
      
 78 
     | 
    
         
            +
                      status: ${{ job.status }}
         
     | 
| 
      
 79 
     | 
    
         
            +
                      webhook-url: ${{ secrets.SLACK_WEBHOOK }}
         
     | 
| 
      
 80 
     | 
    
         
            +
                      matrix: ${{ toJson(matrix) }}
         
     | 
| 
       82 
81 
     | 
    
         | 
| 
       83 
82 
     | 
    
         
             
              notify:
         
     | 
| 
       84 
83 
     | 
    
         
             
                needs:
         
     | 
| 
         @@ -88,12 +87,9 @@ jobs: 
     | 
|
| 
       88 
87 
     | 
    
         | 
| 
       89 
88 
     | 
    
         
             
                steps:
         
     | 
| 
       90 
89 
     | 
    
         
             
                  - name: Slack Notification (success)
         
     | 
| 
       91 
     | 
    
         
            -
                    uses:  
     | 
| 
      
 90 
     | 
    
         
            +
                    uses: act10ns/slack@v2
         
     | 
| 
       92 
91 
     | 
    
         
             
                    if: always()
         
     | 
| 
       93 
92 
     | 
    
         
             
                    continue-on-error: true
         
     | 
| 
       94 
93 
     | 
    
         
             
                    with:
         
     | 
| 
       95 
     | 
    
         
            -
                       
     | 
| 
       96 
     | 
    
         
            -
                       
     | 
| 
       97 
     | 
    
         
            -
                      icon_emoji: ":octocat:"
         
     | 
| 
       98 
     | 
    
         
            -
                      url: ${{ secrets.SLACK_WEBHOOK }}
         
     | 
| 
       99 
     | 
    
         
            -
                      token: ${{ secrets.GITHUB_TOKEN }}
         
     | 
| 
      
 94 
     | 
    
         
            +
                      status: ${{ job.status }}
         
     | 
| 
      
 95 
     | 
    
         
            +
                      webhook-url: ${{ secrets.SLACK_WEBHOOK }}
         
     | 
    
        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.3.0...master)
         
     | 
| 
      
 3 
     | 
    
         
            +
             
     | 
| 
      
 4 
     | 
    
         
            +
            ## v3.3.0
         
     | 
| 
      
 5 
     | 
    
         
            +
            [full changelog](http://github.com/sue445/pixela/compare/v3.2.0...v3.3.0)
         
     | 
| 
      
 6 
     | 
    
         
            +
             
     | 
| 
      
 7 
     | 
    
         
            +
            * Add `Pixela::Client::GraphMethods#get_graph_latest` and `Pixela::Graph#latest`
         
     | 
| 
      
 8 
     | 
    
         
            +
              * https://github.com/sue445/pixela/pull/110
         
     | 
| 
      
 9 
     | 
    
         
            +
              * https://github.com/a-know/Pixela/releases/tag/v1.29.0
         
     | 
| 
      
 10 
     | 
    
         
            +
             
     | 
| 
      
 11 
     | 
    
         
            +
            ## v3.2.0
         
     | 
| 
      
 12 
     | 
    
         
            +
            [full changelog](http://github.com/sue445/pixela/compare/v3.1.0...v3.2.0)
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
            * Add `Pixela::Client::PixelMethods#create_pixels` and `Pixela::Pixel#create_multi`
         
     | 
| 
      
 15 
     | 
    
         
            +
              * https://github.com/sue445/pixela/pull/105
         
     | 
| 
      
 16 
     | 
    
         
            +
              * https://github.com/a-know/Pixela/releases/tag/v1.28.0
         
     | 
| 
       3 
17 
     | 
    
         | 
| 
       4 
18 
     | 
    
         
             
            ## v3.1.0
         
     | 
| 
       5 
19 
     | 
    
         
             
            [full changelog](http://github.com/sue445/pixela/compare/v3.0.0...v3.1.0)
         
     | 
| 
         @@ -258,4 +258,22 @@ module Pixela::Client::GraphMethods 
     | 
|
| 
       258 
258 
     | 
    
         
             
                  connection.get("users/#{username}/graphs/#{graph_id}/graph-def").body
         
     | 
| 
       259 
259 
     | 
    
         
             
                end
         
     | 
| 
       260 
260 
     | 
    
         
             
              end
         
     | 
| 
      
 261 
     | 
    
         
            +
             
     | 
| 
      
 262 
     | 
    
         
            +
              # This API is used to get latest Pixel of the graph which specified by <graphID> .
         
     | 
| 
      
 263 
     | 
    
         
            +
              #
         
     | 
| 
      
 264 
     | 
    
         
            +
              # @param graph_id [String]
         
     | 
| 
      
 265 
     | 
    
         
            +
              #
         
     | 
| 
      
 266 
     | 
    
         
            +
              # @return [Pixela::Response]
         
     | 
| 
      
 267 
     | 
    
         
            +
              #
         
     | 
| 
      
 268 
     | 
    
         
            +
              # @raise [Pixela::PixelaError] API is failed
         
     | 
| 
      
 269 
     | 
    
         
            +
              #
         
     | 
| 
      
 270 
     | 
    
         
            +
              # @see https://docs.pixe.la/entry/get-latest-pixel
         
     | 
| 
      
 271 
     | 
    
         
            +
              #
         
     | 
| 
      
 272 
     | 
    
         
            +
              # @example
         
     | 
| 
      
 273 
     | 
    
         
            +
              #   client.get_graph_latest(graph_id: "test-graph")
         
     | 
| 
      
 274 
     | 
    
         
            +
              def get_graph_latest(graph_id:)
         
     | 
| 
      
 275 
     | 
    
         
            +
                with_error_handling do
         
     | 
| 
      
 276 
     | 
    
         
            +
                  connection.get("users/#{username}/graphs/#{graph_id}/latest").body
         
     | 
| 
      
 277 
     | 
    
         
            +
                end
         
     | 
| 
      
 278 
     | 
    
         
            +
              end
         
     | 
| 
       261 
279 
     | 
    
         
             
            end
         
     | 
| 
         @@ -26,6 +26,33 @@ module Pixela::Client::PixelMethods 
     | 
|
| 
       26 
26 
     | 
    
         
             
                end
         
     | 
| 
       27 
27 
     | 
    
         
             
              end
         
     | 
| 
       28 
28 
     | 
    
         | 
| 
      
 29 
     | 
    
         
            +
              # This API is used to register multiple Pixels (quantities for a specific day) at a time.
         
     | 
| 
      
 30 
     | 
    
         
            +
              #
         
     | 
| 
      
 31 
     | 
    
         
            +
              # @param graph_id [String]
         
     | 
| 
      
 32 
     | 
    
         
            +
              # @param pixels   [Array<Hash>] key: date, quantity, optional_data
         
     | 
| 
      
 33 
     | 
    
         
            +
              #
         
     | 
| 
      
 34 
     | 
    
         
            +
              # @return [Pixela::Response]
         
     | 
| 
      
 35 
     | 
    
         
            +
              #
         
     | 
| 
      
 36 
     | 
    
         
            +
              # @raise [Pixela::PixelaError] API is failed
         
     | 
| 
      
 37 
     | 
    
         
            +
              #
         
     | 
| 
      
 38 
     | 
    
         
            +
              # @see https://docs.pixe.la/entry/batch-post-pixels
         
     | 
| 
      
 39 
     | 
    
         
            +
              #
         
     | 
| 
      
 40 
     | 
    
         
            +
              # @example
         
     | 
| 
      
 41 
     | 
    
         
            +
              #   client.create_pixels(graph_id: "test-graph", pixels: [{date: Date.new(2018, 9, 15), quantity: 5, optional_data: {key: "value"}}])
         
     | 
| 
      
 42 
     | 
    
         
            +
              def create_pixels(graph_id:, pixels:)
         
     | 
| 
      
 43 
     | 
    
         
            +
                pixels = pixels.map do |pixel|
         
     | 
| 
      
 44 
     | 
    
         
            +
                  {
         
     | 
| 
      
 45 
     | 
    
         
            +
                    date:         to_ymd(pixel[:date]),
         
     | 
| 
      
 46 
     | 
    
         
            +
                    quantity:     pixel[:quantity].to_s,
         
     | 
| 
      
 47 
     | 
    
         
            +
                    optionalData: pixel[:optional_data]&.to_json,
         
     | 
| 
      
 48 
     | 
    
         
            +
                  }.compact
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
             
     | 
| 
      
 51 
     | 
    
         
            +
                with_error_handling do
         
     | 
| 
      
 52 
     | 
    
         
            +
                  connection.post("users/#{username}/graphs/#{graph_id}/pixels", pixels).body
         
     | 
| 
      
 53 
     | 
    
         
            +
                end
         
     | 
| 
      
 54 
     | 
    
         
            +
              end
         
     | 
| 
      
 55 
     | 
    
         
            +
             
     | 
| 
       29 
56 
     | 
    
         
             
              # Get registered quantity as "Pixel".
         
     | 
| 
       30 
57 
     | 
    
         
             
              #
         
     | 
| 
       31 
58 
     | 
    
         
             
              # @param graph_id [String]
         
     | 
    
        data/lib/pixela/graph.rb
    CHANGED
    
    | 
         @@ -244,5 +244,19 @@ module Pixela 
     | 
|
| 
       244 
244 
     | 
    
         
             
                end
         
     | 
| 
       245 
245 
     | 
    
         | 
| 
       246 
246 
     | 
    
         
             
                alias_method :definition, :def
         
     | 
| 
      
 247 
     | 
    
         
            +
             
     | 
| 
      
 248 
     | 
    
         
            +
                # This API is used to get latest Pixel of the graph which specified by <graphID> .
         
     | 
| 
      
 249 
     | 
    
         
            +
                #
         
     | 
| 
      
 250 
     | 
    
         
            +
                # @return [Pixela::Response]
         
     | 
| 
      
 251 
     | 
    
         
            +
                #
         
     | 
| 
      
 252 
     | 
    
         
            +
                # @raise [Pixela::PixelaError] API is failed
         
     | 
| 
      
 253 
     | 
    
         
            +
                #
         
     | 
| 
      
 254 
     | 
    
         
            +
                # @see https://docs.pixe.la/entry/get-latest-pixel
         
     | 
| 
      
 255 
     | 
    
         
            +
                #
         
     | 
| 
      
 256 
     | 
    
         
            +
                # @example
         
     | 
| 
      
 257 
     | 
    
         
            +
                #   client.graph("test-graph").latest
         
     | 
| 
      
 258 
     | 
    
         
            +
                def latest
         
     | 
| 
      
 259 
     | 
    
         
            +
                  client.get_graph_latest(graph_id: graph_id)
         
     | 
| 
      
 260 
     | 
    
         
            +
                end
         
     | 
| 
       247 
261 
     | 
    
         
             
              end
         
     | 
| 
       248 
262 
     | 
    
         
             
            end
         
     | 
    
        data/lib/pixela/pixel.rb
    CHANGED
    
    | 
         @@ -38,6 +38,22 @@ module Pixela 
     | 
|
| 
       38 
38 
     | 
    
         
             
                  client.create_pixel(graph_id: graph_id, date: date, quantity: quantity, optional_data: optional_data)
         
     | 
| 
       39 
39 
     | 
    
         
             
                end
         
     | 
| 
       40 
40 
     | 
    
         | 
| 
      
 41 
     | 
    
         
            +
                # This API is used to register multiple Pixels (quantities for a specific day) at a time.
         
     | 
| 
      
 42 
     | 
    
         
            +
                #
         
     | 
| 
      
 43 
     | 
    
         
            +
                # @param pixels [Array<Hash>] key: date, quantity, optional_data
         
     | 
| 
      
 44 
     | 
    
         
            +
                #
         
     | 
| 
      
 45 
     | 
    
         
            +
                # @return [Pixela::Response]
         
     | 
| 
      
 46 
     | 
    
         
            +
                #
         
     | 
| 
      
 47 
     | 
    
         
            +
                # @raise [Pixela::PixelaError] API is failed
         
     | 
| 
      
 48 
     | 
    
         
            +
                #
         
     | 
| 
      
 49 
     | 
    
         
            +
                # @see https://docs.pixe.la/entry/batch-post-pixels
         
     | 
| 
      
 50 
     | 
    
         
            +
                #
         
     | 
| 
      
 51 
     | 
    
         
            +
                # @example
         
     | 
| 
      
 52 
     | 
    
         
            +
                #   client.graph("test-graph").create_multi(pixels: [{date: Date.new(2018, 9, 15), quantity: 5, optional_data: {key: "value"}}])
         
     | 
| 
      
 53 
     | 
    
         
            +
                def create_multi(pixels:)
         
     | 
| 
      
 54 
     | 
    
         
            +
                  client.create_pixels(graph_id: graph_id, pixels: pixels)
         
     | 
| 
      
 55 
     | 
    
         
            +
                end
         
     | 
| 
      
 56 
     | 
    
         
            +
             
     | 
| 
       41 
57 
     | 
    
         
             
                # Get registered quantity as "Pixel".
         
     | 
| 
       42 
58 
     | 
    
         
             
                #
         
     | 
| 
       43 
59 
     | 
    
         
             
                # @return [Pixela::Response]
         
     | 
    
        data/lib/pixela/version.rb
    CHANGED
    
    
    
        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: 3. 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 3.3.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - sue445
         
     | 
| 
       8 
8 
     | 
    
         
             
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: exe
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
     | 
    
         
            -
            date:  
     | 
| 
      
 11 
     | 
    
         
            +
            date: 2024-04-18 00:00:00.000000000 Z
         
     | 
| 
       12 
12 
     | 
    
         
             
            dependencies:
         
     | 
| 
       13 
13 
     | 
    
         
             
            - !ruby/object:Gem::Dependency
         
     | 
| 
       14 
14 
     | 
    
         
             
              name: faraday
         
     | 
| 
         @@ -268,7 +268,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       268 
268 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       269 
269 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       270 
270 
     | 
    
         
             
            requirements: []
         
     | 
| 
       271 
     | 
    
         
            -
            rubygems_version: 3. 
     | 
| 
      
 271 
     | 
    
         
            +
            rubygems_version: 3.5.3
         
     | 
| 
       272 
272 
     | 
    
         
             
            signing_key:
         
     | 
| 
       273 
273 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       274 
274 
     | 
    
         
             
            summary: Pixela API client for Ruby
         
     |