outbound 0.3.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/outbound.rb +26 -13
  3. metadata +3 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 81d0b51483b705dbd0c544b344f4bf8450f4e4c1
4
- data.tar.gz: 54c0a8555c859a0b16fbe84cf5de1e05c9426432
3
+ metadata.gz: 7d505bb226763256a4982d85e2a66d32d8bc3b0d
4
+ data.tar.gz: a38c4c2af3e68f4852bc81d34409e84e3a4b955f
5
5
  SHA512:
6
- metadata.gz: dcb91cf7f42a39da2e7c494943f30e056165fa31ece58456abdc5eb2c65225002a7f75dc432dc3e5d8753da04aa2eca24073d12281ac768931125530a95e299d
7
- data.tar.gz: a4787e84a4f8b0dd78bd953f5a17f172d6f32d5936ecdb6c54e6b2ac37387583fd8b9aad7d424e8670a19a55e49176767e154ccddab4ec4813a8a46de1819d84
6
+ metadata.gz: 773ad698020b9dcd0c5e919c06f78421447247d4dbc3d9e78b4b5139327f1d1221e005846c578f4dc7285da814d632d78734b51a6061b2bfe72128ac9c665149
7
+ data.tar.gz: 1d0ee9575cb944bd6bc1f686cb4d89856fb104dbf5b1472b43d40af45aa98a9625fb36aec650f7f96ea9ac6a680b4c1b2e4698404cc0b120a7697ced316e7706
@@ -4,7 +4,7 @@ require 'net/http'
4
4
  require 'uri'
5
5
 
6
6
  module Outbound
7
- VERSION = '0.3.2'
7
+ VERSION = '1.0.0'
8
8
  BASE_URL = 'https://api.outbound.io/v2'
9
9
 
10
10
  APNS = "apns"
@@ -34,23 +34,22 @@ module Outbound
34
34
  @ob = Outbound::Client.new api_key, @logger
35
35
  end
36
36
 
37
- def Outbound.identify user_id, info={}, attributes={}
37
+ def Outbound.identify user_id, info={}
38
38
  if @ob == nil
39
39
  res = Result.new Outbound::ERROR_INIT, false
40
40
  @logger.error res.error
41
41
  return res
42
42
  end
43
-
44
- return @ob.identify user_id, info, attributes
43
+ return @ob.identify user_id, info
45
44
  end
46
45
 
47
- def Outbound.track user_id, event, properties={}, user_info={}, user_attributes={}
46
+ def Outbound.track user_id, event, properties={}, user_info={}, timestamp
48
47
  if @ob == nil
49
48
  res = Result.new Outbound::ERROR_INIT, false
50
49
  @logger.error res.error
51
50
  return res
52
51
  end
53
- return @ob.track user_id, event, properties, user_info, user_attributes
52
+ return @ob.track user_id, event, properties, user_info, timestamp
54
53
  end
55
54
 
56
55
  def Outbound.disable platform, user_id, token
@@ -119,7 +118,7 @@ module Outbound
119
118
  @logger = logger
120
119
  end
121
120
 
122
- def identify user_id, info={}, attributes={}
121
+ def identify user_id, info={}
123
122
  unless user_id.is_a? String or user_id.is_a? Numeric
124
123
  res = Result.new Outbound::ERROR_USER_ID, false
125
124
  @logger.error res.error
@@ -128,7 +127,7 @@ module Outbound
128
127
 
129
128
  user_data = {:user_id => user_id}
130
129
  begin
131
- user = user(info, attributes)
130
+ user = user(info)
132
131
  user_data = user_data.merge user
133
132
  rescue
134
133
  @logger.error "Could not use user info (#{info}) and/or user attributes #{attributes} given to identify call."
@@ -137,7 +136,7 @@ module Outbound
137
136
  return post(@api_key, '/identify', user_data)
138
137
  end
139
138
 
140
- def track user_id, event, properties={}, user_info={}, user_attributes={}
139
+ def track user_id, event, properties={}, user_info={}, timestamp
141
140
  unless user_id.is_a? String or user_id.is_a? Numeric
142
141
  res = Result.new Outbound::ERROR_USER_ID, false
143
142
  @logger.error res.error
@@ -153,7 +152,7 @@ module Outbound
153
152
  data = {:user_id => user_id, :event => event}
154
153
 
155
154
  begin
156
- user = user(user_info, user_attributes)
155
+ user = user(user_info)
157
156
  if user.length > 0
158
157
  data[:user] = user
159
158
  end
@@ -169,6 +168,16 @@ module Outbound
169
168
  @logger.error "Could not use event properties (#{properties}) given to track call."
170
169
  end
171
170
 
171
+ puts timestamp
172
+
173
+ unless timestamp == {}
174
+ data[:timestamp] = timestamp
175
+ else
176
+ data[:timestamp] = Time.now.to_i
177
+ end
178
+
179
+ puts data[:timestamp]
180
+
172
181
  return post(@api_key, '/track', data)
173
182
  end
174
183
 
@@ -244,8 +253,8 @@ module Outbound
244
253
  return err, true
245
254
  end
246
255
 
247
- def user info={}, attributes={}
248
- unless info.is_a? Hash and attributes.is_a? Hash
256
+ def user info={}
257
+ unless info.is_a? Hash
249
258
  raise
250
259
  end
251
260
 
@@ -256,9 +265,13 @@ module Outbound
256
265
  :phone_number => info[:phone_number],
257
266
  :apns => info[:apns_tokens],
258
267
  :gcm => info[:gcm_tokens],
259
- :attributes => attributes,
268
+ :group_id => info[:group_id],
269
+ :group_attributes => info[:group_attributes],
270
+ :previous_id => info[:previous_id],
271
+ :attributes => info[:attributes],
260
272
  }
261
273
  return user.delete_if { |k, v| v.nil? || v.empty? }
262
274
  end
275
+
263
276
  end
264
277
  end
metadata CHANGED
@@ -1,14 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: outbound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Travis Beauvais
8
+ - Muhammad Usman
8
9
  autorequire:
9
10
  bindir: bin
10
11
  cert_chain: []
11
- date: 2014-06-07 00:00:00.000000000 Z
12
+ date: 2015-05-12 00:00:00.000000000 Z
12
13
  dependencies: []
13
14
  description: |-
14
15
  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: