Class: Luxafor::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/client.rb

Constant Summary collapse

BASE =
"https://api.luxafor.com/webhook/v1/actions"

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(webhook_id) ⇒ Client

Returns a new instance of Client.



9
10
11
# File 'lib/client.rb', line 9

def initialize(webhook_id)
  @webhook_id = webhook_id
end

Instance Attribute Details

#webhook_idObject (readonly)

Returns the value of attribute webhook_id.



7
8
9
# File 'lib/client.rb', line 7

def webhook_id
  @webhook_id
end

Instance Method Details

#offObject



23
24
25
# File 'lib/client.rb', line 23

def off
  on("000000")
end

#on(color = "FF00FF") ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/client.rb', line 13

def on(color = "FF00FF")
  HTTP.post(BASE + "/solid_color", json: {
    "userId": webhook_id,
    "actionFields": {
      "color": "custom",
      "custom_color": color
    }
  })
end