appboy 0.1.2 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 9222a09ffa3f7d75b06a1366c1845b02c42ccef8
4
- data.tar.gz: 45ada71360cdd58a539e7d4763e6a9cd2b4cf1f7
2
+ SHA256:
3
+ metadata.gz: e8e7d2efd3c2b0f0e598b7c9837141dcdb4808bc2bfb0248f4bdb6a21d1a444c
4
+ data.tar.gz: 4c7e5076d689f7c7c2930309be8f0df558da1723e3178b4591acfb7e91b343b1
5
5
  SHA512:
6
- metadata.gz: 7811017c20de7850940245f6e8d6b921fd454d4fe8c007d7628c6622c4f0b86a2297151562c73beebbc6f8adb64c56417446a21396aca68611aa4b1e0fea0c64
7
- data.tar.gz: db42fb17c83fa3fa23a14fb23d86bd1a7517c1e1e746c8732dc376511cba5c9e6f9e95f88ba08c11ed24c0186803f6832701fdf515b964d5a9421b80d450bb8a
6
+ metadata.gz: d3f74d0bcf12e255858773a5ab749cbd9d2af5ac5634adce7a1cc0e8ccd95acbd255114a444c494f15dfba2af96a3cff78b3b2926da042602b8c9590a79cb90f
7
+ data.tar.gz: 3dfdcc2203ec7d87e46027cca841f6dc3b35a1a4501314021440f07c28ec17e26532d60b2387a9d05c9deeeccfe203823b57cf76c1e90203c626d4287f8fcd6a
data/README.md CHANGED
@@ -24,6 +24,12 @@ Or install it yourself as:
24
24
  api = Appboy::API.new('<app-group-id>')
25
25
  ```
26
26
 
27
+ By default Appboy will be using 'https://api.appboy.com' as the default REST API base url, but you can override this base url by setting the env variable `APPBOY_REST_BASE_URL`. E.G.
28
+
29
+ ```
30
+ APPBOY_REST_BASE_URL="https://rest.iad-01.braze.com"
31
+ ```
32
+
27
33
  ### Track User Attributes
28
34
 
29
35
  See: [User Attributes Object Specification](https://documentation.appboy.com/REST_APIs/User_Data#user-attribute-object)
@@ -53,7 +59,7 @@ api.track_users(events: [{
53
59
  external_id: 123,
54
60
  name: 'add-to-cart',
55
61
  time: Time.now
56
- }]
62
+ }])
57
63
  ```
58
64
 
59
65
  ##### Track Events for Single User
@@ -73,7 +79,7 @@ api.track_users(purchases: [{
73
79
  currency: 'CAD',
74
80
  price: 1.99,
75
81
  time: Time.now
76
- }]
82
+ }])
77
83
  ```
78
84
 
79
85
  ##### Track Purchases for Single User
@@ -154,7 +160,15 @@ api.export_users(external_ids: [1])
154
160
  api.export_users(segment_id: segment_id, callback_endpoint: 'https://example.com')
155
161
  ```
156
162
 
163
+ ## Debugging
157
164
 
165
+ The APPBOY_DEBUG environment variable will trigger full printouts of the Faraday gem's HTTP requests and responses.
166
+
167
+ ```bash
168
+ cd /my/app
169
+ export APPBOY_DEBUG=true
170
+ bundle exec rails whatever
171
+ ```
158
172
 
159
173
  ## Contributing
160
174
 
@@ -14,11 +14,19 @@ module Appboy
14
14
  end
15
15
 
16
16
  def connection
17
- @connection ||= Faraday.new(url: 'https://api.appboy.com') do |connection|
17
+ @connection ||= Faraday.new(url: api_host) do |connection|
18
18
  connection.request :json
19
19
 
20
+ connection.response :logger if ENV['APPBOY_DEBUG']
21
+
20
22
  connection.adapter Faraday.default_adapter
21
23
  end
22
24
  end
25
+
26
+ private
27
+
28
+ def api_host
29
+ @api_host ||= ENV.fetch('APPBOY_REST_BASE_URL', 'https://api.appboy.com')
30
+ end
23
31
  end
24
32
  end
@@ -1,3 +1,3 @@
1
1
  module Appboy
2
- VERSION = '0.1.2'
2
+ VERSION = '0.1.4'
3
3
  end
@@ -0,0 +1,19 @@
1
+ require 'spec_helper'
2
+ require 'appboy/http'
3
+
4
+ describe Appboy::HTTP do
5
+ describe '#connection' do
6
+ it 'sets the default url prefix' do
7
+ expect(subject.connection.url_prefix.to_s).to eql "https://api.appboy.com/"
8
+ end
9
+
10
+ context 'when the env contains `APPBOY_REST_BASE_URL` env variable' do
11
+ before { ENV['APPBOY_REST_BASE_URL'] = "https://new.braze.com" }
12
+ after { ENV.delete('APPBOY_REST_BASE_URL') }
13
+
14
+ it 'initializes the connection with it' do
15
+ expect(subject.connection.url_prefix.to_s).to eql "https://new.braze.com/"
16
+ end
17
+ end
18
+ end
19
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: appboy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josh Nussbaum
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2015-04-14 00:00:00.000000000 Z
12
+ date: 2018-04-24 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: virtus
@@ -213,6 +213,7 @@ files:
213
213
  - lib/appboy/version.rb
214
214
  - spec/appboy/api_spec.rb
215
215
  - spec/appboy/endpoints/track_users_spec.rb
216
+ - spec/appboy/http_spec.rb
216
217
  - spec/appboy/rest/email_status_spec.rb
217
218
  - spec/appboy/rest/export_users_spec.rb
218
219
  - spec/appboy/rest/schedule_messages_spec.rb
@@ -266,7 +267,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
266
267
  version: '0'
267
268
  requirements: []
268
269
  rubyforge_project:
269
- rubygems_version: 2.2.2
270
+ rubygems_version: 2.7.6
270
271
  signing_key:
271
272
  specification_version: 4
272
273
  summary: A wrapper for the Appboy REST API, track users/events/purchases, send & schedule
@@ -274,6 +275,7 @@ summary: A wrapper for the Appboy REST API, track users/events/purchases, send &
274
275
  test_files:
275
276
  - spec/appboy/api_spec.rb
276
277
  - spec/appboy/endpoints/track_users_spec.rb
278
+ - spec/appboy/http_spec.rb
277
279
  - spec/appboy/rest/email_status_spec.rb
278
280
  - spec/appboy/rest/export_users_spec.rb
279
281
  - spec/appboy/rest/schedule_messages_spec.rb