Module: Adafruit::IO::Client::Tokens
- Included in:
- Adafruit::IO::Client
- Defined in:
- lib/adafruit/io/client/tokens.rb
Instance Method Summary collapse
-
#create_token(*args) ⇒ Object
Create a token.
- #delete_token(*args) ⇒ Object
-
#token(*args) ⇒ Object
Get a token specified by key.
-
#tokens(*args) ⇒ Object
Get all tokens.
Instance Method Details
#create_token(*args) ⇒ Object
Create a token. No attributes need to be passed in.
22 23 24 25 26 |
# File 'lib/adafruit/io/client/tokens.rb', line 22 def create_token(*args) username, arguments = extract_username(args) post api_url(username, 'tokens') end |
#delete_token(*args) ⇒ Object
28 29 30 31 32 33 |
# File 'lib/adafruit/io/client/tokens.rb', line 28 def delete_token(*args) username, arguments = extract_username(args) token_id = get_id_from_arguments(arguments) delete api_url(username, 'tokens', token_id) end |
#token(*args) ⇒ Object
Get a token specified by key
14 15 16 17 18 19 |
# File 'lib/adafruit/io/client/tokens.rb', line 14 def token(*args) username, arguments = extract_username(args) token_id = get_id_from_arguments(arguments) get api_url(username, 'tokens', token_id) end |
#tokens(*args) ⇒ Object
Get all tokens.
7 8 9 10 11 |
# File 'lib/adafruit/io/client/tokens.rb', line 7 def tokens(*args) username, _ = extract_username(args) get api_url(username, 'tokens') end |