Class: Dirigible::Feed

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

Overview

Note:

The Feed API still uses the version 1 Push API. In the future it will be upgraded to use the V3 push API.

Class Method Summary collapse

Class Method Details

.create(params) ⇒ Object

Creates a new feed.

Examples:

Example request:

Dirigible::Feed.create({
  feed_url: "http://example.com/atom.xml",
  template: {
    aps: {
      badge: 1,
      sound: "cat.caf",
      alert: "New item from some place! {{ title }}"
    }
  }
})

See Also:



19
20
21
# File 'lib/dirigible/feed.rb', line 19

def self.create(params)
  Dirigible.post('/feeds', params)
end

.delete(id) ⇒ Object

Removes a feed from the monitoring service, and stops new pushes from being sent.

Examples:

Example request:

Dirigible::Feed.delete('<feed_id>')

See Also:



58
59
60
# File 'lib/dirigible/feed.rb', line 58

def self.delete(id)
  Dirigible.delete("/feeds/#{id}")
end

.get(id) ⇒ Object

Returns information about that particular feed.

Examples:

Example request:

Dirigible::Feed.get('<feed_id>')

See Also:



29
30
31
# File 'lib/dirigible/feed.rb', line 29

def self.get(id)
  Dirigible.get("/feeds/#{id}")
end

.update(id, params) ⇒ Object

Updates a feed with a new template

Examples:

Example request:

Dirigible::Feed.update('<feed_id>', {
  template: {
    aps: {
      sound: "frog.caf",
      alert: "New update from Someplace! - {{ title }}"
    }
  },
  feed_url: "<new_feed_url>"
})

See Also:



47
48
49
# File 'lib/dirigible/feed.rb', line 47

def self.update(id, params)
  Dirigible.put("/feeds/#{id}", params)
end