eloquant 0.1.0 → 0.9.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 +4 -4
- data/Gemfile.lock +16 -0
- data/README.md +100 -5
- data/bin/release +20 -0
- data/eloquant.gemspec +3 -0
- data/env.example +3 -0
- data/lib/eloquant.rb +75 -0
- data/lib/eloquant/concerns/accounts.rb +64 -0
- data/lib/eloquant/concerns/activities.rb +11 -0
- data/lib/eloquant/concerns/authentication.rb +27 -0
- data/lib/eloquant/concerns/campaign_responses.rb +11 -0
- data/lib/eloquant/concerns/campaigns.rb +11 -0
- data/lib/eloquant/concerns/connection.rb +36 -0
- data/lib/eloquant/concerns/contacts.rb +11 -0
- data/lib/eloquant/concerns/custom_objects.rb +5 -0
- data/lib/eloquant/concerns/events.rb +5 -0
- data/lib/eloquant/concerns/external_activities.rb +5 -0
- data/lib/eloquant/concerns/helpers.rb +15 -0
- data/lib/eloquant/concerns/opportunities.rb +11 -0
- data/lib/eloquant/errors.rb +24 -0
- data/lib/eloquant/faraday_middleware.rb +11 -0
- data/lib/eloquant/faraday_middleware/response.rb +29 -0
- data/lib/eloquant/version.rb +1 -1
- metadata +53 -4
- data/bin/console +0 -14
- data/bin/setup +0 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a0a3a8527d7b32dace13171f63ce5201dffc551a
|
4
|
+
data.tar.gz: 716deea872f8dfca5fafa101f84ce8f6d031f85c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d7c80e5db0b81ee79b8572c8d6b8db575df3bd39c63f485ed32a1aea7d11692867a9db4de4ea07ef26f4b1bf84947c5d0ffafc3352630289dcf1b9491d4b9e84
|
7
|
+
data.tar.gz: bd0275b74fe4b1e0e5e13cd9c47f483de431d2d5405f09633c853fef4ea4ed1d870adf33a8b0426bd165c7400a41cf320d2af3be447a0b33cc13f0e2da177608
|
data/Gemfile.lock
CHANGED
@@ -2,13 +2,24 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
eloquant (0.1.0)
|
5
|
+
faraday_middleware (> 0.9.0, < 0.11.0)
|
5
6
|
|
6
7
|
GEM
|
7
8
|
remote: https://rubygems.org/
|
8
9
|
specs:
|
10
|
+
addressable (2.5.2)
|
11
|
+
public_suffix (>= 2.0.2, < 4.0)
|
12
|
+
crack (0.4.3)
|
13
|
+
safe_yaml (~> 1.0.0)
|
9
14
|
diff-lcs (1.3)
|
10
15
|
docile (1.3.1)
|
16
|
+
faraday (0.15.3)
|
17
|
+
multipart-post (>= 1.2, < 3)
|
18
|
+
faraday_middleware (0.10.1)
|
19
|
+
faraday (>= 0.7.4, < 1.0)
|
11
20
|
json (2.1.0)
|
21
|
+
multipart-post (2.0.0)
|
22
|
+
public_suffix (3.0.3)
|
12
23
|
rake (10.5.0)
|
13
24
|
rspec (3.8.0)
|
14
25
|
rspec-core (~> 3.8.0)
|
@@ -23,11 +34,15 @@ GEM
|
|
23
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
24
35
|
rspec-support (~> 3.8.0)
|
25
36
|
rspec-support (3.8.0)
|
37
|
+
safe_yaml (1.0.4)
|
26
38
|
simplecov (0.16.1)
|
27
39
|
docile (~> 1.1)
|
28
40
|
json (>= 1.8, < 3)
|
29
41
|
simplecov-html (~> 0.10.0)
|
30
42
|
simplecov-html (0.10.2)
|
43
|
+
webmock (1.21.0)
|
44
|
+
addressable (>= 2.3.6)
|
45
|
+
crack (>= 0.3.2)
|
31
46
|
|
32
47
|
PLATFORMS
|
33
48
|
ruby
|
@@ -38,6 +53,7 @@ DEPENDENCIES
|
|
38
53
|
rake (~> 10.0)
|
39
54
|
rspec (~> 3.0)
|
40
55
|
simplecov (~> 0.16.0)
|
56
|
+
webmock (~> 1.21.0)
|
41
57
|
|
42
58
|
BUNDLED WITH
|
43
59
|
1.16.6
|
data/README.md
CHANGED
@@ -1,10 +1,85 @@
|
|
1
|
+
<div align="center">
|
2
|
+
|
3
|
+

