unresponsys 0.5 → 0.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/unresponsys/client.rb +4 -1
- data/lib/unresponsys/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 449bfa6bf87fc18f0a387f1a829ecf5d538799b5
|
4
|
+
data.tar.gz: 437b567f92aa2c2d2615fd7c86acdf860f109eaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e10538fedf736b1544e8b4fafd1cb27275c05d0e36ed1b73e020ff702f0016bde6f7e8ba0e77b323730ea6ee02e053fd26cce3f8b35537af7ec604f0387a8d8b
|
7
|
+
data.tar.gz: 607e67b5bb24e5c6f6d38f6ac3047d1513f0e108afa64e1440f3596b2eb76133a3feded6bdcf50cd3d2558a764557ac4b4164174b180c958a0f1281ce8447bff
|
data/lib/unresponsys/client.rb
CHANGED
@@ -4,8 +4,10 @@ class Unresponsys
|
|
4
4
|
class Client
|
5
5
|
def initialize(options = {})
|
6
6
|
raise Unresponsys::ArgumentError unless options[:username] && options[:password]
|
7
|
+
raise Unresponsys::ArgumentError unless [nil, 2, 5].include?(options[:interact])
|
7
8
|
@username = options[:username]
|
8
9
|
@password = options[:password]
|
10
|
+
@interact = options.fetch(:interact, 2)
|
9
11
|
@debug = options[:debug]
|
10
12
|
@logger = Logger.new(STDOUT) if @debug
|
11
13
|
@log_opts = { logger: @logger, log_level: :debug, log_format: :curl }
|
@@ -85,7 +87,8 @@ class Unresponsys
|
|
85
87
|
def authenticate
|
86
88
|
headers = { 'Content-Type' => 'application/x-www-form-urlencoded' }
|
87
89
|
body = { user_name: @username, password: @password, auth_type: 'password' }
|
88
|
-
|
90
|
+
host = "login#{@interact}.responsys.net"
|
91
|
+
response = HTTParty.post("https://#{host}/rest/api/v1/auth/token", headers: headers, body: body)
|
89
92
|
|
90
93
|
raise Unresponsys::AuthenticationError unless response.success?
|
91
94
|
|
data/lib/unresponsys/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: unresponsys
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.6'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kevin Kimball
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-08-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|