Class: FiveMobilePush::Tag
- Inherits:
-
Object
- Object
- FiveMobilePush::Tag
- Defined in:
- lib/five_mobile_push/tag.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
readonly
Returns the value of attribute client.
-
#device_token ⇒ Object
Returns the value of attribute device_token.
-
#device_uid ⇒ Object
Returns the value of attribute device_uid.
Instance Method Summary collapse
- #create(*tags) ⇒ Object
- #delete(*tags) ⇒ Object
- #get ⇒ Object
-
#initialize(client, device_uid, device_token) ⇒ Tag
constructor
A new instance of Tag.
Constructor Details
#initialize(client, device_uid, device_token) ⇒ Tag
Returns a new instance of Tag.
7 8 9 10 11 |
# File 'lib/five_mobile_push/tag.rb', line 7 def initialize(client, device_uid, device_token) @client = client self.device_uid = device_uid self.device_token = device_token end |
Instance Attribute Details
#client ⇒ Object (readonly)
Returns the value of attribute client.
3 4 5 |
# File 'lib/five_mobile_push/tag.rb', line 3 def client @client end |
#device_token ⇒ Object
Returns the value of attribute device_token.
5 6 7 |
# File 'lib/five_mobile_push/tag.rb', line 5 def device_token @device_token end |
#device_uid ⇒ Object
Returns the value of attribute device_uid.
5 6 7 |
# File 'lib/five_mobile_push/tag.rb', line 5 def device_uid @device_uid end |
Instance Method Details
#create(*tags) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/five_mobile_push/tag.rb', line 13 def create(*) client.post end_point(:add), :id_type => FiveMobilePush::DEFAULT_ID_TYPE, :id_value => device_uid, :tags => (), :api_token => device_token end |
#delete(*tags) ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/five_mobile_push/tag.rb', line 21 def delete(*) client.post end_point(:delete), :id_type => FiveMobilePush::DEFAULT_ID_TYPE, :id_value => device_uid, :tags => (), :api_token => device_token end |
#get ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/five_mobile_push/tag.rb', line 29 def get response = client.get end_point(:get), :id_type => FiveMobilePush::DEFAULT_ID_TYPE, :id_value => device_uid, :api_token => device_token if response.headers['content-type'] =~ /json/i MultiJson.decode(response.body) else response.body end end |