Class: Dirigible::Segment

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

Overview

Class Method Summary collapse

Class Method Details

.create(params) ⇒ Object

Create a new segment.

Examples:

Example request:

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

See Also:



37
38
39
# File 'lib/dirigible/segment.rb', line 37

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

.delete(id) ⇒ Object

Remove the segment.

Examples:

Example request:

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

See Also:



65
66
67
# File 'lib/dirigible/segment.rb', line 65

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

.get(id) ⇒ Object

Fetch information about a particular segment.

Examples:

Example request:

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

See Also:



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

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

.listObject

List all of the segments for the application.



9
10
11
# File 'lib/dirigible/segment.rb', line 9

def self.list
  Dirigible.get('/segments')
end

.update(id, params) ⇒ Object

Change the definition of the segment.

Examples:

Example request:

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

See Also:



55
56
57
# File 'lib/dirigible/segment.rb', line 55

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