lib/pixela/graph.rb in pixela-3.0.0 vs lib/pixela/graph.rb in pixela-3.1.0
- old
+ new
@@ -130,9 +130,41 @@
# client.graph("test-graph").decrement
def decrement
client.decrement_pixel(graph_id: graph_id)
end
+ # Add quantity to the "Pixel" of the day
+ #
+ # @param quantity [String]
+ #
+ # @return [Pixela::Response]
+ #
+ # @raise [Pixela::PixelaError] API is failed
+ #
+ # @see https://docs.pixe.la/entry/add-pixel
+ #
+ # @example
+ # client.graph("test-graph").add(quantity: "1")
+ def add(quantity:)
+ client.add_pixel(graph_id: graph_id, quantity: quantity)
+ end
+
+ # Subtract quantity from the "Pixel" of the day
+ #
+ # @param quantity [String]
+ #
+ # @return [Pixela::Response]
+ #
+ # @raise [Pixela::PixelaError] API is failed
+ #
+ # @see https://docs.pixe.la/entry/subtract-pixel
+ #
+ # @example
+ # client.graph("test-graph").subtract(quantity: "1")
+ def subtract(quantity:)
+ client.subtract_pixel(graph_id: graph_id, quantity: quantity)
+ end
+
# Get a Date list of Pixel registered in the graph specified by graphID.
#
# @param from [Date] Specify the start position of the period.
# @param to [Date] Specify the end position of the period.
#