outbound 1.1.1 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/outbound.rb +28 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9691fdb906bff30cc0838038ebc283c44bdbf30d
|
4
|
+
data.tar.gz: 2e936426fe8a629fbdf9e83453e70d05502c7f6d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f6dd40717b31a6f59d79137ed5d69e27aec2052e0bc9b711b34521f4510a62942cdf300daf0600d81d30f7d1a1ab5ccfc5b94aaafb39ac57be59d59ee4c8f7c
|
7
|
+
data.tar.gz: 329b4372bc7dca45cc6ef4bcd74d816a44f96d04e2f77a6774dd9048393a25aa8c268347b4d15b9edc8646318677755ddb357bc7dccc92883ae7c02902460bea
|
data/lib/outbound.rb
CHANGED
@@ -4,13 +4,14 @@ require 'net/http'
|
|
4
4
|
require 'uri'
|
5
5
|
|
6
6
|
module Outbound
|
7
|
-
VERSION = '1.
|
7
|
+
VERSION = '1.2.0'
|
8
8
|
BASE_URL = 'https://api.outbound.io/v2'
|
9
9
|
|
10
10
|
APNS = "apns"
|
11
11
|
GCM = "gcm"
|
12
12
|
|
13
13
|
ERROR_USER_ID = "User ID must be a string or number."
|
14
|
+
ERROR_PREVIOUS_ID = "Previous ID must be a string or number."
|
14
15
|
ERROR_EVENT_NAME = "Event name must be a string."
|
15
16
|
ERROR_CONNECTION = "Outbound connection error"
|
16
17
|
ERROR_INIT = "Must call init() before identify() or track()."
|
@@ -35,6 +36,15 @@ module Outbound
|
|
35
36
|
@ob = Outbound::Client.new api_key, @logger
|
36
37
|
end
|
37
38
|
|
39
|
+
def Outbound.alias(user_id, previous_id)
|
40
|
+
if @ob == nil
|
41
|
+
res = Result.new Outbound::ERROR_INIT, false
|
42
|
+
@logger.error res.error
|
43
|
+
return res
|
44
|
+
end
|
45
|
+
return @ob.identify(user_id, previous_id)
|
46
|
+
end
|
47
|
+
|
38
48
|
def Outbound.identify(user_id, info={})
|
39
49
|
if @ob == nil
|
40
50
|
res = Result.new Outbound::ERROR_INIT, false
|
@@ -150,6 +160,23 @@ module Outbound
|
|
150
160
|
@logger = logger
|
151
161
|
end
|
152
162
|
|
163
|
+
def alias(user_id, previous_id)
|
164
|
+
unless user_id.is_a? String or user_id.is_a? Numeric
|
165
|
+
res = Result.new Outbound::ERROR_USER_ID, false
|
166
|
+
@logger.error res.error
|
167
|
+
return res
|
168
|
+
end
|
169
|
+
|
170
|
+
unless previous_id.is_a? String or previous_id.is_a? Numeric
|
171
|
+
res = Result.new Outbound::ERROR_PREVIOUS_ID, false
|
172
|
+
@logger.error res.error
|
173
|
+
return res
|
174
|
+
end
|
175
|
+
|
176
|
+
user_data = {:user_id => user_id, :previous_id => previous_id}
|
177
|
+
return post(@api_key, '/identify', user_data)
|
178
|
+
end
|
179
|
+
|
153
180
|
def identify(user_id, info={})
|
154
181
|
unless user_id.is_a? String or user_id.is_a? Numeric
|
155
182
|
res = Result.new Outbound::ERROR_USER_ID, false
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: outbound
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Travis Beauvais
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: |-
|
14
14
|
Outbound sends automated email, SMS, phone calls and push notifications based on the actions users take or do not take in your app. The Outbound API has two components:
|