Sha256: 1bcf83f1e625ddb6c9b1ff4473a5718b8dfcca8bd0691c823cdfe29f5865f3be

Contents?: true

Size: 680 Bytes

Versions: 11

Compression:

Stored size: 680 Bytes

Contents

module FiveMobilePush
  class Tag

    attr_accessor :device_uid

    def initialize(client, device_uid)
      @client = client
      self.device_uid = device_uid
    end
    
    def create(*tags)
      @client.post(end_point(:add), :id_type => FiveMobilePush::DEFAULT_ID_TYPE, :id_value => self.device_uid, :tags => normalize_tags(tags))
    end

    def delete(*tags)
      @client.post(end_point(:delete), :id_type => FiveMobilePush::DEFAULT_ID_TYPE, :id_value => self.device_uid, :tags => normalize_tags(tags))
    end

    private

    def normalize_tags(tags)
      tags.flatten.join(",")
    end

    def end_point(action)
      "device/tags/#{action}"
    end

  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
five_mobile_push-0.4.6 lib/five_mobile_push/tag.rb
five_mobile_push-0.4.5 lib/five_mobile_push/tag.rb
five_mobile_push-0.4.4-x86_64-darwin-10 lib/five_mobile_push/tag.rb
five_mobile_push-0.4.3 lib/five_mobile_push/tag.rb
five_mobile_push-0.4.2 lib/five_mobile_push/tag.rb
five_mobile_push-0.4.1 lib/five_mobile_push/tag.rb
five_mobile_push-0.4.0 lib/five_mobile_push/tag.rb
five_mobile_push-0.3.1 lib/five_mobile_push/tag.rb
five_mobile_push-0.3.0 lib/five_mobile_push/tag.rb
five_mobile_push-0.2.0 lib/five_mobile_push/tag.rb
five_mobile_push-0.1.0 lib/five_mobile_push/tag.rb