Module: Urbanairship::Common
- Included in:
- AbTests::AbTest, AbTests::Experiment, AbTests::Variant, Automations::Automation, Automations::Pipeline, Client, PageIterator, Urbanairship::CustomEvents::CustomEvent, Urbanairship::CustomEvents::Payload, Devices::APID, Devices::Attribute, Devices::ChannelInfo, Devices::ChannelTags, Devices::ChannelUninstall, Devices::CreateAndSend, Devices::DeviceToken, Devices::DeviceTokenList, Devices::Email, Devices::EmailNotification, Devices::EmailTags, Devices::MmsNotification, Devices::NamedUser, Devices::NamedUserList, Devices::NamedUserTags, Devices::NamedUserUninstaller, Devices::OpenChannel, Devices::OpenChannelUninstall, Devices::Segment, Devices::SegmentList, Devices::Sms, Devices::SmsNotification, Devices::StaticList, Devices::TagList, Push::Audience, Push::Payload, Push::Push, Push::PushResponse, Push::ScheduledPush, Reports::DevicesReport, Reports::IndividualResponseStats
- Defined in:
- lib/urbanairship/common.rb
Overview
Features mixed in to all classes
Defined Under Namespace
Classes: AirshipFailure, Forbidden, PageIterator, Response, Unauthorized
Constant Summary
collapse
- CONTENT_TYPE =
'application/json'
Instance Method Summary
collapse
Instance Method Details
#apid_path(path = '') ⇒ Object
9
10
11
|
# File 'lib/urbanairship/common.rb', line 9
def apid_path(path='')
"/apids/#{path}"
end
|
#channel_path(path = '') ⇒ Object
13
14
15
|
# File 'lib/urbanairship/common.rb', line 13
def channel_path(path='')
"/channels/#{path}"
end
|
#compact_helper(a_hash) ⇒ Object
Helper method that deletes every key-value pair from a hash for which the value is nil
101
102
103
|
# File 'lib/urbanairship/common.rb', line 101
def compact_helper(a_hash)
a_hash.keep_if {|_, value| !value.nil?}
end
|
#create_and_send_path(path = '') ⇒ Object
17
18
19
|
# File 'lib/urbanairship/common.rb', line 17
def create_and_send_path(path='')
"/create-and-send/#{path}"
end
|
#custom_events_path(path = '') ⇒ Object
21
22
23
|
# File 'lib/urbanairship/common.rb', line 21
def custom_events_path(path='')
"/custom-events/#{path}"
end
|
#device_token_path(path = '') ⇒ Object
25
26
27
|
# File 'lib/urbanairship/common.rb', line 25
def device_token_path(path='')
"/device_tokens/#{path}"
end
|
#experiments_path(path = '') ⇒ Object
29
30
31
|
# File 'lib/urbanairship/common.rb', line 29
def experiments_path(path='')
"/experiments/#{path}"
end
|
#lists_path(path = '') ⇒ Object
33
34
35
|
# File 'lib/urbanairship/common.rb', line 33
def lists_path(path='')
"/lists/#{path}"
end
|
#named_users_path(path = '') ⇒ Object
37
38
39
|
# File 'lib/urbanairship/common.rb', line 37
def named_users_path(path='')
"/named_users/#{path}"
end
|
#open_channel_path(path = '') ⇒ Object
41
42
43
|
# File 'lib/urbanairship/common.rb', line 41
def open_channel_path(path='')
"/open/#{path}"
end
|
#pipelines_path(path = '') ⇒ Object
45
46
47
|
# File 'lib/urbanairship/common.rb', line 45
def pipelines_path(path='')
"/pipelines/#{path}"
end
|
#push_path(path = '') ⇒ Object
49
50
51
|
# File 'lib/urbanairship/common.rb', line 49
def push_path(path='')
"/push/#{path}"
end
|
#reports_path(path = '') ⇒ Object
53
54
55
|
# File 'lib/urbanairship/common.rb', line 53
def reports_path(path='')
"/reports/#{path}"
end
|
#required(arg = nil) ⇒ Object
Helper method for required keyword args in Ruby 2.0 that is compatible with 2.1+
80
81
82
83
|
# File 'lib/urbanairship/common.rb', line 80
def required(arg=nil)
method = caller_locations(1,1)[0].label
raise ArgumentError.new("required parameter #{arg.to_sym.inspect + ' ' if arg}not passed to method #{method}")
end
|
#schedules_path(path = '') ⇒ Object
57
58
59
|
# File 'lib/urbanairship/common.rb', line 57
def schedules_path(path='')
"/schedules/#{path}"
end
|
#segments_path(path = '') ⇒ Object
61
62
63
|
# File 'lib/urbanairship/common.rb', line 61
def segments_path(path='')
"/segments/#{path}"
end
|
#tag_lists_path(path = '') ⇒ Object
65
66
67
|
# File 'lib/urbanairship/common.rb', line 65
def tag_lists_path(path='')
"/tag-lists/#{path}"
end
|
#try_helper(method, obj) ⇒ Object
Helper method that sends the indicated method to the indicated object, if the object responds to the method
90
91
92
93
94
|
# File 'lib/urbanairship/common.rb', line 90
def try_helper(method, obj)
if obj.respond_to?(method)
obj.send(method)
end
end
|