Class: Urbanairship::Devices::Attribute
- Inherits:
-
Object
- Object
- Urbanairship::Devices::Attribute
- Defined in:
- lib/urbanairship/devices/attribute.rb
Constant Summary
Constants included from Common
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#operator ⇒ Object
Returns the value of attribute operator.
-
#precision ⇒ Object
Returns the value of attribute precision.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #date_attribute ⇒ Object
-
#initialize(client: required('client')) ⇒ Attribute
constructor
A new instance of Attribute.
- #number_attribute ⇒ Object
- #payload ⇒ Object
- #text_attribute ⇒ Object
Methods included from Loggable
create_logger, logger, #logger
Methods included from Common
#apid_path, #channel_path, #compact_helper, #create_and_send_path, #custom_events_path, #device_token_path, #experiments_path, #lists_path, #named_users_path, #open_channel_path, #pipelines_path, #push_path, #reports_path, #required, #schedules_path, #segments_path, #tag_lists_path, #try_helper
Constructor Details
#initialize(client: required('client')) ⇒ Attribute
Returns a new instance of Attribute.
13 14 15 |
# File 'lib/urbanairship/devices/attribute.rb', line 13 def initialize(client: required('client')) @client = client end |
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute.
8 9 10 |
# File 'lib/urbanairship/devices/attribute.rb', line 8 def attribute @attribute end |
#operator ⇒ Object
Returns the value of attribute operator.
8 9 10 |
# File 'lib/urbanairship/devices/attribute.rb', line 8 def operator @operator end |
#precision ⇒ Object
Returns the value of attribute precision.
8 9 10 |
# File 'lib/urbanairship/devices/attribute.rb', line 8 def precision @precision end |
#value ⇒ Object
Returns the value of attribute value.
8 9 10 |
# File 'lib/urbanairship/devices/attribute.rb', line 8 def value @value end |
Instance Method Details
#date_attribute ⇒ Object
43 44 45 46 47 48 49 50 |
# File 'lib/urbanairship/devices/attribute.rb', line 43 def date_attribute { 'attribute': attribute, 'operator': operator, 'precision': precision, 'value': value } end |
#number_attribute ⇒ Object
27 28 29 30 31 32 33 |
# File 'lib/urbanairship/devices/attribute.rb', line 27 def number_attribute { 'attribute': attribute, 'operator': operator, 'value': value } end |
#payload ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/urbanairship/devices/attribute.rb', line 17 def payload if precision date_attribute elsif value.is_a? String text_attribute elsif value.is_a? Integer number_attribute end end |
#text_attribute ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/urbanairship/devices/attribute.rb', line 35 def text_attribute { 'attribute': attribute, 'operator': operator, 'value': value } end |