experian_ms 0.1.5
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 +9 -0
- data/.rspec +2 -0
- data/CODE_OF_CONDUCT.md +49 -0
- data/Gemfile +2 -0
- data/LICENSE.txt +20 -0
- data/README.md +69 -0
- data/Rakefile +10 -0
- data/experian_ms.gemspec +32 -0
- data/lib/experian_ms.rb +10 -0
- data/lib/experian_ms/api.rb +43 -0
- data/lib/experian_ms/configuration.rb +54 -0
- data/lib/experian_ms/oauth.rb +42 -0
- data/lib/experian_ms/version.rb +3 -0
- data/spec/fixtures/dish_cassettes/client_auth.yml +45 -0
- data/spec/fixtures/dish_cassettes/new_user_post.yml +101 -0
- data/spec/fixtures/xml/new_user.xml +11 -0
- data/spec/lib/experian_ms_spec.rb +63 -0
- data/spec/spec_helper.rb +14 -0
- metadata +144 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 86632d1488fc604967640f2fb9645b010371a08d
|
4
|
+
data.tar.gz: 25f82955e0ea4b00a007e01826d3339c16d0006f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 291a3b747aa34d733bb70e04d36fccfd5eb96d31e4e1dc04fd877e34b5a15f91c203c45ffe9911c86c30a1b71230fbd233bbf90f4e8d3b208a1871cfa1aec1ff
|
7
|
+
data.tar.gz: c4447b9c3471b8b2e8335597804ae722f4965f8f263602077c1c157ffabcd3b2447577dae1e4e22955c05054299f35b90c1ced98907f69b8a4350c023ae6e3e9
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
# Contributor Code of Conduct
|
2
|
+
|
3
|
+
As contributors and maintainers of this project, and in the interest of
|
4
|
+
fostering an open and welcoming community, we pledge to respect all people who
|
5
|
+
contribute through reporting issues, posting feature requests, updating
|
6
|
+
documentation, submitting pull requests or patches, and other activities.
|
7
|
+
|
8
|
+
We are committed to making participation in this project a harassment-free
|
9
|
+
experience for everyone, regardless of level of experience, gender, gender
|
10
|
+
identity and expression, sexual orientation, disability, personal appearance,
|
11
|
+
body size, race, ethnicity, age, religion, or nationality.
|
12
|
+
|
13
|
+
Examples of unacceptable behavior by participants include:
|
14
|
+
|
15
|
+
* The use of sexualized language or imagery
|
16
|
+
* Personal attacks
|
17
|
+
* Trolling or insulting/derogatory comments
|
18
|
+
* Public or private harassment
|
19
|
+
* Publishing other's private information, such as physical or electronic
|
20
|
+
addresses, without explicit permission
|
21
|
+
* Other unethical or unprofessional conduct
|
22
|
+
|
23
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
24
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
25
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
26
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
27
|
+
threatening, offensive, or harmful.
|
28
|
+
|
29
|
+
By adopting this Code of Conduct, project maintainers commit themselves to
|
30
|
+
fairly and consistently applying these principles to every aspect of managing
|
31
|
+
this project. Project maintainers who do not follow or enforce the Code of
|
32
|
+
Conduct may be permanently removed from the project team.
|
33
|
+
|
34
|
+
This code of conduct applies both within project spaces and in public spaces
|
35
|
+
when an individual is representing the project or its community.
|
36
|
+
|
37
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
38
|
+
reported by contacting a project maintainer at <eliasjpr@gmail.com>. All
|
39
|
+
complaints will be reviewed and investigated and will result in a response that
|
40
|
+
is deemed necessary and appropriate to the circumstances. Maintainers are
|
41
|
+
obligated to maintain confidentiality with regard to the reporter of an
|
42
|
+
incident.
|
43
|
+
|
44
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
45
|
+
version 1.3.0, available at
|
46
|
+
[http://contributor-covenant.org/version/1/3/0/][version]
|
47
|
+
|
48
|
+
[homepage]: http://contributor-covenant.org
|
49
|
+
[version]: http://contributor-covenant.org/version/1/3/0/
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright (c) 2016 Elias J. Perez
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,69 @@
|
|
1
|
+
# Experian Marketing Suite API Integration
|
2
|
+
|
3
|
+
A Ruby wrapper that Integrates Experian Marketing Suit endpoints.
|
4
|
+
|
5
|
+
The Experian Marketing Suite is the world's most flexible and comprehensive
|
6
|
+
cloud-based marketing platform. More than 10,000 of the world's leading brands,
|
7
|
+
in over than 30 countries, are using the Experian Marketing Suite to create and
|
8
|
+
deliver intelligent interactions with their customers, every time. Built from the
|
9
|
+
ground-up leveraging 30 years of data-driven global marketing expertise, the
|
10
|
+
award-winning Experian Marketing Suite unites Experian's customer identity,
|
11
|
+
analytics and cross-channel marketing technology..
|
12
|
+
|
13
|
+
## Installation
|
14
|
+
|
15
|
+
```ruby
|
16
|
+
gem 'experian_ms', '~> 0.1.6'
|
17
|
+
```
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
```ruby
|
22
|
+
# Require the Experian
|
23
|
+
require 'experian_ms'
|
24
|
+
|
25
|
+
# Configure the API Wrapper
|
26
|
+
# For a rails application this can be added to an Experian initializer
|
27
|
+
ExperianMS.configure do |config|
|
28
|
+
config.key = 'your-oauth2-key' # OAuth2 Consumer Key
|
29
|
+
config.secret = 'your-oauth2-secret' # OAuth2 Secret Key
|
30
|
+
config.client_id = 0 # Client id provided by Experian
|
31
|
+
config.customer_id = 0 # Customer id provided by Experian
|
32
|
+
config.api_version = 0 # Experian API version
|
33
|
+
config.form_group_id = 0 # Form group id provided by Experian
|
34
|
+
end
|
35
|
+
|
36
|
+
# In your Model, Worker, Services
|
37
|
+
# Returns an Experian API instance
|
38
|
+
api_client = ExperianMS.api
|
39
|
+
|
40
|
+
# Sends the items to Experian endpoint
|
41
|
+
api_client.request(xml) # See example xml payload below
|
42
|
+
|
43
|
+
```
|
44
|
+
|
45
|
+
Example **XML** Payload
|
46
|
+
|
47
|
+
```xml
|
48
|
+
<ApiSubmission ApiVersion="1" FormGroupId="1" SubmissionTrackingCode="SOMECODE" CustId="345">
|
49
|
+
<Records SubmissionSequence="1" FormId="19" TableName="User">
|
50
|
+
<Record>
|
51
|
+
<Field FieldName="user_id">A</Field>
|
52
|
+
<Field FieldName="profile_id">B</Field>
|
53
|
+
<Field FieldName="category">C</Field>
|
54
|
+
<Field FieldName="category_value">D</Field>
|
55
|
+
<Field FieldName="active_ind">Y</Field>
|
56
|
+
</Record>
|
57
|
+
</Records>
|
58
|
+
</ApiSubmission>
|
59
|
+
```
|
60
|
+
## Contributing
|
61
|
+
|
62
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/eliasjpr/experian-ms.
|
63
|
+
This project is intended to be a safe, welcoming space for collaboration, and
|
64
|
+
contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.
|
65
|
+
|
66
|
+
|
67
|
+
## License
|
68
|
+
|
69
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/experian_ms.gemspec
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require File.expand_path('../lib/experian_ms/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |s|
|
4
|
+
s.name = "experian_ms"
|
5
|
+
s.version = ExperianMS::VERSION.dup
|
6
|
+
s.author = "Elias J. Perez"
|
7
|
+
s.email = "eperez@pinch.me"
|
8
|
+
s.homepage = "https://github.com/eliasjpr/experian-ms"
|
9
|
+
s.summary = "A Ruby wrapper that Integrates Experian Marketing Suite endpoints."
|
10
|
+
s.description = %q{The Experian Marketing Suite is the world's most flexible
|
11
|
+
and comprehensive cloud-based marketing platform. More than 10,000 of the world's
|
12
|
+
leading brands, in over than 30 countries, are using the Experian Marketing Suite
|
13
|
+
to create and deliver intelligent interactions with their customers, every time.
|
14
|
+
|
15
|
+
Built from the ground-up leveraging 30 years of data-driven global marketing expertise,
|
16
|
+
the award-winning Experian Marketing Suite unites Experian's customer identity,
|
17
|
+
analytics and cross-channel marketing technology..}
|
18
|
+
|
19
|
+
s.files = `git ls-files`.split("\n")
|
20
|
+
s.require_paths = ['lib']
|
21
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
22
|
+
s.licenses = ['MIT']
|
23
|
+
s.platform = Gem::Platform::RUBY
|
24
|
+
s.rubyforge_project = s.name
|
25
|
+
|
26
|
+
s.add_runtime_dependency 'httparty', '~> 0.13'
|
27
|
+
|
28
|
+
s.add_development_dependency 'rake', '~> 11.1'
|
29
|
+
s.add_development_dependency 'vcr', '~> 3.0'
|
30
|
+
s.add_development_dependency 'rspec', '~> 3.4'
|
31
|
+
s.add_development_dependency 'webmock', '~> 2.1'
|
32
|
+
end
|
data/lib/experian_ms.rb
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
require File.expand_path('../experian_ms/configuration', __FILE__)
|
2
|
+
require File.expand_path('../experian_ms/api', __FILE__)
|
3
|
+
module ExperianMS
|
4
|
+
extend Configuration
|
5
|
+
# Alias for ExperianMS::Api.new
|
6
|
+
# @return [ExperianMS::Api]
|
7
|
+
def self.api(options={})
|
8
|
+
ExperianMS::API.new(options)
|
9
|
+
end
|
10
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'httparty'
|
2
|
+
require File.expand_path('../oauth', __FILE__)
|
3
|
+
module ExperianMS
|
4
|
+
class API
|
5
|
+
include HTTParty
|
6
|
+
include OAuth
|
7
|
+
|
8
|
+
attr_accessor *Configuration::VALID_OPTIONS_KEYS
|
9
|
+
base_uri Configuration::BASE_URL
|
10
|
+
|
11
|
+
# Creates a new API
|
12
|
+
def initialize(options={})
|
13
|
+
options = ExperianMS.options.merge(options)
|
14
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
15
|
+
send("#{key}=", options[key])
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
def config
|
20
|
+
conf = {}
|
21
|
+
Configuration::VALID_OPTIONS_KEYS.each do |key|
|
22
|
+
conf[key] = send key
|
23
|
+
end
|
24
|
+
conf
|
25
|
+
end
|
26
|
+
|
27
|
+
def request(xml)
|
28
|
+
authenticate
|
29
|
+
post(xml)
|
30
|
+
end
|
31
|
+
|
32
|
+
private
|
33
|
+
|
34
|
+
def post(xml)
|
35
|
+
self.class.post('/ats/XmlPost/PostSecureAuth2/',
|
36
|
+
headers:grant_header,
|
37
|
+
body: xml,
|
38
|
+
debug_output: $stdout).parsed_response
|
39
|
+
end
|
40
|
+
|
41
|
+
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,54 @@
|
|
1
|
+
module ExperianMS
|
2
|
+
module Configuration
|
3
|
+
BASE_URL = 'https://ats.eccmp.com'.freeze
|
4
|
+
CUSTOMER_ID = 0
|
5
|
+
API_VERSION = 1
|
6
|
+
FORM_GROUP_ID = 1
|
7
|
+
KEY = ''
|
8
|
+
SECRET = ''
|
9
|
+
CLIENT_ID = ''
|
10
|
+
OAUTH2_ENDPOINT = 'https://ats.eccmp.com/ats/oauth2/Token'.freeze
|
11
|
+
CONTENT_TYPE = 'application/x-www-form-urlencoded'.freeze
|
12
|
+
VALID_OPTIONS_KEYS = [:base_url,
|
13
|
+
:customer_id,
|
14
|
+
:api_version,
|
15
|
+
:form_group_id,
|
16
|
+
:key, :secret,
|
17
|
+
:client_id,
|
18
|
+
:oauth2_endpoint,
|
19
|
+
:content_type]
|
20
|
+
|
21
|
+
attr_accessor *VALID_OPTIONS_KEYS
|
22
|
+
|
23
|
+
# When this module is extended, set all configuration options to their default values
|
24
|
+
def self.extended(base)
|
25
|
+
base.reset
|
26
|
+
end
|
27
|
+
|
28
|
+
# Convenience method to allow configuration options to be set in a block
|
29
|
+
def configure
|
30
|
+
yield self
|
31
|
+
end
|
32
|
+
|
33
|
+
# Create a hash of options and their values
|
34
|
+
def options
|
35
|
+
VALID_OPTIONS_KEYS.inject({}) do |option, key|
|
36
|
+
option.merge!(key => send(key))
|
37
|
+
end
|
38
|
+
end
|
39
|
+
|
40
|
+
# Reset all configuration options to defaults
|
41
|
+
def reset
|
42
|
+
self.base_url = BASE_URL
|
43
|
+
self.customer_id = CUSTOMER_ID
|
44
|
+
self.api_version = API_VERSION
|
45
|
+
self.form_group_id = FORM_GROUP_ID
|
46
|
+
self.key = KEY
|
47
|
+
self.secret = SECRET
|
48
|
+
self.client_id = CLIENT_ID
|
49
|
+
self.oauth2_endpoint = OAUTH2_ENDPOINT
|
50
|
+
self.content_type = CONTENT_TYPE
|
51
|
+
end
|
52
|
+
|
53
|
+
end
|
54
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
|
2
|
+
module ExperianMS
|
3
|
+
module OAuth
|
4
|
+
attr_accessor :oauth_response
|
5
|
+
|
6
|
+
def authenticate
|
7
|
+
@oauth_response = HTTParty.post(oauth2_endpoint,
|
8
|
+
headers: header_params,
|
9
|
+
body: body_params).parsed_response
|
10
|
+
end
|
11
|
+
|
12
|
+
def grant_header
|
13
|
+
{ "Authorization" => "Bearer #{access_token}" }
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def header_params
|
19
|
+
{ "Content-Type" => "application/x-www-form-urlencoded" }
|
20
|
+
end
|
21
|
+
|
22
|
+
def body_params
|
23
|
+
"username=#{key}&password=#{secret}&grant_type=password&client_id=#{client_id}"
|
24
|
+
end
|
25
|
+
|
26
|
+
def access_token
|
27
|
+
oauth_response["access_token"]
|
28
|
+
end
|
29
|
+
|
30
|
+
def token_type
|
31
|
+
oauth_response["token_type"]
|
32
|
+
end
|
33
|
+
|
34
|
+
def expires_in
|
35
|
+
oauth_response["expires_in"]
|
36
|
+
end
|
37
|
+
|
38
|
+
def refresh_token
|
39
|
+
oauth_response["refresh_token"]
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,45 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://ats.eccmp.com/ats/oauth2/Token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: username=&password=&grant_type=password&client_id=
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Cache-Control:
|
18
|
+
- no-cache, no-store, must-revalidate
|
19
|
+
Pragma:
|
20
|
+
- no-cache
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Expires:
|
26
|
+
- '0'
|
27
|
+
Set-Cookie:
|
28
|
+
- ASP.NET_SessionId=ufqhynvtqwlaq2hcyk5llf4c; path=/; secure; HttpOnly
|
29
|
+
- BIGipServercnv_ats_ssl_pool=575084554.47873.0000; path=/; Httponly; Secure
|
30
|
+
- xyz_adm_adm_org_user_language_code=en; expires=Thu, 25-Aug-2016 14:01:09 GMT;
|
31
|
+
path=/
|
32
|
+
- xyz_adm_adm_org_user_locale_code=en-US; expires=Thu, 25-Aug-2016 14:01:09
|
33
|
+
GMT; path=/
|
34
|
+
- xyz_adm_adm_org_user_time_zone_id=; expires=Thu, 25-Aug-2016 14:01:09 GMT;
|
35
|
+
path=/
|
36
|
+
X-Powered-By:
|
37
|
+
- ASP.NET
|
38
|
+
Date:
|
39
|
+
- Fri, 27 May 2016 14:01:09 GMT
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"access_token":"AAEAAFak09rybM4rT1GWStkHYLlraADL0zt4_l0LfB66U82nR4OOvclg2tUm70Lc9lNm-ttZnJPztAmWqvjsN_5cWXSMQB0_5w6gF8_On9MjDK4h-DPgcN9cD_x-ANV8GbiqqQjV07TsAT8_qzJy_8NQXd7y7Pkqr_Nn2tMxAgEYVGxAk9G9RUmRt-YOA4bF_fW54eqys5D1HYPida6S6LpB6LR_D5CPtY4j_RftoYs63nYxkj7-l0uG33NzTbTYFtcw9pu9ENtCPzST42K9T_9RGPMdHkSxLqQm2ZYQqIDZxe4fPQK0fC6wFS-Wcgl2dzHhsoj9G7-flIe2Ul9PvYW7-450AQAAAAEAAG99f_oFLu4QO-y7RO4YzADU5mKXgRoXm8CwqxOPqhW7N-EXrT7dr5iM1gpY5Kf9fElN2EcMphDGBwxudRXJqAlI6eToRppwO9SaGCNUwpBWiboHihcYABZtuUIoeMln20xiRlIFw6YzrS_tB89mGd6RB1YJ9c3tsSL_Q5KnDH5HJrELmAPlcdgh-CuHhFRDapyEiSZucoPyhDacLlYIeYpjLnl_J3fWmo6LZvykHc7uR89aS0ge3X2SO4QsUtTHK0VBakzouezKlD6BdVdV7s4rVziH7Yt39XYmEETbWumRdyJXhLRi9ZkkA6oNL_PhJChX-4AKJkn3061rUYBQ7Cm_tPMt3eTyTPZPih78ze2VZLxkU0sNnB6stjy5JMbCahzTf_hv3FGZBr0aqmFMFS_skQtVgByR1MQ2Sc8rrcJZYNFRMIiZVy9IXHmfeTQEz_LF6wS4bFXQDuiwHR7wxi0Y8sT10qJ-UsrFiRIGPoW8","token_type":"bearer","expires_in":28800,"refresh_token":"k-Ou!IAAAAFO6iMpp1hsyhW9o7Fl8bWG0pzAJ3ZW7wkFL5ybc-TFegQAAAAG-lmFCKrZWhmM-5glme9P2W4VxduirwHUgS_lL2vxbTF6JifKPlFX9FvWQaonIqyIrIgHmVO2Z8ito-AszkhqNxUgUV8w9zOoA5OQvmKUdtlxZlMFe3hIFLU2YsV7j5KyEE39EWYFWsQPFyFTUozH3ARgjfbaEqkDY2BS632EBNg"}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Fri, 27 May 2016 14:01:11 GMT
|
45
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,101 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://ats.eccmp.com/ats/oauth2/Token
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: username=&password=&grant_type=&client_id=
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/x-www-form-urlencoded
|
12
|
+
response:
|
13
|
+
status:
|
14
|
+
code: 200
|
15
|
+
message: OK
|
16
|
+
headers:
|
17
|
+
Cache-Control:
|
18
|
+
- no-cache, no-store, must-revalidate
|
19
|
+
Pragma:
|
20
|
+
- no-cache
|
21
|
+
Transfer-Encoding:
|
22
|
+
- chunked
|
23
|
+
Content-Type:
|
24
|
+
- application/json; charset=utf-8
|
25
|
+
Expires:
|
26
|
+
- '0'
|
27
|
+
Set-Cookie:
|
28
|
+
- ASP.NET_SessionId=vdpwsplmklcarq1h4xc0kazn; path=/; secure; HttpOnly
|
29
|
+
- BIGipServercnv_ats_ssl_pool=575084554.47873.0000; path=/; Httponly; Secure
|
30
|
+
- xyz_adm_adm_org_user_language_code=en; expires=Thu, 25-Aug-2016 14:03:05 GMT;
|
31
|
+
path=/
|
32
|
+
- xyz_adm_adm_org_user_locale_code=en-US; expires=Thu, 25-Aug-2016 14:03:05
|
33
|
+
GMT; path=/
|
34
|
+
- xyz_adm_adm_org_user_time_zone_id=; expires=Thu, 25-Aug-2016 14:03:05 GMT;
|
35
|
+
path=/
|
36
|
+
X-Powered-By:
|
37
|
+
- ASP.NET
|
38
|
+
Date:
|
39
|
+
- Fri, 27 May 2016 14:03:05 GMT
|
40
|
+
body:
|
41
|
+
encoding: UTF-8
|
42
|
+
string: '{"access_token":"AAEAALAXJpqjojZzLmJn_HmxeQ89cfwBtK7GdnLhGJbFgWdKSaaM38qatPJ14p4XIFraRhfqlajpx26q-UufmXn3nUc8jbqC2_bnEh4jhzZ0eUv_05GcWHrW6kN6ZOlvEXns2urW0d2L3dl1rr9O72A-t2kNgDy4ai4gajgn4gM_LHpgWxY5CWZdzvsIqRxhPpfFbVCHY18WbgIJSXCE0elkX7D4EA81rP3XqOr7UHEt4UxrCHHYBEOjQPGOMFJN9_dBF5jqdBflbf6kf8jload4i2gsrCP6aWCraLsodfRuKkbmzEmi-vuwj2gA5sWUwmPXE5jZ-4LjF_uuoxLyI434jzJ0AQAAAAEAACBWQVUgFcbtTxKZqMzyEBX2SfPXQ66xeQXjLI5LRPBQwaWzP_SMRS_mlcsWdB8N70lv4qedQuWqYkGN748ve13T7dDwwoNALGscBE80CmdAbOb2FquLx2bkPX7roBFT4ciQUJklJjVRol2TTTvDcwEmPNyeefO3MYpFT6yX04-wGKIFFzXHaQ8IeB4gGBzsB6A1S4Run-Mw6xp4lY_HY1HnPW_8k7JtX7C3cmiIRABKBWzuyDX2s0F-qrP-d_KdcX9N2FFTdksDcxrvZTUq1BJj28zA6bEH-d3HQB-GI7MdjM5gODI0uiYGdQ6hImfkPVomMIMR1LWwDnz4tWBdcR3mZBJY7_h0IU_IXUMDEIDYGMM9nmkg9RTJmTlfCixVhQyNBSHLODZaxSe_-DeJXhA36tt9NksOzNTx9ZeNd7VW0E7aUxkfKXyelugA9SXCjJq_reiFapamheVk2ZLyCPkl_mgkYrmD5xIWee8h4bKm","token_type":"bearer","expires_in":28800,"refresh_token":"k-Ou!IAAAAHfY7WaM-yyvAs7cs2Lo7O3PHOExQhggqcWZLbW-umaDgQAAAAGKxEbeMau3t7WdgTEdecivryanQsaOJSUDd5rKZXpO6hTJ6bhKsPhBdYiTMGFf5rWikB3wAylCSRacij_FQdRGueGvEOKnfXj8K81tv2sbEYWCKhvoGtzQYLb4x-K4OmCfskp__63OulEfr5lZmmubsmdOc8ebTJMwOET0LetoOQ"}'
|
43
|
+
http_version:
|
44
|
+
recorded_at: Fri, 27 May 2016 14:03:06 GMT
|
45
|
+
- request:
|
46
|
+
method: post
|
47
|
+
uri: https://ats.eccmp.com/ats/XmlPost/PostSecureAuth2/
|
48
|
+
body:
|
49
|
+
encoding: UTF-8
|
50
|
+
string: |-
|
51
|
+
<ApiSubmission ApiVersion="1" FormGroupId="1" CustId="615">
|
52
|
+
<Records SubmissionSequence="2" FormId="19" TableName="User">
|
53
|
+
<Record>
|
54
|
+
<Field FieldName="user_id">12345</Field>
|
55
|
+
<Field FieldName="first_name">John</Field>
|
56
|
+
</Record>
|
57
|
+
</Records>
|
58
|
+
<Records SubmissionSequence="1" FormId="19" TableName="UserProfile">
|
59
|
+
<Record>
|
60
|
+
<Field FieldName="category">children</Field>
|
61
|
+
<Field FieldName="value">12345</Field>
|
62
|
+
</Record>
|
63
|
+
</Records>
|
64
|
+
</ApiSubmission>
|
65
|
+
headers:
|
66
|
+
Authorization:
|
67
|
+
- Bearer AAEAALAXJpqjojZzLmJn_HmxeQ89cfwBtK7GdnLhGJbFgWdKSaaM38qatPJ14p4XIFraRhfqlajpx26q-UufmXn3nUc8jbqC2_bnEh4jhzZ0eUv_05GcWHrW6kN6ZOlvEXns2urW0d2L3dl1rr9O72A-t2kNgDy4ai4gajgn4gM_LHpgWxY5CWZdzvsIqRxhPpfFbVCHY18WbgIJSXCE0elkX7D4EA81rP3XqOr7UHEt4UxrCHHYBEOjQPGOMFJN9_dBF5jqdBflbf6kf8jload4i2gsrCP6aWCraLsodfRuKkbmzEmi-vuwj2gA5sWUwmPXE5jZ-4LjF_uuoxLyI434jzJ0AQAAAAEAACBWQVUgFcbtTxKZqMzyEBX2SfPXQ66xeQXjLI5LRPBQwaWzP_SMRS_mlcsWdB8N70lv4qedQuWqYkGN748ve13T7dDwwoNALGscBE80CmdAbOb2FquLx2bkPX7roBFT4ciQUJklJjVRol2TTTvDcwEmPNyeefO3MYpFT6yX04-wGKIFFzXHaQ8IeB4gGBzsB6A1S4Run-Mw6xp4lY_HY1HnPW_8k7JtX7C3cmiIRABKBWzuyDX2s0F-qrP-d_KdcX9N2FFTdksDcxrvZTUq1BJj28zA6bEH-d3HQB-GI7MdjM5gODI0uiYGdQ6hImfkPVomMIMR1LWwDnz4tWBdcR3mZBJY7_h0IU_IXUMDEIDYGMM9nmkg9RTJmTlfCixVhQyNBSHLODZaxSe_-DeJXhA36tt9NksOzNTx9ZeNd7VW0E7aUxkfKXyelugA9SXCjJq_reiFapamheVk2ZLyCPkl_mgkYrmD5xIWee8h4bKm
|
68
|
+
response:
|
69
|
+
status:
|
70
|
+
code: 200
|
71
|
+
message: OK
|
72
|
+
headers:
|
73
|
+
Cache-Control:
|
74
|
+
- no-cache, no-store, must-revalidate
|
75
|
+
Pragma:
|
76
|
+
- no-cache
|
77
|
+
Content-Type:
|
78
|
+
- text/html; charset=utf-8
|
79
|
+
Expires:
|
80
|
+
- '0'
|
81
|
+
Set-Cookie:
|
82
|
+
- ASP.NET_SessionId=; path=/; secure
|
83
|
+
- BIGipServercnv_ats_ssl_pool=575084554.47873.0000; path=/; Httponly; Secure
|
84
|
+
- xyz_adm_adm_org_user_language_code=en; expires=Thu, 25-Aug-2016 14:14:49 GMT;
|
85
|
+
path=/
|
86
|
+
- xyz_adm_adm_org_user_locale_code=en-US; expires=Thu, 25-Aug-2016 14:14:49
|
87
|
+
GMT; path=/
|
88
|
+
- xyz_adm_adm_org_user_time_zone_id=; expires=Thu, 25-Aug-2016 14:14:49 GMT;
|
89
|
+
path=/
|
90
|
+
X-Powered-By:
|
91
|
+
- ASP.NET
|
92
|
+
Date:
|
93
|
+
- Fri, 27 May 2016 14:14:48 GMT
|
94
|
+
Content-Length:
|
95
|
+
- '34'
|
96
|
+
body:
|
97
|
+
encoding: UTF-8
|
98
|
+
string: Data saved and pending processing.
|
99
|
+
http_version:
|
100
|
+
recorded_at: Fri, 27 May 2016 14:14:50 GMT
|
101
|
+
recorded_with: VCR 3.0.3
|
@@ -0,0 +1,11 @@
|
|
1
|
+
<ApiSubmission ApiVersion="1" FormGroupId="1" SubmissionTrackingCode="SOMECODE" CustId="615">
|
2
|
+
<Records SubmissionSequence="1" FormId="19" TableName="User">
|
3
|
+
<Record>
|
4
|
+
<Field FieldName="user_profile_id">A</Field>
|
5
|
+
<Field FieldName="user_id">B</Field>
|
6
|
+
<Field FieldName="category">C</Field>
|
7
|
+
<Field FieldName="category_value">D</Field>
|
8
|
+
<Field FieldName="active_ind">Y</Field>
|
9
|
+
</Record>
|
10
|
+
</Records>
|
11
|
+
</ApiSubmission>
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require_relative '../spec_helper'
|
2
|
+
RSpec.describe ExperianMS do
|
3
|
+
# Configure Experian API
|
4
|
+
ExperianMS.configure do |config|
|
5
|
+
config.key = ''
|
6
|
+
config.secret = ''
|
7
|
+
config.client_id = 0
|
8
|
+
config.customer_id = 0
|
9
|
+
config.api_version = 1
|
10
|
+
config.form_group_id = 1
|
11
|
+
end
|
12
|
+
|
13
|
+
# Returns a new instance of the API
|
14
|
+
let(:client) { ExperianMS.api }
|
15
|
+
|
16
|
+
describe "attributes" do
|
17
|
+
it 'must include HTTParty' do
|
18
|
+
expect(ExperianMS::API).to include(HTTParty)
|
19
|
+
end
|
20
|
+
|
21
|
+
it 'must have base uri set to Experian API endpoint' do
|
22
|
+
expect(ExperianMS::API.base_uri).to eq 'https://ats.eccmp.com'
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
context '#authenticate' do
|
27
|
+
before do
|
28
|
+
VCR.insert_cassette 'client_auth', :record => :new_episodes
|
29
|
+
client.authenticate
|
30
|
+
end
|
31
|
+
|
32
|
+
after do
|
33
|
+
VCR.eject_cassette
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'returns JSON response' do
|
37
|
+
expect(client.oauth_response).to be_kind_of Hash
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'granted authorization' do
|
41
|
+
expect(client.grant_header).to be_kind_of Hash
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'is not a Bad Request' do
|
45
|
+
expect(client.oauth_response).to_not eq 'Bad Request'
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
describe "#request" do
|
50
|
+
let(:payload) { File.read('./spec/fixtures/xml/new_user.xml').chomp }
|
51
|
+
before do
|
52
|
+
VCR.insert_cassette 'new_user_post', :record => :new_episodes
|
53
|
+
end
|
54
|
+
|
55
|
+
after do
|
56
|
+
VCR.eject_cassette
|
57
|
+
end
|
58
|
+
|
59
|
+
it "posts xml successfully to Experia API" do
|
60
|
+
expect(client.request(payload)).to eq "Data saved and pending processing."
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#we need the actual library file
|
2
|
+
require_relative '../lib/experian_ms'
|
3
|
+
require 'webmock/rspec'
|
4
|
+
require 'vcr'
|
5
|
+
|
6
|
+
RSpec.configure do |c|
|
7
|
+
c.formatter = 'documentation'
|
8
|
+
end
|
9
|
+
|
10
|
+
# VCR configuration
|
11
|
+
VCR.configure do |c|
|
12
|
+
c.cassette_library_dir = 'spec/fixtures/dish_cassettes'
|
13
|
+
c.hook_into :webmock
|
14
|
+
end
|
metadata
ADDED
@@ -0,0 +1,144 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: experian_ms
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.5
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Elias J. Perez
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2016-06-05 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: httparty
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '0.13'
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '0.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '11.1'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '11.1'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: vcr
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: rspec
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '3.4'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '3.4'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '2.1'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '2.1'
|
83
|
+
description: |-
|
84
|
+
The Experian Marketing Suite is the world's most flexible
|
85
|
+
and comprehensive cloud-based marketing platform. More than 10,000 of the world's
|
86
|
+
leading brands, in over than 30 countries, are using the Experian Marketing Suite
|
87
|
+
to create and deliver intelligent interactions with their customers, every time.
|
88
|
+
|
89
|
+
Built from the ground-up leveraging 30 years of data-driven global marketing expertise,
|
90
|
+
the award-winning Experian Marketing Suite unites Experian's customer identity,
|
91
|
+
analytics and cross-channel marketing technology..
|
92
|
+
email: eperez@pinch.me
|
93
|
+
executables: []
|
94
|
+
extensions: []
|
95
|
+
extra_rdoc_files: []
|
96
|
+
files:
|
97
|
+
- ".gitignore"
|
98
|
+
- ".rspec"
|
99
|
+
- CODE_OF_CONDUCT.md
|
100
|
+
- Gemfile
|
101
|
+
- LICENSE.txt
|
102
|
+
- README.md
|
103
|
+
- Rakefile
|
104
|
+
- experian_ms.gemspec
|
105
|
+
- lib/experian_ms.rb
|
106
|
+
- lib/experian_ms/api.rb
|
107
|
+
- lib/experian_ms/configuration.rb
|
108
|
+
- lib/experian_ms/oauth.rb
|
109
|
+
- lib/experian_ms/version.rb
|
110
|
+
- spec/fixtures/dish_cassettes/client_auth.yml
|
111
|
+
- spec/fixtures/dish_cassettes/new_user_post.yml
|
112
|
+
- spec/fixtures/xml/new_user.xml
|
113
|
+
- spec/lib/experian_ms_spec.rb
|
114
|
+
- spec/spec_helper.rb
|
115
|
+
homepage: https://github.com/eliasjpr/experian-ms
|
116
|
+
licenses:
|
117
|
+
- MIT
|
118
|
+
metadata: {}
|
119
|
+
post_install_message:
|
120
|
+
rdoc_options: []
|
121
|
+
require_paths:
|
122
|
+
- lib
|
123
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
129
|
+
requirements:
|
130
|
+
- - ">="
|
131
|
+
- !ruby/object:Gem::Version
|
132
|
+
version: '0'
|
133
|
+
requirements: []
|
134
|
+
rubyforge_project: experian_ms
|
135
|
+
rubygems_version: 2.5.1
|
136
|
+
signing_key:
|
137
|
+
specification_version: 4
|
138
|
+
summary: A Ruby wrapper that Integrates Experian Marketing Suite endpoints.
|
139
|
+
test_files:
|
140
|
+
- spec/fixtures/dish_cassettes/client_auth.yml
|
141
|
+
- spec/fixtures/dish_cassettes/new_user_post.yml
|
142
|
+
- spec/fixtures/xml/new_user.xml
|
143
|
+
- spec/lib/experian_ms_spec.rb
|
144
|
+
- spec/spec_helper.rb
|