Class: Dirigible::Tag

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

Overview

Class Method Summary collapse

Class Method Details

.add_or_remove(tag, params) ⇒ Object

Add or remove one or more device tokens, APIDs, or PINs to a particular tag.

Examples:

Example request:

Dirigible::Tag.add_or_remove("some_new_tag", {
  device_tokens: {
    add: ["device_token_1_to_add", "device_token_2_to_add"]
  },
  apids: {
    remove: ["apid_1_to_remove"]
  }
})

Full capability:

Dirigible::Tag.add_or_remove("some_new_tag", {
  device_tokens: {
    add: ["device_token_1_to_add", "device_token_2_to_add"],
    remove: ["device_token_to_remove"]
  },
  device_pins: {
    add: ["device_pin_1_to_add", "device_pin_2_to_add"],
    remove: ["device_pin_to_remove"]
  },
  apids: {
    add: ["apid_1_to_add", "apid_2_to_add"],
    remove: ["apid_to_remove"]
  }
})

See Also:



70
71
72
# File 'lib/dirigible/tag.rb', line 70

def self.add_or_remove(tag, params)
  Dirigible.post("/tags/#{tag}", params)
end

.batch(params) ⇒ Object

Modify the tags for a number of device tokens or apids.

You must include an object containing either a device_token or apid section and also containing a tags section to apply the tags.

Examples:

Example request:

Dirigible::Tag.batch([
  {
    device_token: "device_token_tag_tag_1",
    tags: [
      "tag_to_apply_1",
      "tag_to_apply_2",
      "tag_to_apply_3"
    ]
  },
  {
    device_token: "device_token_to_tag_2",
    tags: [
      "tag_to_apply_1",
      "tag_to_apply_4",
      "tag_to_apply_5"
    ]
  },
  {
    apid: "apid_to_tag_2",
    tags: [
      "tag_to_apply_1",
      "tag_to_apply_4",
      "tag_to_apply_5"
    ]
  }
])

See Also:



109
110
111
# File 'lib/dirigible/tag.rb', line 109

def self.batch(params)
  Dirigible.post("/tags/batch", params)
end

.create(tag) ⇒ Object

Note:

This call is optional; tags are created implicitly when devices are added to them. You might use this to pre-create the list for your Push Composer users, however.

Explicitly create a tag with no devices associated with it.

Examples:

Example request:

Dirigible::Tag.create("some_new_tag")

See Also:



21
22
23
# File 'lib/dirigible/tag.rb', line 21

def self.create(tag)
  Dirigible.put("/tags/#{tag}")
end

.delete(tag) ⇒ Object

Note:

The removal process can take a long time if many devices use this tag.

Delete a tag and remove it from all devices.

A tag can be fully removed from Urban Airship by issuing a delete. This will remove the master record of the tag, and will remove the tag from all devices.

Examples:

Example request:

Dirigible::Tag.delete("some_new_tag")

See Also:



36
37
38
# File 'lib/dirigible/tag.rb', line 36

def self.delete(tag)
  Dirigible.delete("/tags/#{tag}")
end

.listObject

List tags that exist for this application.



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

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