exact_target_rest 0.1.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 +7 -0
- data/.gitignore +15 -0
- data/.ruby-gemset +1 -0
- data/.ruby-version +1 -0
- data/Gemfile +3 -0
- data/Guardfile +16 -0
- data/LICENSE.txt +22 -0
- data/README.md +90 -0
- data/Rakefile +11 -0
- data/exact_target_rest.gemspec +28 -0
- data/lib/exact_target_rest/authorization.rb +66 -0
- data/lib/exact_target_rest/data_extension.rb +45 -0
- data/lib/exact_target_rest/support/data_ext_params.rb +16 -0
- data/lib/exact_target_rest/support/hash_extension.rb +5 -0
- data/lib/exact_target_rest/support/string_extension.rb +5 -0
- data/lib/exact_target_rest/triggered_send.rb +53 -0
- data/lib/exact_target_rest/version.rb +3 -0
- data/lib/exact_target_rest.rb +22 -0
- data/spec/lib/exact_target_rest/support/data_ext_params_spec.rb +24 -0
- data/spec/lib/exact_target_rest/support/hash_extension_spec.rb +10 -0
- data/spec/lib/exact_target_rest/support/string_extension_spec.rb +14 -0
- data/spec/spec_helper.rb +2 -0
- metadata +154 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: f1b62e5025d4dc710316a137e5228dd3a7c8dfcd
|
4
|
+
data.tar.gz: 1d88be8423657d2d6f5d164dfc16d6a30029be0b
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 86c73dcd748cbb21591b4126cd1c81382d5f5b454925f1f260076e361cbf3445991a42bdde86d6cb4f5ab0e64583db5a566592c34f243ed403fbbc24e0e3c92c
|
7
|
+
data.tar.gz: 0f24c59a183c1d1b6d24d2727bd4fb5a29e015cb3196114d3d0968856ffb11f380b03d1a73e0b84e5ddc5147818eb2172ce6beabefc8200fa5063272d04529f8
|
data/.gitignore
ADDED
data/.ruby-gemset
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
exact_target_rest
|
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.2
|
data/Gemfile
ADDED
data/Guardfile
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
guard :rspec, cmd: 'bundle exec rspec', all_on_start: true, keep: true, all_after_pass: true, run_all: { cmd: 'bundle exec rspec -f progress' } do
|
2
|
+
require 'guard/rspec/dsl'
|
3
|
+
dsl = Guard::RSpec::Dsl.new(self)
|
4
|
+
|
5
|
+
# RSpec files
|
6
|
+
rspec = dsl.rspec
|
7
|
+
watch(rspec.spec_helper) { rspec.spec_dir }
|
8
|
+
watch(rspec.spec_support) { rspec.spec_dir }
|
9
|
+
watch(rspec.spec_files)
|
10
|
+
|
11
|
+
# Ruby files
|
12
|
+
ruby = dsl.ruby
|
13
|
+
dsl.watch_spec_files_for(ruby.lib_files)
|
14
|
+
|
15
|
+
watch('lib/exact_target_rest.rb') { rspec.spec_dir }
|
16
|
+
end
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2015 Ronie Uliana
|
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,90 @@
|
|
1
|
+
# ExactTargetRest
|
2
|
+
|
3
|
+
Simple wrapper around ExactTarget REST API.
|
4
|
+
|
5
|
+
It deals with authorization and with coding conventions (CamelCase vs snake_case).
|
6
|
+
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
Add this line to your application's Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem 'exact_target_rest'
|
13
|
+
```
|
14
|
+
|
15
|
+
And then execute:
|
16
|
+
|
17
|
+
$ bundle
|
18
|
+
|
19
|
+
Or install it yourself as:
|
20
|
+
|
21
|
+
$ gem install exact_target_rest
|
22
|
+
|
23
|
+
## Usage
|
24
|
+
|
25
|
+
Be sure you have a "Client ID" and a "Client Secret". You can create one in [ExactTarget App Center](https://appcenter-auth.exacttargetapps.com).
|
26
|
+
|
27
|
+
Before anything else, create an **Authorization**:
|
28
|
+
|
29
|
+
```ruby
|
30
|
+
client_id = '123456'
|
31
|
+
client_secret = '999999999'
|
32
|
+
auth = ExactTargetRest::Authorization.new(client_id, client_secret)
|
33
|
+
```
|
34
|
+
|
35
|
+
### TriggeredSend Activation
|
36
|
+
|
37
|
+
```ruby
|
38
|
+
external_key = 'My TriggeredSend External Key'
|
39
|
+
ts = ExactTargetRest::TriggeredSend.new(auth, external_key)
|
40
|
+
ts.send_one(email_address: 'uga@kabuga.com', an_attribute: 'XXX', another_attribute: 'YYY')
|
41
|
+
```
|
42
|
+
|
43
|
+
**email_address** is mandatory, any other field will be put in the DataExtension (or List) associated with the TriggeredSend. You can also pass "subscriber_key" as parameter, if absent, it will use the value in "email_address" as default value.
|
44
|
+
|
45
|
+
All other attributes will be converted to CamelCase (ExactTarget convention) before send. So, "an_attribute" and "another_attribute" would become "AnAttribute" and "AnotherAttribute".
|
46
|
+
|
47
|
+
If you don't want this behavior, pass the flag "snake\_to\_camel: false" in the constructor:
|
48
|
+
|
49
|
+
```ruby
|
50
|
+
ts = ExactTargetRest::TriggeredSend.new(auth, external_key, snake_to_camel: false)
|
51
|
+
```
|
52
|
+
|
53
|
+
### DataExtension Upsert
|
54
|
+
|
55
|
+
```ruby
|
56
|
+
external_key = 'My TriggeredSend External Key'
|
57
|
+
de = ExactTargetRest::DataExtension.new(auth, external_key, key_field: 'my_key')
|
58
|
+
|
59
|
+
# Single upsert
|
60
|
+
de.upsert(my_key: 123, an_attribute: 'XXX', another_attribute: 'YYY')
|
61
|
+
|
62
|
+
# Batch upsert
|
63
|
+
de.upsert([{my_key: 123, an_attribute: 'XXX', another_attribute: 'YYY'},
|
64
|
+
{my_key: 456, an_attribute: 'WWW', another_attribute: 'ZZZ'}])
|
65
|
+
```
|
66
|
+
|
67
|
+
Parameters are CamelCased as in TriggeredSend. This also have a "snake_to_camel" flag in constructor.
|
68
|
+
|
69
|
+
If you have a composed primary key, you can use:
|
70
|
+
|
71
|
+
```ruby
|
72
|
+
de = ExactTargetRest::DataExtension.new(auth, external_key, key_fields: ['my_key1', 'my_key2'])
|
73
|
+
```
|
74
|
+
|
75
|
+
Notice the pluralization: "key_field" becomes "key_fields".
|
76
|
+
|
77
|
+
|
78
|
+
## Contributing
|
79
|
+
|
80
|
+
Disclaimer 1: It's far from complete, we going to add new services as needed. However, the ones here are being used in production.
|
81
|
+
|
82
|
+
Disclaimer 2: We are not representatives of ExactTarget. Please, don't demand features, but we DO accept code contributions. ^\_^
|
83
|
+
|
84
|
+
Disclaimer 3: MIT license. Use "as is" (or contribute) :D
|
85
|
+
|
86
|
+
1. Fork it ( https://github.com/vagas/exact_target_rest/fork )
|
87
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
88
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
89
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
90
|
+
5. Create a new Pull Request
|
data/Rakefile
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'exact_target_rest/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = 'exact_target_rest'
|
8
|
+
spec.version = ExactTargetRest::VERSION
|
9
|
+
spec.authors = ['Ronie Uliana']
|
10
|
+
spec.email = ['ronie.uliana@vagas.com.br']
|
11
|
+
spec.summary = %q{Simple wrapper around ExactTarget REST API}
|
12
|
+
spec.description = %q{Simple wrapper around ExactTarget REST API. It deals with authorization and with coding conventions (CamelCase vs snake_case)}
|
13
|
+
spec.homepage = ''
|
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', '~> 0.9'
|
22
|
+
spec.add_dependency 'faraday_middleware', '~> 0.9'
|
23
|
+
|
24
|
+
spec.add_development_dependency 'bundler', '~> 1.7'
|
25
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
26
|
+
spec.add_development_dependency 'guard-rspec', '~> 4.5'
|
27
|
+
spec.add_development_dependency 'pry', '~> 0.10'
|
28
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
module ExactTargetRest
|
2
|
+
# An OAUTH2 REST authorization for ExactTarget API.
|
3
|
+
#
|
4
|
+
# You can create "Client ID" and "Client Secret" in ExactTarget
|
5
|
+
# App Center (https://appcenter-auth.exacttargetapps.com).
|
6
|
+
class Authorization
|
7
|
+
attr_reader :access_token
|
8
|
+
|
9
|
+
# New authorization (it does not trigger REST yet).
|
10
|
+
#
|
11
|
+
# @param client_id [String] Client ID
|
12
|
+
# @param client_secret [String] Client Secret
|
13
|
+
def initialize(client_id, client_secret)
|
14
|
+
@client_id, @client_secret = client_id, client_secret
|
15
|
+
end
|
16
|
+
|
17
|
+
# Guarantee the block to run authorized.
|
18
|
+
#
|
19
|
+
# If not yet authorized, it runs authorization.
|
20
|
+
# If authorization is expired, it renews it.
|
21
|
+
#
|
22
|
+
# @yield [access_token] Block to be executed
|
23
|
+
# @yieldparam access_token [String] Access token used to authorize a request
|
24
|
+
def with_authorization
|
25
|
+
authorize! unless authorized?
|
26
|
+
tries = 1
|
27
|
+
begin
|
28
|
+
yield @access_token
|
29
|
+
rescue NotAuthorizedError
|
30
|
+
authorize!
|
31
|
+
tries -= 1
|
32
|
+
retry if tries >= 0
|
33
|
+
end
|
34
|
+
|
35
|
+
end
|
36
|
+
|
37
|
+
# Execute authorization and keeps an access token
|
38
|
+
def authorize!
|
39
|
+
resp = endpoint.post do |p|
|
40
|
+
p.body = {clientId: @client_id,
|
41
|
+
clientSecret: @client_secret}
|
42
|
+
end
|
43
|
+
if resp.success?
|
44
|
+
@access_token = resp.body['accessToken']
|
45
|
+
@expires_in = Time.now + resp.body['expiresIn']
|
46
|
+
else
|
47
|
+
fail resp.body.inspect
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
51
|
+
# Already authorized and NOT expired?
|
52
|
+
def authorized?
|
53
|
+
@access_token && @expires_in < Time.now
|
54
|
+
end
|
55
|
+
|
56
|
+
protected
|
57
|
+
|
58
|
+
def endpoint
|
59
|
+
@endpoint ||= Faraday.new(url: AUTH_URL) do |f|
|
60
|
+
f.request :json
|
61
|
+
f.response :json, content_type: /\bjson$/
|
62
|
+
f.adapter FARADAY_ADAPTER
|
63
|
+
end
|
64
|
+
end
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
module ExactTargetRest
|
2
|
+
class DataExtension
|
3
|
+
# Execute operations over DataExtension
|
4
|
+
#
|
5
|
+
# @param authorization [Authorization]
|
6
|
+
# @param external_key [String] The string that identifies the DataExtension
|
7
|
+
# @param key_field [String] field used as primary key (if just one)
|
8
|
+
# @param key_fields [Array<String>] fields used as composed primary key (if more than one)
|
9
|
+
# @param snake_to_camel [Boolean] Attributes should be converted to CamelCase? (default true)
|
10
|
+
def initialize(authorization, external_key, key_field: nil, key_fields: [key_field], snake_to_camel: true)
|
11
|
+
@authorization = authorization
|
12
|
+
@external_key = external_key
|
13
|
+
@param_formatter = DataExtParams.new(*key_fields.compact, snake_to_camel: snake_to_camel)
|
14
|
+
end
|
15
|
+
|
16
|
+
# Upsert DataExtension rows (batch).
|
17
|
+
#
|
18
|
+
# Update or insert row based on primary keys
|
19
|
+
#
|
20
|
+
# @param data_extension_rows [Array<Hash<Symbol, Object>>, Hash<Symbol, Object>>]
|
21
|
+
# <code>{keys: {}, values: {}}</code>,"keys" are DataExtension primary keys and
|
22
|
+
# "values" are column values
|
23
|
+
def upsert(data_extension_rows)
|
24
|
+
@authorization.with_authorization do |access_token|
|
25
|
+
resp = endpoint.post do |p|
|
26
|
+
p.url(format(DATA_EXTENSION_PATH, URI.encode(@external_key)))
|
27
|
+
p.headers['Authorization'] = "Bearer #{access_token}"
|
28
|
+
p.body = @param_formatter.transform(data_extension_rows)
|
29
|
+
end
|
30
|
+
raise NotAuthorizedError if resp.status == 401
|
31
|
+
resp
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
protected
|
36
|
+
|
37
|
+
def endpoint
|
38
|
+
@endpoint ||= Faraday.new(url: DATA_EXTENSION_URL) do |f|
|
39
|
+
f.request :json
|
40
|
+
f.response :json, content_type: /\bjson$/
|
41
|
+
f.adapter FARADAY_ADAPTER
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
module ExactTargetRest
|
2
|
+
class DataExtParams
|
3
|
+
def initialize(*key_fields, snake_to_camel: true)
|
4
|
+
@key_fields = key_fields.map(&:to_sym)
|
5
|
+
@snake_to_camel = snake_to_camel
|
6
|
+
end
|
7
|
+
|
8
|
+
def transform(params)
|
9
|
+
(Hash === params ? [params] : params).lazy
|
10
|
+
.map { |h| h.partition { |k, _| @key_fields.include?(k.to_sym) } }
|
11
|
+
.map { |a, b| {keys: @snake_to_camel ? a.to_h.snake_to_camel : a.to_h,
|
12
|
+
values: @snake_to_camel ? b.to_h.snake_to_camel : b.to_h} }
|
13
|
+
.to_a
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
module ExactTargetRest
|
2
|
+
class TriggeredSend
|
3
|
+
# Execute TriggeredSends to one or several subscribers.
|
4
|
+
#
|
5
|
+
# @param authorization [Authorization]
|
6
|
+
# @param external_key [String] The string that identifies the TriggeredSend
|
7
|
+
# @param snake_to_camel [Boolean] Attributes should be converted to CamelCase? (default true)
|
8
|
+
def initialize(authorization, external_key, snake_to_camel: true)
|
9
|
+
@authorization = authorization
|
10
|
+
@external_key = external_key
|
11
|
+
@snake_to_camel = snake_to_camel
|
12
|
+
end
|
13
|
+
|
14
|
+
# TriggeredSend for just one subscriber.
|
15
|
+
#
|
16
|
+
# @param email_address [String] Email to send.
|
17
|
+
# @param subscriber_key [String] SubscriberKey (it uses Email if not set).
|
18
|
+
# @param data_extension_attributes [{Symbol => Object}] List of attributes (in snake_case)
|
19
|
+
# that will be used in TriggeredSend and will be saved in related DataExtension
|
20
|
+
# (in CamelCase).
|
21
|
+
def send_one(email_address:, subscriber_key: email_address, ** data_extension_attributes)
|
22
|
+
@authorization.with_authorization do |access_token|
|
23
|
+
resp = endpoint.post do |p|
|
24
|
+
p.url(format(TRIGGERED_SEND_PATH, URI.encode(@external_key)))
|
25
|
+
p.headers['Authorization'] = "Bearer #{access_token}"
|
26
|
+
p.body = {to: {
|
27
|
+
address: email_address,
|
28
|
+
subscriber_key: subscriber_key,
|
29
|
+
contact_attributes: {
|
30
|
+
subscriber_attributes: prepare_attributes(data_extension_attributes)
|
31
|
+
}
|
32
|
+
}}
|
33
|
+
end
|
34
|
+
raise NotAuthorizedError if resp.status == 401
|
35
|
+
resp
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
39
|
+
protected
|
40
|
+
|
41
|
+
def endpoint
|
42
|
+
@endpoint ||= Faraday.new(url: TRIGGERED_SEND_URL) do |f|
|
43
|
+
f.request :json
|
44
|
+
f.response :json, content_type: /\bjson$/
|
45
|
+
f.adapter FARADAY_ADAPTER
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
def prepare_attributes(attributes)
|
50
|
+
@snake_to_camel ? attributes.snake_to_camel : attributes
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1,22 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'faraday_middleware'
|
3
|
+
|
4
|
+
module ExactTargetRest
|
5
|
+
FARADAY_ADAPTER = :net_http
|
6
|
+
AUTH_URL = 'https://auth.exacttargetapis.com/v1/requestToken'
|
7
|
+
TRIGGERED_SEND_URL = 'https://www.exacttargetapis.com'
|
8
|
+
TRIGGERED_SEND_PATH = '/messaging/v1/messageDefinitionSends/key:%s/send'
|
9
|
+
DATA_EXTENSION_URL = 'https://www.exacttargetapis.com'
|
10
|
+
DATA_EXTENSION_PATH = '/hub/v1/dataevents/key:%s/rowset'
|
11
|
+
end
|
12
|
+
|
13
|
+
class NotAuthorizedError < StandardError
|
14
|
+
end
|
15
|
+
|
16
|
+
require 'exact_target_rest/support/string_extension'
|
17
|
+
require 'exact_target_rest/support/hash_extension'
|
18
|
+
require 'exact_target_rest/support/data_ext_params'
|
19
|
+
require 'exact_target_rest/version'
|
20
|
+
require 'exact_target_rest/authorization'
|
21
|
+
require 'exact_target_rest/triggered_send'
|
22
|
+
require 'exact_target_rest/data_extension'
|
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe DataExtParams do
|
4
|
+
describe '#to_data_extension' do
|
5
|
+
it 'converts an Array of Hashes based on key field' do
|
6
|
+
expect(DataExtParams.new(:uga).transform([{uga: 1, buga: 2}, {uga: 3, buga: 4}])).
|
7
|
+
to eq [{keys: {'Uga' => 1}, values: {'Buga' => 2}},
|
8
|
+
{keys: {'Uga' => 3}, values: {'Buga' => 4}}]
|
9
|
+
end
|
10
|
+
it 'converts an Array of Hashes based on key_field with no snake_to_camel' do
|
11
|
+
expect(DataExtParams.new(:uga, snake_to_camel: false).transform([{uga: 1, buga: 2}, {uga: 3, buga: 4}])).
|
12
|
+
to eq [{keys: {uga: 1}, values: {buga: 2}},
|
13
|
+
{keys: {uga: 3}, values: {buga: 4}}]
|
14
|
+
end
|
15
|
+
it 'converts a simple Hash' do
|
16
|
+
expect(DataExtParams.new(:uga).transform(uga: 1, buga: 2)).
|
17
|
+
to eq [{keys: {'Uga' => 1}, values: {'Buga' => 2}}]
|
18
|
+
end
|
19
|
+
it 'converts with multiple key fields' do
|
20
|
+
expect(DataExtParams.new('uga', 'buga').transform(uga: 1, buga: 2, turuga: 3, kabuga: 4)).
|
21
|
+
to eq [{keys: {'Uga' => 1, 'Buga' => 2}, values: {'Turuga' => 3, 'Kabuga' => 4}}]
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,10 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Hash do
|
4
|
+
describe '#snake_to_camel' do
|
5
|
+
it 'converts snake_case to CamelCase recursively' do
|
6
|
+
expect({test_one: 'one'}.snake_to_camel).to eq({'TestOne' => 'one'})
|
7
|
+
expect({test_one: {test_two: 'two'}}.snake_to_camel).to eq({'TestOne' => {'TestTwo' => 'two'}})
|
8
|
+
end
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe String do
|
4
|
+
describe '#snake_to_camel' do
|
5
|
+
it 'converts snake_case to CamelCase' do
|
6
|
+
expect('test'.snake_to_camel).to eq 'Test'
|
7
|
+
expect('test_123'.snake_to_camel).to eq 'Test123'
|
8
|
+
expect('test_uga'.snake_to_camel).to eq 'TestUga'
|
9
|
+
expect('TEST'.snake_to_camel).to eq 'TEST'
|
10
|
+
expect('TEST_UGA'.snake_to_camel).to eq 'TESTUGA'
|
11
|
+
expect('test_ID'.snake_to_camel).to eq 'TestID'
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
data/spec/spec_helper.rb
ADDED
metadata
ADDED
@@ -0,0 +1,154 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: exact_target_rest
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ronie Uliana
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2015-04-02 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.9'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.9'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: faraday_middleware
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0.9'
|
34
|
+
type: :runtime
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0.9'
|
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.7'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '1.7'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rake
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '10.0'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '10.0'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: guard-rspec
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '4.5'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '4.5'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: pry
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0.10'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0.10'
|
97
|
+
description: Simple wrapper around ExactTarget REST API. It deals with authorization
|
98
|
+
and with coding conventions (CamelCase vs snake_case)
|
99
|
+
email:
|
100
|
+
- ronie.uliana@vagas.com.br
|
101
|
+
executables: []
|
102
|
+
extensions: []
|
103
|
+
extra_rdoc_files: []
|
104
|
+
files:
|
105
|
+
- ".gitignore"
|
106
|
+
- ".ruby-gemset"
|
107
|
+
- ".ruby-version"
|
108
|
+
- Gemfile
|
109
|
+
- Guardfile
|
110
|
+
- LICENSE.txt
|
111
|
+
- README.md
|
112
|
+
- Rakefile
|
113
|
+
- exact_target_rest.gemspec
|
114
|
+
- lib/exact_target_rest.rb
|
115
|
+
- lib/exact_target_rest/authorization.rb
|
116
|
+
- lib/exact_target_rest/data_extension.rb
|
117
|
+
- lib/exact_target_rest/support/data_ext_params.rb
|
118
|
+
- lib/exact_target_rest/support/hash_extension.rb
|
119
|
+
- lib/exact_target_rest/support/string_extension.rb
|
120
|
+
- lib/exact_target_rest/triggered_send.rb
|
121
|
+
- lib/exact_target_rest/version.rb
|
122
|
+
- spec/lib/exact_target_rest/support/data_ext_params_spec.rb
|
123
|
+
- spec/lib/exact_target_rest/support/hash_extension_spec.rb
|
124
|
+
- spec/lib/exact_target_rest/support/string_extension_spec.rb
|
125
|
+
- spec/spec_helper.rb
|
126
|
+
homepage: ''
|
127
|
+
licenses:
|
128
|
+
- MIT
|
129
|
+
metadata: {}
|
130
|
+
post_install_message:
|
131
|
+
rdoc_options: []
|
132
|
+
require_paths:
|
133
|
+
- lib
|
134
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: '0'
|
139
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - ">="
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: '0'
|
144
|
+
requirements: []
|
145
|
+
rubyforge_project:
|
146
|
+
rubygems_version: 2.4.5
|
147
|
+
signing_key:
|
148
|
+
specification_version: 4
|
149
|
+
summary: Simple wrapper around ExactTarget REST API
|
150
|
+
test_files:
|
151
|
+
- spec/lib/exact_target_rest/support/data_ext_params_spec.rb
|
152
|
+
- spec/lib/exact_target_rest/support/hash_extension_spec.rb
|
153
|
+
- spec/lib/exact_target_rest/support/string_extension_spec.rb
|
154
|
+
- spec/spec_helper.rb
|