adjust 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +22 -0
- data/.rspec +1 -0
- data/.rubocop.yml +2 -0
- data/.ruby-version +1 -0
- data/.travis.yml +7 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +11 -0
- data/adjust.gemspec +33 -0
- data/lib/adjust.rb +38 -0
- data/lib/adjust/clients.rb +3 -0
- data/lib/adjust/clients/base.rb +22 -0
- data/lib/adjust/clients/event.rb +15 -0
- data/lib/adjust/clients/revenue.rb +15 -0
- data/lib/adjust/core.rb +3 -0
- data/lib/adjust/core/configurable.rb +19 -0
- data/lib/adjust/core/configuration.rb +26 -0
- data/lib/adjust/core/errors.rb +6 -0
- data/lib/adjust/representers.rb +1 -0
- data/lib/adjust/representers/event_representer.rb +29 -0
- data/lib/adjust/transport/faraday.rb +18 -0
- data/lib/adjust/version.rb +3 -0
- data/spec/clients/event_spec.rb +47 -0
- data/spec/clients/revenue_spec.rb +49 -0
- data/spec/core/configuration_spec.rb +41 -0
- data/spec/fixtures/responses/event_success.yml +34 -0
- data/spec/fixtures/responses/revenue_success.yml +34 -0
- data/spec/integration/sending_a_revenue_spec.rb +17 -0
- data/spec/integration/sending_an_event_spec.rb +11 -0
- data/spec/spec_helper.rb +15 -0
- data/spec/support/vcr.rb +43 -0
- metadata +239 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1de2475054e09ca2af1495664649f2e4c73f5577
|
4
|
+
data.tar.gz: 2fc54b9f31bf83a0d3ad0c6588b7c8b39bf53911
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 5c05423655c531f226e9089c5662ac1814b7cbbdf208ac9572718a054e479c170cdfe3963711a9aedd51ce20fbc11585d85e5aff262bcc9c794e8418073456a8
|
7
|
+
data.tar.gz: 8ae6f25e3e95d6e630b2db24a0f9b09c22d68eeed51113c48c66b9b7c7fd589870412e78068693fb2b94734d296f5a83351e66273d31ed102da260a2098f6a93
|
data/.gitignore
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
*.gem
|
2
|
+
*.rbc
|
3
|
+
.bundle
|
4
|
+
.config
|
5
|
+
.yardoc
|
6
|
+
Gemfile.lock
|
7
|
+
InstalledFiles
|
8
|
+
_yardoc
|
9
|
+
coverage
|
10
|
+
doc/
|
11
|
+
lib/bundler/man
|
12
|
+
pkg
|
13
|
+
rdoc
|
14
|
+
spec/reports
|
15
|
+
test/tmp
|
16
|
+
test/version_tmp
|
17
|
+
tmp
|
18
|
+
*.bundle
|
19
|
+
*.so
|
20
|
+
*.o
|
21
|
+
*.a
|
22
|
+
mkmf.log
|
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--color
|
data/.rubocop.yml
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
2.1.6
|
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Hugo Bastien
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# Adjust
|
2
|
+
|
3
|
+
This gem is meant for use with server to server integration with Adjust. More information can be found here: [Server-side event tracking](https://docs.adjust.com/en/event-tracking/#reference-server-side-event-tracking)
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
##### Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'adjust'
|
10
|
+
|
11
|
+
##### And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
##### Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install adjust
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
##### Configuration
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
Adjust.configure do |config|
|
25
|
+
config.app_token = '<YOUR_ADJUST_APP_TOKEN>'
|
26
|
+
config.environment = '<production|sandbox>'
|
27
|
+
end
|
28
|
+
```
|
29
|
+
|
30
|
+
##### Event tracking
|
31
|
+
|
32
|
+
*`idfa` can also be any other values such as `android_id` or `gps_adid` check Adjust's documentation for details.*
|
33
|
+
|
34
|
+
```ruby
|
35
|
+
Adjust.event(token: :token, idfa: :idfa).track!
|
36
|
+
```
|
37
|
+
|
38
|
+
|
39
|
+
##### Revenue tracking
|
40
|
+
|
41
|
+
*`idfa` can also be any other values such as `android_id` or `gps_adid` check Adjust's documentation for details.*
|
42
|
+
|
43
|
+
```ruby
|
44
|
+
Adjust.revenue(token: :token, revenue: 1.25, currency: 'USD|CAD|EUR', idfa: :idfa).track!
|
45
|
+
```
|
46
|
+
|
47
|
+
## Contributing
|
48
|
+
|
49
|
+
1. Fork it ( https://github.com/[my-github-username]/adjust/fork )
|
50
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
51
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
52
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
53
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
data/adjust.gemspec
ADDED
@@ -0,0 +1,33 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'adjust/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'adjust'
|
8
|
+
spec.version = Adjust::VERSION
|
9
|
+
spec.authors = ['Hugo Bastien']
|
10
|
+
spec.email = ['hugobast@gmail.com']
|
11
|
+
spec.summary = 'A Ruby Adjust.com API Wrapper'
|
12
|
+
spec.description = 'A Ruby Adjust.com API Wrapper'
|
13
|
+
spec.homepage = 'https://github.com/DynamoMTL/adjust'
|
14
|
+
spec.license = 'MIT'
|
15
|
+
|
16
|
+
spec.files = `git ls-files -z`.split("\x0")
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ['lib']
|
20
|
+
|
21
|
+
spec.add_dependency 'faraday'
|
22
|
+
spec.add_dependency 'roar'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.6'
|
25
|
+
spec.add_development_dependency 'dotenv'
|
26
|
+
spec.add_development_dependency 'pry'
|
27
|
+
spec.add_development_dependency 'rake'
|
28
|
+
spec.add_development_dependency 'rspec'
|
29
|
+
spec.add_development_dependency 'rubocop'
|
30
|
+
spec.add_development_dependency 'timecop'
|
31
|
+
spec.add_development_dependency 'vcr'
|
32
|
+
spec.add_development_dependency 'webmock'
|
33
|
+
end
|
data/lib/adjust.rb
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
require 'adjust/version'
|
2
|
+
require 'adjust/transport/faraday'
|
3
|
+
|
4
|
+
module Adjust
|
5
|
+
autoload :Core, 'adjust/core'
|
6
|
+
autoload :Clients, 'adjust/clients'
|
7
|
+
autoload :Representers, 'adjust/representers'
|
8
|
+
|
9
|
+
class << self
|
10
|
+
include Core::Configurable
|
11
|
+
|
12
|
+
def event(token:, time: current_time, **device)
|
13
|
+
Clients::Event.new \
|
14
|
+
event_token: token,
|
15
|
+
app_token: app_token,
|
16
|
+
environment: environment,
|
17
|
+
created_at: time,
|
18
|
+
**device
|
19
|
+
end
|
20
|
+
|
21
|
+
def revenue(token:, revenue:, currency:, time: current_time, **device)
|
22
|
+
Clients::Revenue.new \
|
23
|
+
event_token: token,
|
24
|
+
app_token: app_token,
|
25
|
+
environment: environment,
|
26
|
+
created_at: time,
|
27
|
+
revenue: revenue,
|
28
|
+
currency: currency,
|
29
|
+
**device
|
30
|
+
end
|
31
|
+
|
32
|
+
def current_time
|
33
|
+
return Time.zone.now.iso8601 if Time.respond_to? :zone
|
34
|
+
|
35
|
+
Time.now.utc.iso8601
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'ostruct'
|
2
|
+
require 'roar/json'
|
3
|
+
require 'roar/client'
|
4
|
+
|
5
|
+
module Adjust
|
6
|
+
module Clients
|
7
|
+
class Base < OpenStruct
|
8
|
+
include Roar::JSON
|
9
|
+
include Roar::Client
|
10
|
+
|
11
|
+
attr_writer :transport_engine
|
12
|
+
|
13
|
+
def serialize
|
14
|
+
to_hash
|
15
|
+
end
|
16
|
+
|
17
|
+
def transport_engine
|
18
|
+
@transport_engine || Transport::Faraday
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
data/lib/adjust/core.rb
ADDED
@@ -0,0 +1,19 @@
|
|
1
|
+
module Adjust
|
2
|
+
module Core
|
3
|
+
module Configurable
|
4
|
+
extend Forwardable
|
5
|
+
|
6
|
+
def configure
|
7
|
+
yield configuration
|
8
|
+
end
|
9
|
+
|
10
|
+
def configuration
|
11
|
+
@configuration ||= Configuration.new
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def_delegators :configuration, :app_token, :environment
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require 'forwardable'
|
2
|
+
|
3
|
+
module Adjust
|
4
|
+
module Core
|
5
|
+
class Configuration
|
6
|
+
attr_accessor :app_token, :environment
|
7
|
+
|
8
|
+
def environment
|
9
|
+
@environment ||= :sandbox
|
10
|
+
end
|
11
|
+
|
12
|
+
def app_token
|
13
|
+
fail MissingAppTokenError unless @app_token
|
14
|
+
|
15
|
+
@app_token
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_hash
|
19
|
+
{
|
20
|
+
environment: environment,
|
21
|
+
app_token: app_token
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
require 'adjust/representers/event_representer'
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'roar/json'
|
2
|
+
|
3
|
+
module Adjust
|
4
|
+
module Representers
|
5
|
+
module EventRepresenter
|
6
|
+
include Roar::JSON
|
7
|
+
include Roar::Hypermedia
|
8
|
+
|
9
|
+
# Event Properties
|
10
|
+
property :app_token
|
11
|
+
property :event_token
|
12
|
+
property :created_at
|
13
|
+
property :idfa
|
14
|
+
property :s2s
|
15
|
+
property :environment
|
16
|
+
|
17
|
+
# Optional Revenue Properties
|
18
|
+
property :revenue
|
19
|
+
property :currency
|
20
|
+
|
21
|
+
# Response Properties
|
22
|
+
property :status
|
23
|
+
|
24
|
+
def success?
|
25
|
+
status == 'OK'
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
require 'roar/http_verbs'
|
2
|
+
require 'roar/transport/faraday'
|
3
|
+
|
4
|
+
module Adjust
|
5
|
+
module Transport
|
6
|
+
class Faraday < Roar::Transport::Faraday
|
7
|
+
private
|
8
|
+
|
9
|
+
def build_connection(uri, _)
|
10
|
+
::Faraday.new(url: uri) do |connection|
|
11
|
+
connection.request :url_encoded
|
12
|
+
connection.use ::Faraday::Response::RaiseError
|
13
|
+
connection.adapter ::Faraday.default_adapter
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,47 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Adjust
|
4
|
+
module Clients
|
5
|
+
describe Event do
|
6
|
+
let(:idfa) { ENV['ADJUST_TEST_IDFA'] }
|
7
|
+
let(:app_token) { ENV['ADJUST_APP_TOKEN'] }
|
8
|
+
let(:endpoint) { 'https://s2s.adjust.com/event' }
|
9
|
+
|
10
|
+
subject(:event) { Event.new(**event_params) }
|
11
|
+
|
12
|
+
before do
|
13
|
+
stub_request(:post, endpoint)
|
14
|
+
.to_return(body: '{"status":"OK"}')
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#track!' do
|
18
|
+
subject(:track!) { event.track! }
|
19
|
+
|
20
|
+
it 'makes a post request to adjust' do
|
21
|
+
track!
|
22
|
+
|
23
|
+
expect(a_post_request).to have_been_made
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'updates event with status returned' do
|
27
|
+
expect(track!).to be_success
|
28
|
+
end
|
29
|
+
|
30
|
+
def a_post_request
|
31
|
+
a_request(:post, endpoint)
|
32
|
+
.with(body: hash_including(event_params))
|
33
|
+
end
|
34
|
+
|
35
|
+
def event_params
|
36
|
+
{
|
37
|
+
idfa: idfa,
|
38
|
+
app_token: app_token,
|
39
|
+
event_token: 'tawmb9',
|
40
|
+
created_at: Time.now.iso8601,
|
41
|
+
environment: 'sandbox'
|
42
|
+
}
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
@@ -0,0 +1,49 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Adjust
|
4
|
+
module Clients
|
5
|
+
describe Revenue do
|
6
|
+
let(:idfa) { ENV['ADJUST_TEST_IDFA'] }
|
7
|
+
let(:app_token) { ENV['ADJUST_APP_TOKEN'] }
|
8
|
+
let(:endpoint) { 'https://s2s.adjust.com/revenue' }
|
9
|
+
|
10
|
+
subject(:revenue) { Revenue.new(**revenue_params) }
|
11
|
+
|
12
|
+
before do
|
13
|
+
stub_request(:post, endpoint)
|
14
|
+
.to_return(body: '{"status":"OK"}')
|
15
|
+
end
|
16
|
+
|
17
|
+
describe '#track!' do
|
18
|
+
subject(:track!) { revenue.track! }
|
19
|
+
|
20
|
+
it 'makes a post request to adjust' do
|
21
|
+
track!
|
22
|
+
|
23
|
+
expect(a_post_request).to have_been_made
|
24
|
+
end
|
25
|
+
|
26
|
+
it 'updates revenue with status returned' do
|
27
|
+
expect(track!).to be_success
|
28
|
+
end
|
29
|
+
|
30
|
+
def a_post_request
|
31
|
+
a_request(:post, endpoint)
|
32
|
+
.with(body: hash_including(revenue_params))
|
33
|
+
end
|
34
|
+
|
35
|
+
def revenue_params
|
36
|
+
{
|
37
|
+
idfa: idfa,
|
38
|
+
app_token: app_token,
|
39
|
+
event_token: 'fbv8to',
|
40
|
+
created_at: Time.now.iso8601,
|
41
|
+
revenue: '1.5',
|
42
|
+
currency: 'CAD',
|
43
|
+
environment: 'sandbox'
|
44
|
+
}
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
@@ -0,0 +1,41 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
module Adjust
|
4
|
+
module Core
|
5
|
+
describe Configuration do
|
6
|
+
context '#environment' do
|
7
|
+
it 'defaults to sandbox' do
|
8
|
+
expect(subject.environment).to eq :sandbox
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'can be overriden' do
|
12
|
+
subject.environment = :production
|
13
|
+
|
14
|
+
expect(subject.environment).to eq :production
|
15
|
+
end
|
16
|
+
end
|
17
|
+
|
18
|
+
context '#app_token' do
|
19
|
+
it 'raises an exception if not set' do
|
20
|
+
expect { subject.app_token }.to raise_error(MissingAppTokenError)
|
21
|
+
end
|
22
|
+
|
23
|
+
it 'can be set' do
|
24
|
+
subject.app_token = :app_token
|
25
|
+
|
26
|
+
expect(subject.app_token).to eq :app_token
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
context '#to_hash' do
|
31
|
+
before { subject.app_token = :app_token }
|
32
|
+
|
33
|
+
it 'returns configs as a hash' do
|
34
|
+
expect(subject.to_hash).to eq \
|
35
|
+
environment: :sandbox,
|
36
|
+
app_token: :app_token
|
37
|
+
end
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://s2s.adjust.com/event
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: app_token=<ADJUST_APP_TOKEN>&created_at=2015-05-06T04%3A10%3A25Z&environment=sandbox&event_token=tawmb9&idfa=<ADJUST_TEST_IDFA>&s2s=1
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Content-Type:
|
13
|
+
- application/x-www-form-urlencoded
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Wed, 06 May 2015 04:10:25 GMT
|
25
|
+
Content-Length:
|
26
|
+
- '15'
|
27
|
+
Content-Type:
|
28
|
+
- text/plain; charset=utf-8
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: '{"status":"OK"}'
|
32
|
+
http_version:
|
33
|
+
recorded_at: Wed, 06 May 2015 04:10:25 GMT
|
34
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,34 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://s2s.adjust.com/revenue
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: app_token=<ADJUST_APP_TOKEN>&created_at=2015-05-06T04%3A11%3A32Z¤cy=CAD&environment=sandbox&event_token=fbv8to&idfa=<ADJUST_TEST_IDFA>&revenue=2.0&s2s=1
|
9
|
+
headers:
|
10
|
+
User-Agent:
|
11
|
+
- Faraday v0.9.1
|
12
|
+
Content-Type:
|
13
|
+
- application/x-www-form-urlencoded
|
14
|
+
Accept-Encoding:
|
15
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
16
|
+
Accept:
|
17
|
+
- "*/*"
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 200
|
21
|
+
message: OK
|
22
|
+
headers:
|
23
|
+
Date:
|
24
|
+
- Wed, 06 May 2015 04:11:32 GMT
|
25
|
+
Content-Length:
|
26
|
+
- '15'
|
27
|
+
Content-Type:
|
28
|
+
- text/plain; charset=utf-8
|
29
|
+
body:
|
30
|
+
encoding: UTF-8
|
31
|
+
string: '{"status":"OK"}'
|
32
|
+
http_version:
|
33
|
+
recorded_at: Wed, 06 May 2015 04:11:32 GMT
|
34
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Sending a revenue' do
|
4
|
+
context 'with success', vcr: { cassette_name: :revenue_success } do
|
5
|
+
subject do
|
6
|
+
Adjust.revenue \
|
7
|
+
token: 'fbv8to',
|
8
|
+
revenue: 2.0,
|
9
|
+
currency: 'CAD',
|
10
|
+
idfa: ENV['ADJUST_TEST_IDFA']
|
11
|
+
end
|
12
|
+
|
13
|
+
it 'succeeds' do
|
14
|
+
expect(subject.track!).to be_success
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe 'Sending an event' do
|
4
|
+
context 'with success', vcr: { cassette_name: :event_success } do
|
5
|
+
subject { Adjust.event(token: 'tawmb9', idfa: ENV['ADJUST_TEST_IDFA']) }
|
6
|
+
|
7
|
+
it 'succeeds' do
|
8
|
+
expect(subject.track!).to be_success
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,15 @@
|
|
1
|
+
require 'dotenv'
|
2
|
+
require 'json'
|
3
|
+
require 'pry'
|
4
|
+
require 'bundler/setup'
|
5
|
+
require 'webmock/rspec'
|
6
|
+
|
7
|
+
Bundler.setup
|
8
|
+
Dotenv.load
|
9
|
+
|
10
|
+
require 'adjust'
|
11
|
+
require 'support/vcr'
|
12
|
+
|
13
|
+
Adjust.configure do |config|
|
14
|
+
config.app_token = ENV['ADJUST_APP_TOKEN']
|
15
|
+
end
|
data/spec/support/vcr.rb
ADDED
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'vcr'
|
2
|
+
require 'timecop'
|
3
|
+
|
4
|
+
VCR.configure do |config|
|
5
|
+
config.filter_sensitive_data('<ADJUST_APP_TOKEN>') do
|
6
|
+
ENV.fetch('ADJUST_APP_TOKEN')
|
7
|
+
end
|
8
|
+
|
9
|
+
config.filter_sensitive_data('<ADJUST_TEST_IDFA>') do
|
10
|
+
ENV.fetch('ADJUST_TEST_IDFA')
|
11
|
+
end
|
12
|
+
|
13
|
+
config.cassette_library_dir = 'spec/fixtures/responses'
|
14
|
+
|
15
|
+
config.default_cassette_options = {
|
16
|
+
match_requests_on: [:method, :uri, :body]
|
17
|
+
}
|
18
|
+
|
19
|
+
config.configure_rspec_metadata!
|
20
|
+
config.hook_into :webmock
|
21
|
+
end
|
22
|
+
|
23
|
+
module CassetteTime
|
24
|
+
def recording?
|
25
|
+
VCR.current_cassette
|
26
|
+
end
|
27
|
+
|
28
|
+
def recorded_at
|
29
|
+
VCR.current_cassette.originally_recorded_at
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
RSpec.configure do |config|
|
34
|
+
config.include CassetteTime
|
35
|
+
|
36
|
+
config.before(:each) do
|
37
|
+
Timecop.freeze(recorded_at) if recording?
|
38
|
+
end
|
39
|
+
|
40
|
+
config.after(:each) do
|
41
|
+
Timecop.return
|
42
|
+
end
|
43
|
+
end
|
metadata
ADDED
@@ -0,0 +1,239 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: adjust
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Hugo Bastien
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-05-06 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: roar
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - ">="
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - ">="
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: bundler
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '1.6'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.6'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: dotenv
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: pry
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rake
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rspec
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '0'
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: timecop
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: '0'
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: vcr
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: '0'
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: '0'
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: webmock
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '0'
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: '0'
|
167
|
+
description: A Ruby Adjust.com API Wrapper
|
168
|
+
email:
|
169
|
+
- hugobast@gmail.com
|
170
|
+
executables: []
|
171
|
+
extensions: []
|
172
|
+
extra_rdoc_files: []
|
173
|
+
files:
|
174
|
+
- ".gitignore"
|
175
|
+
- ".rspec"
|
176
|
+
- ".rubocop.yml"
|
177
|
+
- ".ruby-version"
|
178
|
+
- ".travis.yml"
|
179
|
+
- Gemfile
|
180
|
+
- LICENSE.txt
|
181
|
+
- README.md
|
182
|
+
- Rakefile
|
183
|
+
- adjust.gemspec
|
184
|
+
- lib/adjust.rb
|
185
|
+
- lib/adjust/clients.rb
|
186
|
+
- lib/adjust/clients/base.rb
|
187
|
+
- lib/adjust/clients/event.rb
|
188
|
+
- lib/adjust/clients/revenue.rb
|
189
|
+
- lib/adjust/core.rb
|
190
|
+
- lib/adjust/core/configurable.rb
|
191
|
+
- lib/adjust/core/configuration.rb
|
192
|
+
- lib/adjust/core/errors.rb
|
193
|
+
- lib/adjust/representers.rb
|
194
|
+
- lib/adjust/representers/event_representer.rb
|
195
|
+
- lib/adjust/transport/faraday.rb
|
196
|
+
- lib/adjust/version.rb
|
197
|
+
- spec/clients/event_spec.rb
|
198
|
+
- spec/clients/revenue_spec.rb
|
199
|
+
- spec/core/configuration_spec.rb
|
200
|
+
- spec/fixtures/responses/event_success.yml
|
201
|
+
- spec/fixtures/responses/revenue_success.yml
|
202
|
+
- spec/integration/sending_a_revenue_spec.rb
|
203
|
+
- spec/integration/sending_an_event_spec.rb
|
204
|
+
- spec/spec_helper.rb
|
205
|
+
- spec/support/vcr.rb
|
206
|
+
homepage: https://github.com/DynamoMTL/adjust
|
207
|
+
licenses:
|
208
|
+
- MIT
|
209
|
+
metadata: {}
|
210
|
+
post_install_message:
|
211
|
+
rdoc_options: []
|
212
|
+
require_paths:
|
213
|
+
- lib
|
214
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0'
|
219
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
224
|
+
requirements: []
|
225
|
+
rubyforge_project:
|
226
|
+
rubygems_version: 2.2.3
|
227
|
+
signing_key:
|
228
|
+
specification_version: 4
|
229
|
+
summary: A Ruby Adjust.com API Wrapper
|
230
|
+
test_files:
|
231
|
+
- spec/clients/event_spec.rb
|
232
|
+
- spec/clients/revenue_spec.rb
|
233
|
+
- spec/core/configuration_spec.rb
|
234
|
+
- spec/fixtures/responses/event_success.yml
|
235
|
+
- spec/fixtures/responses/revenue_success.yml
|
236
|
+
- spec/integration/sending_a_revenue_spec.rb
|
237
|
+
- spec/integration/sending_an_event_spec.rb
|
238
|
+
- spec/spec_helper.rb
|
239
|
+
- spec/support/vcr.rb
|