class Dirigible::Segment

@see docs.urbanairship.com/reference/api/v3/segments.html

Public Class Methods

create(params) click to toggle source

Create a new segment.

@example Example request:

Dirigible::Segment.create({
  display_name: "News but not sports",
  criteria: {
    and: [
      { tag: "news" },
      { not: { tag: "sports" } }
    ]
  }
})

@see docs.urbanairship.com/reference/api/v3/segments.html#segment-creation

# File lib/dirigible/segment.rb, line 37
def self.create(params)
  Dirigible.post('/segments', params)
end
delete(id) click to toggle source

Remove the segment.

@example Example request:

Dirigible::Segment.delete("00c0d899-a595-4c66-9071-bc59374bbe6b")

@see docs.urbanairship.com/reference/api/v3/segments.html#segment-creation

# File lib/dirigible/segment.rb, line 65
def self.delete(id)
  Dirigible.delete("/segments/#{id}")
end
get(id) click to toggle source

Fetch information about a particular segment.

@example Example request:

Dirigible::Segment.get("0c0d899-a595-4c66-9071-bc59374bbe6b")

@see docs.urbanairship.com/reference/api/v3/segments.html#segments-information

# File lib/dirigible/segment.rb, line 19
def self.get(id)
  Dirigible.get("/segments/#{id}")
end
list() click to toggle source

List all of the segments for the application.

@example Example request:

Dirigible::Segment.list

@see docs.urbanairship.com/reference/api/v3/segments.html#segments-information

# File lib/dirigible/segment.rb, line 9
def self.list
  Dirigible.get('/segments')
end
update(id, params) click to toggle source

Change the definition of the segment.

@example Example request:

Dirigible::Segment.update("00c0d899-a595-4c66-9071-bc59374bbe6b", {
  display_name: "Entertainment but not sports",
  criteria: {
    and: [
      { tag: "news" },
      { not: { tag: "entertainment" } }
    ]
  }
})

@see docs.urbanairship.com/reference/api/v3/segments.html#segment-creation

# File lib/dirigible/segment.rb, line 55
def self.update(id, params)
  Dirigible.put("/segments/#{id}", params)
end