Class: Pixela::Client
- Inherits:
-
Object
- Object
- Pixela::Client
- Includes:
- GraphMethods, PixelMethods, ProfileMethods, UserMethods, WebhookMethods
- Defined in:
- lib/pixela/client.rb
Defined Under Namespace
Modules: GraphMethods, PixelMethods, ProfileMethods, UserMethods, WebhookMethods
Constant Summary collapse
- API_ENDPOINT =
"https://pixe.la/v1"
- TOP_ENDPOINT =
"https://pixe.la"
Instance Attribute Summary collapse
- #username ⇒ String readonly
Instance Method Summary collapse
- #graph(graph_id) ⇒ Pixela::Graph
-
#initialize(username:, token:) ⇒ Client
constructor
A new instance of Client.
- #inspect ⇒ String
- #webhook(webhook_hash) ⇒ Pixela::Webhook
Methods included from WebhookMethods
#create_webhook, #delete_webhook, #get_webhooks, #invoke_webhook
Methods included from UserMethods
#create_user, #delete_user, #update_user
Methods included from ProfileMethods
Methods included from PixelMethods
#add_pixel, #create_pixel, #create_pixels, #decrement_pixel, #delete_pixel, #get_pixel, #increment_pixel, #subtract_pixel, #update_pixel
Methods included from GraphMethods
#create_graph, #delete_graph, #get_graph_def, #get_graph_latest, #get_graph_stats, #get_graphs, #get_pixel_dates, #get_pixels, #graph_url, #graphs_url, #run_stopwatch, #update_graph
Constructor Details
#initialize(username:, token:) ⇒ Client
Returns a new instance of Client.
24 25 26 27 |
# File 'lib/pixela/client.rb', line 24 def initialize(username:, token:) @username = username @token = token end |
Instance Attribute Details
#username ⇒ String (readonly)
20 21 22 |
# File 'lib/pixela/client.rb', line 20 def username @username end |
Instance Method Details
#graph(graph_id) ⇒ Pixela::Graph
38 39 40 |
# File 'lib/pixela/client.rb', line 38 def graph(graph_id) Graph.new(client: self, graph_id: graph_id) end |
#inspect ⇒ String
30 31 32 33 |
# File 'lib/pixela/client.rb', line 30 def inspect # NOTE: hide @token %Q(#<Pixela::Client:0x#{"%016X" % object_id} @username="#{username}">) end |
#webhook(webhook_hash) ⇒ Pixela::Webhook
45 46 47 |
# File 'lib/pixela/client.rb', line 45 def webhook(webhook_hash) Webhook.new(client: self, webhook_hash: webhook_hash) end |