Class: Switchbot::Request

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

Constant Summary collapse

API_ENDPOINT =
'https://api.switch-bot.com'

Instance Method Summary collapse

Constructor Details

#initialize(token, secret) ⇒ Request

Returns a new instance of Request.



7
8
9
10
# File 'lib/switchbot/request.rb', line 7

def initialize(token, secret)
  @token = token
  @secret = secret
end

Instance Method Details

#get(endpoint) ⇒ Object



12
13
14
# File 'lib/switchbot/request.rb', line 12

def get(endpoint)
  request(http_method: :get, endpoint: endpoint)
end

#post(endpoint, params: {}) ⇒ Object



16
17
18
# File 'lib/switchbot/request.rb', line 16

def post(endpoint, params: {})
  request(http_method: :post, endpoint: endpoint, params: params)
end