Module: Outbound
- Defined in:
- lib/outbound.rb
Defined Under Namespace
Modules: Defaults
Classes: Client, Result
Constant Summary
collapse
- VERSION =
'1.0.0'
- BASE_URL =
'https://api.outbound.io/v2'
- APNS =
"apns"
- GCM =
"gcm"
- ERROR_USER_ID =
"User ID must be a string or number."
- ERROR_EVENT_NAME =
"Event name must be a string."
- ERROR_CONNECTION =
"Outbound connection error"
- ERROR_INIT =
"Must call init() before identify() or track()."
- ERROR_TOKEN =
"Token must be a string."
- ERROR_PLATFORM =
"Unsupported platform specified."
Class Method Summary
collapse
-
.disable(platform, user_id, token) ⇒ Object
-
.identify(user_id, info = {}) ⇒ Object
-
.init(api_key, log_level = Logger::ERROR) ⇒ Object
-
.register(platform, user_id, token) ⇒ Object
-
.track(user_id, event, properties = {}, user_info = {}, timestamp) ⇒ Object
Class Method Details
.disable(platform, user_id, token) ⇒ Object
55
56
57
58
59
60
61
62
|
# File 'lib/outbound.rb', line 55
def Outbound.disable platform, user_id, token
if @ob == nil
res = Result.new Outbound::ERROR_INIT, false
@logger.error res.error
return res
end
return @ob.disable platform, user_id, token
end
|
.identify(user_id, info = {}) ⇒ Object
37
38
39
40
41
42
43
44
|
# File 'lib/outbound.rb', line 37
def Outbound.identify user_id, info={}
if @ob == nil
res = Result.new Outbound::ERROR_INIT, false
@logger.error res.error
return res
end
return @ob.identify user_id, info
end
|
.init(api_key, log_level = Logger::ERROR) ⇒ Object
32
33
34
35
|
# File 'lib/outbound.rb', line 32
def Outbound.init api_key, log_level=Logger::ERROR
@logger.level = log_level
@ob = Outbound::Client.new api_key, @logger
end
|
.register(platform, user_id, token) ⇒ Object
64
65
66
67
68
69
70
71
|
# File 'lib/outbound.rb', line 64
def Outbound.register platform, user_id, token
if @ob == nil
res = Result.new Outbound::ERROR_INIT, false
@logger.error res.error
return res
end
return @ob.register platform, user_id, token
end
|
.track(user_id, event, properties = {}, user_info = {}, timestamp) ⇒ Object
46
47
48
49
50
51
52
53
|
# File 'lib/outbound.rb', line 46
def Outbound.track user_id, event, properties={}, user_info={}, timestamp
if @ob == nil
res = Result.new Outbound::ERROR_INIT, false
@logger.error res.error
return res
end
return @ob.track user_id, event, properties, user_info, timestamp
end
|