|
4
|
+
|
1
5
|
# Eloquant
|
2
6
|
|
3
|
-
|
7
|
+
#### A wrapper for Oracle Eloqua's [REST API](https://docs.oracle.com/cloud/latest/marketingcs_gs/OMCAB/index.htm)
|
4
8
|
|
5
9
|
[](https://travis-ci.org/jstumbaugh/eloquant)
|
6
10
|
[](https://codeclimate.com/github/jstumbaugh/eloquant/test_coverage)
|
7
11
|
[](https://codeclimate.com/github/jstumbaugh/eloquant/maintainability)
|
12
|
+
[](https://badge.fury.io/rb/eloquant)
|
13
|
+
|
14
|
+
</div>
|
15
|
+
|
16
|
+
## Usage
|
17
|
+
|
18
|
+
### Client Instantiation
|
19
|
+
|
20
|
+
Eloquant uses Basic HTTP Authentication for retrieving data from Eloqua. You
|
21
|
+
need to supply the username, site/company name, and password when initializing
|
22
|
+
the client.
|
23
|
+
|
24
|
+
```ruby
|
25
|
+
Eloquant::Client.new(username: "username", sitename: "mycompany", password: "password")
|
26
|
+
```
|
27
|
+
|
28
|
+
Alternatively, you can store these variables in your environment file:
|
29
|
+
|
30
|
+
```
|
31
|
+
ELOQUA_USERNAME='username'
|
32
|
+
ELOQUA_SITENAME='mycompany'
|
33
|
+
ELOQUA_PASSWORD='password'
|
34
|
+
```
|
35
|
+
|
36
|
+
---------
|
37
|
+
|
38
|
+
### Available Endpoints
|
39
|
+
|
40
|
+
#### Accounts
|
41
|
+
|
42
|
+
- `describe_accounts` - Return the list of fields for an Account
|
43
|
+
- `describe_accounts_csv` - Return the list of fields for an Account as a CSV formatted string
|
44
|
+
|
45
|
+
#### Activities
|
46
|
+
|
47
|
+
- `describe_activities` - Return the list of fields for an Activity
|
48
|
+
- `describe_activities_csv` - Return the list of fields for an Activity as a CSV formatted string
|
49
|
+
|
50
|
+
#### Campaign Responses
|
51
|
+
|
52
|
+
- `describe_campaign_responses` - Return the list of fields for a Campaign Response
|
53
|
+
- `describe_campaign_responses_csv` - Return the list of fields for a Campaign Response as a CSV formatted string
|
54
|
+
|
55
|
+
#### Campaigns
|
56
|
+
|
57
|
+
- `describe_campaigns` - Return the list of fields for a Campaign
|
58
|
+
- `describe_campaigns_csv` - Return the list of fields for a Campaign as a CSV formatted string
|
59
|
+
|
60
|
+
#### Contacts
|
61
|
+
|
62
|
+
- `describe_contacts` - Return the list of fields for a Contact
|
63
|
+
- `describe_contacts_csv` - Return the list of fields for a Contact as a CSV formatted string
|
64
|
+
|
65
|
+
#### Custom Objects
|
66
|
+
|
67
|
+
- No describe is available for Custom Objects
|
68
|
+
|
69
|
+
#### Events
|
70
|
+
|
71
|
+
- No describe is available for Events
|
72
|
+
|
73
|
+
#### External Activities
|
74
|
+
|
75
|
+
- No describe is available for External Activities
|
76
|
+
|
77
|
+
#### Opportunities
|
78
|
+
|
79
|
+
- `describe_opportunities` - Return the list of fields for an Opportunity
|
80
|
+
- `describe_opportunities_csv` - Return the list of fields for an Opportunity as a CSV formatted string
|
81
|
+
|
82
|
+
-----------
|
8
83
|
|
9
84
|
## Installation
|
10
85
|
|
@@ -22,10 +97,6 @@ Or install it yourself as:
|
|
22
97
|
|
23
98
|
$ gem install eloquant
|
24
99
|
|
25
|
-
## Usage
|
26
|
-
|
27
|
-
TODO: Usage
|
28
|
-
|
29
100
|
## Contributing
|
30
101
|
|
31
102
|
Bug reports and pull requests are welcome on GitHub at
|
@@ -40,3 +111,27 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
40
111
|
## Code of Conduct
|
41
112
|
|
42
113
|
Everyone interacting in the Eloquant project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/jstumbaugh/eloquant/blob/master/CODE_OF_CONDUCT.md).
|
114
|
+
|
115
|
+
## Releasing to [RubyGems](https://rubygems.org/gems/eloquant)
|
116
|
+
|
117
|
+
Use the `bin/release` script to build, push, and tag this gem.
|
118
|
+
|
119
|
+
### Todo
|
120
|
+
|
121
|
+
- [X] See if we can do OAuth Password Credentials Grant -> Nope
|
122
|
+
- [X] Notes on using Basic HTTP Authentication
|
123
|
+
- [X] `env.example`?
|
124
|
+
- [ ] Implement endpoints
|
125
|
+
- [ ] Documentation on options in code and in readme
|
126
|
+
|
127
|
+
## Endpoints to Implement
|
128
|
+
|
129
|
+
- [ ] Accounts
|
130
|
+
- [ ] Activities
|
131
|
+
- [ ] Campaign Responses
|
132
|
+
- [ ] Campaigns
|
133
|
+
- [ ] Contacts
|
134
|
+
- [ ] Custom Objects - no describe
|
135
|
+
- [ ] Events - no describe
|
136
|
+
- [ ] External Activities - no describe
|
137
|
+
- [ ] Opportunities
|
data/bin/release
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
#!/usr/bin/env bash
|
2
|
+
set -euo pipefail
|
3
|
+
IFS=$'\n\t'
|
4
|
+
|
5
|
+
echo "Building Gem..."
|
6
|
+
gem build eloquant.gemspec
|
7
|
+
|
8
|
+
VERSION=$(cat lib/eloquant/version.rb | grep VERSION | awk '{print $3}' | sed 's/"//g')
|
9
|
+
TAG_VERSION="v$VERSION"
|
10
|
+
|
11
|
+
echo "Pushing to Rubygems..."
|
12
|
+
gem push "eloquant-$VERSION.gem"
|
13
|
+
|
14
|
+
echo "Tagging the repository at version $TAG_VERSION..."
|
15
|
+
git tag "$TAG_VERSION"
|
16
|
+
|
17
|
+
echo "Pushing the tag to the origin's repository..."
|
18
|
+
git push origin "$TAG_VERSION"
|
19
|
+
|
20
|
+
echo "Successfully released eloquant"
|
data/eloquant.gemspec
CHANGED
@@ -22,8 +22,11 @@ Gem::Specification.new do |spec|
|
|
22
22
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
23
23
|
spec.require_paths = ["lib"]
|
24
24
|
|
25
|
+
spec.add_dependency "faraday_middleware", "> 0.9.0", "< 0.11.0"
|
26
|
+
|
25
27
|
spec.add_development_dependency "bundler", "~> 1.16"
|
26
28
|
spec.add_development_dependency "rake", "~> 10.0"
|
27
29
|
spec.add_development_dependency "rspec", "~> 3.0"
|
28
30
|
spec.add_development_dependency "simplecov", "~> 0.16.0"
|
31
|
+
spec.add_development_dependency "webmock", "~> 1.21.0"
|
29
32
|
end
|
data/env.example
ADDED
data/lib/eloquant.rb
CHANGED
@@ -1,4 +1,79 @@
|
|
1
1
|
require "eloquant/version"
|
2
|
+
require "eloquant/errors"
|
3
|
+
|
4
|
+
require "eloquant/concerns/authentication"
|
5
|
+
require "eloquant/concerns/connection"
|
6
|
+
require "eloquant/concerns/helpers"
|
7
|
+
|
8
|
+
require "eloquant/concerns/accounts"
|
9
|
+
require "eloquant/concerns/activities"
|
10
|
+
require "eloquant/concerns/campaign_responses"
|
11
|
+
require "eloquant/concerns/campaigns"
|
12
|
+
require "eloquant/concerns/contacts"
|
13
|
+
require "eloquant/concerns/custom_objects"
|
14
|
+
require "eloquant/concerns/events"
|
15
|
+
require "eloquant/concerns/external_activities"
|
16
|
+
require "eloquant/concerns/opportunities"
|
2
17
|
|
3
18
|
module Eloquant
|
19
|
+
def self.client(options = {})
|
20
|
+
Client.new(options)
|
21
|
+
end
|
22
|
+
|
23
|
+
class Client
|
24
|
+
DEFAULT_HOST_URL = "https://login.eloqua.com".freeze
|
25
|
+
|
26
|
+
include Authentication
|
27
|
+
include Connection
|
28
|
+
include Helpers
|
29
|
+
|
30
|
+
include Accounts
|
31
|
+
include Activities
|
32
|
+
include CampaignResponses
|
33
|
+
include Campaigns
|
34
|
+
include Contacts
|
35
|
+
include CustomObjects
|
36
|
+
include Events
|
37
|
+
include ExternalActivities
|
38
|
+
include Opportunities
|
39
|
+
|
40
|
+
def initialize(options = {})
|
41
|
+
# Required
|
42
|
+
@username = options.fetch(:username, ENV["ELOQUA_USERNAME"])
|
43
|
+
@sitename = options.fetch(:sitename, ENV["ELOQUA_SITENAME"])
|
44
|
+
@password = options.fetch(:password, ENV["ELOQUA_PASSWORD"])
|
45
|
+
|
46
|
+
# Optional
|
47
|
+
@max_retries = options.fetch(:max_retries, 10)
|
48
|
+
@connection = options.fetch(:connection, nil)
|
49
|
+
@debug = options.fetch(:debug, true)
|
50
|
+
@host = options.fetch(:host, DEFAULT_HOST_URL)
|
51
|
+
|
52
|
+
@options = options
|
53
|
+
end
|
54
|
+
|
55
|
+
%i(get post delete).each do |http_method|
|
56
|
+
define_method(http_method) do |path, payload = {}, custom_headers = {}, &block|
|
57
|
+
set_host_url_if_default
|
58
|
+
|
59
|
+
response = connection.send(http_method, path, payload) do |request|
|
60
|
+
add_authorization(request)
|
61
|
+
|
62
|
+
custom_headers.each do |key, value|
|
63
|
+
request.headers[key] = value
|
64
|
+
end
|
65
|
+
|
66
|
+
block.call(request) unless block.nil?
|
67
|
+
end
|
68
|
+
|
69
|
+
response.body
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
def set_host_url_if_default
|
74
|
+
if @host == DEFAULT_HOST_URL
|
75
|
+
set_host_url_to_clients_url
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
4
79
|
end
|
@@ -0,0 +1,64 @@
|
|
1
|
+
module Eloquant
|
2
|
+
module Accounts
|
3
|
+
def describe_accounts
|
4
|
+
get("/api/bulk/2.0/accounts/fields")
|
5
|
+
end
|
6
|
+
|
7
|
+
def describe_accounts_csv(params = {})
|
8
|
+
get("/api/bulk/2.0/accounts/fields", params, csv_custom_headers)
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_bulk_account_export(params = {})
|
12
|
+
response = create_account_export(params)
|
13
|
+
export_uri = response[:uri]
|
14
|
+
|
15
|
+
status_response = enqueue_export(export_uri)
|
16
|
+
sync_uri = status_response[:uri]
|
17
|
+
|
18
|
+
status = status_response[:status]
|
19
|
+
|
20
|
+
while status != "success"
|
21
|
+
sleep(10)
|
22
|
+
|
23
|
+
status_response = check_export_status(sync_uri)
|
24
|
+
status = status_response[:status]
|
25
|
+
end
|
26
|
+
|
27
|
+
sync_uri
|
28
|
+
end
|
29
|
+
|
30
|
+
def get_export_data(sync_uri, offset: 0)
|
31
|
+
get("/api/bulk/2.0#{sync_uri}/data", offset: offset)
|
32
|
+
end
|
33
|
+
|
34
|
+
def list_account_exports
|
35
|
+
get("/api/bulk/2.0/accounts/exports")
|
36
|
+
end
|
37
|
+
|
38
|
+
def delete_account_export(id:)
|
39
|
+
delete("/api/bulk/2.0/accounts/exports/#{id}")
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
# Need a `name` and a `fields` list
|
45
|
+
def create_account_export(name: "Eloquant Account Export", fields: {})
|
46
|
+
params = {
|
47
|
+
name: name,
|
48
|
+
fields: fields,
|
49
|
+
}
|
50
|
+
|
51
|
+
json_post("/api/bulk/2.0/accounts/exports", params)
|
52
|
+
end
|
53
|
+
|
54
|
+
def enqueue_export(export_uri)
|
55
|
+
params = { syncedInstanceUri: export_uri }
|
56
|
+
|
57
|
+
json_post("/api/bulk/2.0/syncs", params)
|
58
|
+
end
|
59
|
+
|
60
|
+
def check_export_status(sync_uri)
|
61
|
+
get("/api/bulk/2.0#{sync_uri}")
|
62
|
+
end
|
63
|
+
end
|
64
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
module Eloquant
|
2
|
+
module Authentication
|
3
|
+
def add_authorization(request)
|
4
|
+
request.headers["Authorization"] = "Basic #{encoded_sitename_username_and_password}"
|
5
|
+
end
|
6
|
+
|
7
|
+
def username_and_sitename
|
8
|
+
"#{@sitename}\\#{@username}"
|
9
|
+
end
|
10
|
+
|
11
|
+
def encoded_sitename_username_and_password
|
12
|
+
Base64.encode64("#{@sitename}\\#{@username}:#{@password}")
|
13
|
+
end
|
14
|
+
|
15
|
+
def set_host_url_to_clients_url
|
16
|
+
@host = host_information[:urls][:base]
|
17
|
+
|
18
|
+
reload_connection
|
19
|
+
end
|
20
|
+
|
21
|
+
def host_information
|
22
|
+
@host_information ||= connection.get("/id") do |request|
|
23
|
+
add_authorization(request)
|
24
|
+
end.body
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
module Eloquant
|
2
|
+
module CampaignResponses
|
3
|
+
def describe_campaign_responses
|
4
|
+
get("/api/bulk/2.0/campaignResponses/fields")
|
5
|
+
end
|
6
|
+
|
7
|
+
def describe_campaign_responses_csv(params = {})
|
8
|
+
get("/api/bulk/2.0/campaignResponses/fields", params, csv_custom_headers)
|
9
|
+
end
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require "eloquant/faraday_middleware"
|
2
|
+
|
3
|
+
module Eloquant
|
4
|
+
module Connection
|
5
|
+
attr_accessor :connection
|
6
|
+
|
7
|
+
def connection
|
8
|
+
@connection ||= init_connection
|
9
|
+
end
|
10
|
+
|
11
|
+
def reload_connection
|
12
|
+
@connection = init_connection
|
13
|
+
end
|
14
|
+
|
15
|
+
def init_connection
|
16
|
+
Faraday.new(url: @host) do |conn|
|
17
|
+
conn.request :multipart
|
18
|
+
conn.request :url_encoded
|
19
|
+
|
20
|
+
conn.request :retry, max: 10, interval: 0.05,
|
21
|
+
interval_randomness: 0.5, backoff_factor: 2,
|
22
|
+
exceptions: [Errno::ETIMEDOUT, "Timeout::Error",
|
23
|
+
::Faraday::Error::TimeoutError,
|
24
|
+
::Faraday::ConnectionFailed]
|
25
|
+
|
26
|
+
conn.response :logger if @debug
|
27
|
+
conn.response :eloquant, content_type: /\bjson$/
|
28
|
+
|
29
|
+
conn.options.timeout = @options[:read_timeout] if @options.key?(:read_timeout)
|
30
|
+
conn.options.open_timeout = @options[:open_timeout] if @options.key?(:open_timeout)
|
31
|
+
|
32
|
+
conn.adapter Faraday.default_adapter
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,15 @@
|
|
1
|
+
module Eloquant
|
2
|
+
module Helpers
|
3
|
+
def csv_custom_headers
|
4
|
+
{ "Content-Type" => "text/csv" }
|
5
|
+
end
|
6
|
+
|
7
|
+
def json_custom_headers
|
8
|
+
{ "Content-Type" => "application/json" }
|
9
|
+
end
|
10
|
+
|
11
|
+
def json_post(path, params)
|
12
|
+
post(path, JSON.generate(params), json_custom_headers)
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
module Eloquant
|
2
|
+
class Errors
|
3
|
+
class Error < StandardError
|
4
|
+
end
|
5
|
+
|
6
|
+
def self.create_class
|
7
|
+
Class.new(Error)
|
8
|
+
end
|
9
|
+
|
10
|
+
Unknown = create_class
|
11
|
+
EmptyResponse = create_class
|
12
|
+
AuthorizationError = create_class
|
13
|
+
|
14
|
+
RESPONSE_CODE_TO_ERROR = {}.freeze
|
15
|
+
|
16
|
+
RESPONSE_CODE_TO_ERROR.values.each do |class_name|
|
17
|
+
const_set(class_name, create_class)
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.find_by_response_code(response_code)
|
21
|
+
const_get(RESPONSE_CODE_TO_ERROR.fetch(response_code, "Error"))
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -0,0 +1,11 @@
|
|
1
|
+
require "faraday"
|
2
|
+
|
3
|
+
module Eloquant
|
4
|
+
module FaradayMiddleware
|
5
|
+
autoload :Response, "eloquant/faraday_middleware/response"
|
6
|
+
end
|
7
|
+
|
8
|
+
if Faraday::Middleware.respond_to?(:register_middleware)
|
9
|
+
Faraday::Response.register_middleware eloquant: -> { Eloquant::FaradayMiddleware::Response }
|
10
|
+
end
|
11
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require "faraday_middleware"
|
2
|
+
|
3
|
+
module Eloquant
|
4
|
+
module FaradayMiddleware
|
5
|
+
class Response < ::FaradayMiddleware::ParseJson
|
6
|
+
define_parser do |body|
|
7
|
+
JSON.parse(body, symbolize_names: true) unless body.strip.empty?
|
8
|
+
end
|
9
|
+
|
10
|
+
def process_response(env)
|
11
|
+
super
|
12
|
+
|
13
|
+
data = env[:body]
|
14
|
+
|
15
|
+
fail Eloquant::Errors::EmptyResponse if data.nil?
|
16
|
+
fail Eloquant::Errors::Error, data[:error_description] if data.key?(:error)
|
17
|
+
|
18
|
+
handle_errors!(data[:errors]) unless data.fetch(:success, true)
|
19
|
+
end
|
20
|
+
|
21
|
+
def handle_errors!(errors)
|
22
|
+
error = errors.first
|
23
|
+
|
24
|
+
fail Eloquant::Errors::Unknown if error.nil?
|
25
|
+
fail Eloquant::Errors.find_by_response_code(error[:code].to_i), error[:message]
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
data/lib/eloquant/version.rb
CHANGED
metadata
CHANGED
@@ -1,15 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: eloquant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.9.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jason Stumbaugh
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-10-
|
11
|
+
date: 2018-10-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday_middleware
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.9.0
|
20
|
+
- - "<"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 0.11.0
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.9.0
|
30
|
+
- - "<"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 0.11.0
|
13
33
|
- !ruby/object:Gem::Dependency
|
14
34
|
name: bundler
|
15
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -66,6 +86,20 @@ dependencies:
|
|
66
86
|
- - "~>"
|
67
87
|
- !ruby/object:Gem::Version
|
68
88
|
version: 0.16.0
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: webmock
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - "~>"
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.21.0
|
96
|
+
type: :development
|
97
|
+
prerelease: false
|
98
|
+
version_requirements: !ruby/object:Gem::Requirement
|
99
|
+
requirements:
|
100
|
+
- - "~>"
|
101
|
+
- !ruby/object:Gem::Version
|
102
|
+
version: 1.21.0
|
69
103
|
description: This gem provides a nice ruby interface to work with Oracle Eloqua's
|
70
104
|
REST API
|
71
105
|
email:
|
@@ -83,10 +117,25 @@ files:
|
|
83
117
|
- LICENSE.txt
|
84
118
|
- README.md
|
85
119
|
- Rakefile
|
86
|
-
- bin/
|
87
|
-
- bin/setup
|
120
|
+
- bin/release
|
88
121
|
- eloquant.gemspec
|
122
|
+
- env.example
|
89
123
|
- lib/eloquant.rb
|
124
|
+
- lib/eloquant/concerns/accounts.rb
|
125
|
+
- lib/eloquant/concerns/activities.rb
|
126
|
+
- lib/eloquant/concerns/authentication.rb
|
127
|
+
- lib/eloquant/concerns/campaign_responses.rb
|
128
|
+
- lib/eloquant/concerns/campaigns.rb
|
129
|
+
- lib/eloquant/concerns/connection.rb
|
130
|
+
- lib/eloquant/concerns/contacts.rb
|
131
|
+
- lib/eloquant/concerns/custom_objects.rb
|
132
|
+
- lib/eloquant/concerns/events.rb
|
133
|
+
- lib/eloquant/concerns/external_activities.rb
|
134
|
+
- lib/eloquant/concerns/helpers.rb
|
135
|
+
- lib/eloquant/concerns/opportunities.rb
|
136
|
+
- lib/eloquant/errors.rb
|
137
|
+
- lib/eloquant/faraday_middleware.rb
|
138
|
+
- lib/eloquant/faraday_middleware/response.rb
|
90
139
|
- lib/eloquant/version.rb
|
91
140
|
homepage: https://github.com/jstumbaugh/eloquant
|
92
141
|
licenses:
|
data/bin/console
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require "bundler/setup"
|
4
|
-
require "eloquant"
|
5
|
-
|
6
|
-
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
-
# with your gem easier. You can also use a different console, if you like.
|
8
|
-
|
9
|
-
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
-
# require "pry"
|
11
|
-
# Pry.start
|
12
|
-
|
13
|
-
require "irb"
|
14
|
-
IRB.start(__FILE__)
|