Class: Pixela::Pixel
- Inherits:
-
Object
- Object
- Pixela::Pixel
- Defined in:
- lib/pixela/pixel.rb
Instance Attribute Summary collapse
- #client ⇒ Pixela::Client readonly
- #date ⇒ Date readonly
- #graph_id ⇒ String readonly
Instance Method Summary collapse
-
#create(quantity:, optional_data: nil) ⇒ Pixela::Response
It records the quantity of the specified date as a “Pixel”.
-
#create_multi(pixels:) ⇒ Pixela::Response
This API is used to register multiple Pixels (quantities for a specific day) at a time.
-
#delete ⇒ Pixela::Response
Delete the registered “Pixel”.
-
#get ⇒ Pixela::Response
Get registered quantity as “Pixel”.
-
#initialize(client:, graph_id:, date:) ⇒ Pixel
constructor
A new instance of Pixel.
-
#update(quantity:, optional_data: nil) ⇒ Pixela::Response
Update the quantity already registered as a “Pixel”.
Constructor Details
#initialize(client:, graph_id:, date:) ⇒ Pixel
Returns a new instance of Pixel.
18 19 20 21 22 |
# File 'lib/pixela/pixel.rb', line 18 def initialize(client:, graph_id:, date:) @client = client @graph_id = graph_id @date = date end |
Instance Attribute Details
#client ⇒ Pixela::Client (readonly)
5 6 7 |
# File 'lib/pixela/pixel.rb', line 5 def client @client end |
#date ⇒ Date (readonly)
13 14 15 |
# File 'lib/pixela/pixel.rb', line 13 def date @date end |
#graph_id ⇒ String (readonly)
9 10 11 |
# File 'lib/pixela/pixel.rb', line 9 def graph_id @graph_id end |
Instance Method Details
#create(quantity:, optional_data: nil) ⇒ Pixela::Response
It records the quantity of the specified date as a “Pixel”.
37 38 39 |
# File 'lib/pixela/pixel.rb', line 37 def create(quantity:, optional_data: nil) client.create_pixel(graph_id: graph_id, date: date, quantity: quantity, optional_data: optional_data) end |
#create_multi(pixels:) ⇒ Pixela::Response
This API is used to register multiple Pixels (quantities for a specific day) at a time.
53 54 55 |
# File 'lib/pixela/pixel.rb', line 53 def create_multi(pixels:) client.create_pixels(graph_id: graph_id, pixels: pixels) end |
#delete ⇒ Pixela::Response
Delete the registered “Pixel”.
98 99 100 |
# File 'lib/pixela/pixel.rb', line 98 def delete client.delete_pixel(graph_id: graph_id, date: date) end |
#get ⇒ Pixela::Response
Get registered quantity as “Pixel”.
67 68 69 |
# File 'lib/pixela/pixel.rb', line 67 def get client.get_pixel(graph_id: graph_id, date: date) end |
#update(quantity:, optional_data: nil) ⇒ Pixela::Response
Update the quantity already registered as a “Pixel”.
84 85 86 |
# File 'lib/pixela/pixel.rb', line 84 def update(quantity:, optional_data: nil) client.update_pixel(graph_id: graph_id, date: date, quantity: quantity, optional_data: optional_data) end |