Module: Adafruit::IO::Client::Feeds

Included in:
Adafruit::IO::Client
Defined in:
lib/adafruit/io/client/feeds.rb

Instance Method Summary collapse

Instance Method Details

#create_feed(*args) ⇒ Object



31
32
33
34
35
36
# File 'lib/adafruit/io/client/feeds.rb', line 31

def create_feed(*args)
  username, arguments = extract_username(args)
  feed_attrs = valid_feed_attrs(arguments)

  post api_url(username, 'feeds'), feed_attrs
end

#delete_feed(*args) ⇒ Object



38
39
40
41
42
43
# File 'lib/adafruit/io/client/feeds.rb', line 38

def delete_feed(*args)
  username, arguments = extract_username(args)
  feed_key = get_key_from_arguments(arguments)

  delete api_url(username, 'feeds', feed_key)
end

#feed(*args) ⇒ Object

Get a feed specified by key



15
16
17
18
19
20
# File 'lib/adafruit/io/client/feeds.rb', line 15

def feed(*args)
  username, arguments = extract_username(args)
  feed_key = get_key_from_arguments(arguments)

  get api_url(username, 'feeds', feed_key)
end

#feed_details(*args) ⇒ Object

Get a feed along with additional details about the feed. This method has more to lookup and so is slower than ‘feed`



24
25
26
27
28
29
# File 'lib/adafruit/io/client/feeds.rb', line 24

def feed_details(*args)
  username, arguments = extract_username(args)
  feed_key = get_key_from_arguments(arguments)

  get api_url(username, 'feeds', feed_key, 'details')
end

#feeds(*args) ⇒ Object

Get all feeds.



8
9
10
11
12
# File 'lib/adafruit/io/client/feeds.rb', line 8

def feeds(*args)
  username, _ = extract_username(args)

  get api_url(username, 'feeds')
end

#update_feed(*args) ⇒ Object



45
46
47
48
49
50
51
# File 'lib/adafruit/io/client/feeds.rb', line 45

def update_feed(*args)
  username, arguments = extract_username(args)
  feed_key = get_key_from_arguments(arguments)
  feed_attrs = valid_feed_attrs(arguments)

  put api_url(username, 'feeds', feed_key), feed_attrs
end