attune 1.0.9 → 1.0.10
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/attune.rb +2 -0
- data/lib/attune/api/anonymous.rb +37 -37
- data/lib/attune/api/entities.rb +160 -12
- data/lib/attune/models/blacklist.rb +30 -23
- data/lib/attune/models/blacklist_delete_response.rb +38 -0
- data/lib/attune/models/blacklist_params.rb +13 -13
- data/lib/attune/models/blacklist_update_response.rb +38 -0
- data/lib/attune/models/ranked_entities.rb +7 -7
- data/lib/attune/models/ranking_params.rb +18 -18
- data/lib/attune/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a4ef474d66c59fbfb92d08ebdc534457aaebd661
|
4
|
+
data.tar.gz: 2fd75bc17a939aa0fd00f738d253109977867e2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 50bbc9485525130501fe6662d724533103547c259d4fce88b2e9734237eb99997fa1d8fb01506a16851c81a58d15d620678fe7269dc818e1db79f7c52bb5b696
|
7
|
+
data.tar.gz: de04269263f15ef7e26d32cb15884c867a7a74641e15bd9af65bb835676ff5667dc8db9ea916c3c7f7df11b1a7f9eb5e6a7dc60687aa23eea68e2c3015e7d9e0
|
data/lib/attune.rb
CHANGED
@@ -13,10 +13,12 @@ require "attune/models/blacklist_params"
|
|
13
13
|
require "attune/models/ranked_entities"
|
14
14
|
require "attune/models/ranking_params"
|
15
15
|
require "attune/models/customer"
|
16
|
+
require "attune/models/blacklist_update_response"
|
16
17
|
require "attune/models/blacklist"
|
17
18
|
require "attune/models/batch_ranking_request"
|
18
19
|
require "attune/models/scope_entry"
|
19
20
|
require "attune/models/blacklist_save_response"
|
21
|
+
require "attune/models/blacklist_delete_response"
|
20
22
|
require "attune/models/batch_ranking_result"
|
21
23
|
|
22
24
|
module Attune
|
data/lib/attune/api/anonymous.rb
CHANGED
@@ -48,21 +48,23 @@ module Attune
|
|
48
48
|
|
49
49
|
end
|
50
50
|
|
51
|
-
#
|
51
|
+
# Binds one actor to another, allowing activities of those actors to be shared between the two.
|
52
52
|
#
|
53
53
|
# @param [String] anonymous
|
54
|
-
# @
|
54
|
+
# @param [Attune::Model::Customer] body
|
55
55
|
# @raise [ArgumentError] for invalid inputs
|
56
56
|
# @raise [Faraday::Error::ClientError] if the request fails or exceeds the timeout
|
57
57
|
# @raise [AuthenticationException] if authorization header not accepted
|
58
|
-
def
|
58
|
+
def update (anonymous,body)
|
59
59
|
query_param_keys = []
|
60
60
|
|
61
61
|
# verify existence of params
|
62
62
|
raise ArgumentError, "anonymous is required" if anonymous.nil?
|
63
|
+
raise ArgumentError, "body is required" if body.nil?
|
63
64
|
# set default values and merge with input
|
64
65
|
options = {
|
65
|
-
:anonymous => anonymous
|
66
|
+
:anonymous => anonymous,
|
67
|
+
:body => body}
|
66
68
|
|
67
69
|
#resource path
|
68
70
|
path = "/anonymous/{anonymous}".sub('{format}','json').sub('{' + 'anonymous' + '}', escapeString(anonymous))
|
@@ -75,38 +77,45 @@ module Attune
|
|
75
77
|
|
76
78
|
headers = nil
|
77
79
|
post_body = nil
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
80
|
+
if body != nil
|
81
|
+
if body.is_a?(Array)
|
82
|
+
array = Array.new
|
83
|
+
body.each do |item|
|
84
|
+
if item.respond_to?("to_body".to_sym)
|
85
|
+
array.push item.to_body
|
86
|
+
else
|
87
|
+
array.push item
|
88
|
+
end
|
89
|
+
end
|
90
|
+
post_body = array
|
91
|
+
|
86
92
|
else
|
87
|
-
|
93
|
+
if body.respond_to?("to_body".to_sym)
|
94
|
+
post_body = body.to_body
|
95
|
+
else
|
96
|
+
post_body = body
|
97
|
+
end
|
88
98
|
end
|
89
99
|
end
|
100
|
+
@client.request(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body})
|
90
101
|
|
91
102
|
end
|
92
103
|
|
93
|
-
#
|
104
|
+
# Returns an anonymous visitor, containing any assigned customer ID.
|
94
105
|
#
|
95
106
|
# @param [String] anonymous
|
96
|
-
# @
|
107
|
+
# @return [Attune::Model::Customer]
|
97
108
|
# @raise [ArgumentError] for invalid inputs
|
98
109
|
# @raise [Faraday::Error::ClientError] if the request fails or exceeds the timeout
|
99
110
|
# @raise [AuthenticationException] if authorization header not accepted
|
100
|
-
def
|
111
|
+
def get (anonymous)
|
101
112
|
query_param_keys = []
|
102
113
|
|
103
114
|
# verify existence of params
|
104
115
|
raise ArgumentError, "anonymous is required" if anonymous.nil?
|
105
|
-
raise ArgumentError, "body is required" if body.nil?
|
106
116
|
# set default values and merge with input
|
107
117
|
options = {
|
108
|
-
:anonymous => anonymous
|
109
|
-
:body => body}
|
118
|
+
:anonymous => anonymous}
|
110
119
|
|
111
120
|
#resource path
|
112
121
|
path = "/anonymous/{anonymous}".sub('{format}','json').sub('{' + 'anonymous' + '}', escapeString(anonymous))
|
@@ -119,27 +128,18 @@ module Attune
|
|
119
128
|
|
120
129
|
headers = nil
|
121
130
|
post_body = nil
|
122
|
-
|
123
|
-
|
124
|
-
|
125
|
-
|
126
|
-
|
127
|
-
|
128
|
-
|
129
|
-
|
130
|
-
end
|
131
|
-
end
|
132
|
-
post_body = array
|
133
|
-
|
131
|
+
response = @client.request(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
132
|
+
if response
|
133
|
+
Attune::Model::Customer.new(JSON.parse(response.body))
|
134
|
+
else
|
135
|
+
mockProc = MOCKS['Anonymous.get']
|
136
|
+
if mockProc
|
137
|
+
mockResponse = mockProc.call(anonymous)
|
138
|
+
Attune::Model::Customer.new(mockResponse)
|
134
139
|
else
|
135
|
-
|
136
|
-
post_body = body.to_body
|
137
|
-
else
|
138
|
-
post_body = body
|
139
|
-
end
|
140
|
+
nil
|
140
141
|
end
|
141
142
|
end
|
142
|
-
@client.request(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body})
|
143
143
|
|
144
144
|
end
|
145
145
|
|
data/lib/attune/api/entities.rb
CHANGED
@@ -10,13 +10,72 @@ module Attune
|
|
10
10
|
@client = client
|
11
11
|
end
|
12
12
|
|
13
|
+
# Save a new blacklist entry.
|
14
|
+
#
|
15
|
+
# @param [Attune::Model::BlacklistParams] body
|
16
|
+
# @return [Attune::Model::BlacklistSaveResponse]
|
17
|
+
# @raise [ArgumentError] for invalid inputs
|
18
|
+
# @raise [Faraday::Error::ClientError] if the request fails or exceeds the timeout
|
19
|
+
# @raise [AuthenticationException] if authorization header not accepted
|
20
|
+
def blacklist_save (body)
|
21
|
+
query_param_keys = []
|
22
|
+
|
23
|
+
# set default values and merge with input
|
24
|
+
options = {
|
25
|
+
:body => body}
|
26
|
+
|
27
|
+
#resource path
|
28
|
+
path = "/entities/rankings/blacklists".sub('{format}','json')
|
29
|
+
|
30
|
+
# pull querystring keys from options
|
31
|
+
queryopts = options.select do |key,value|
|
32
|
+
query_param_keys.include? key
|
33
|
+
end
|
34
|
+
|
35
|
+
headers = nil
|
36
|
+
post_body = nil
|
37
|
+
if body != nil
|
38
|
+
if body.is_a?(Array)
|
39
|
+
array = Array.new
|
40
|
+
body.each do |item|
|
41
|
+
if item.respond_to?("to_body".to_sym)
|
42
|
+
array.push item.to_body
|
43
|
+
else
|
44
|
+
array.push item
|
45
|
+
end
|
46
|
+
end
|
47
|
+
post_body = array
|
48
|
+
|
49
|
+
else
|
50
|
+
if body.respond_to?("to_body".to_sym)
|
51
|
+
post_body = body.to_body
|
52
|
+
else
|
53
|
+
post_body = body
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
58
|
+
if response
|
59
|
+
Attune::Model::BlacklistSaveResponse.new(JSON.parse(response.body))
|
60
|
+
else
|
61
|
+
mockProc = MOCKS['Entities.blacklist_save']
|
62
|
+
if mockProc
|
63
|
+
mockResponse = mockProc.call(body)
|
64
|
+
Attune::Model::BlacklistSaveResponse.new(mockResponse)
|
65
|
+
else
|
66
|
+
nil
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
13
72
|
# List all blacklist entries for your account.
|
14
73
|
#
|
15
74
|
# @return [Attune::Model::BlacklistGetResponse]
|
16
75
|
# @raise [ArgumentError] for invalid inputs
|
17
76
|
# @raise [Faraday::Error::ClientError] if the request fails or exceeds the timeout
|
18
77
|
# @raise [AuthenticationException] if authorization header not accepted
|
19
|
-
def
|
78
|
+
def blacklist_get_all ()
|
20
79
|
query_param_keys = []
|
21
80
|
|
22
81
|
# set default values and merge with input
|
@@ -37,7 +96,7 @@ module Attune
|
|
37
96
|
if response
|
38
97
|
Attune::Model::BlacklistGetResponse.new(JSON.parse(response.body))
|
39
98
|
else
|
40
|
-
mockProc = MOCKS['Entities.
|
99
|
+
mockProc = MOCKS['Entities.blacklist_get_all']
|
41
100
|
if mockProc
|
42
101
|
mockResponse = mockProc.call()
|
43
102
|
Attune::Model::BlacklistGetResponse.new(mockResponse)
|
@@ -48,22 +107,27 @@ module Attune
|
|
48
107
|
|
49
108
|
end
|
50
109
|
|
51
|
-
#
|
110
|
+
# Updates a blacklist with the specified ID.
|
52
111
|
#
|
112
|
+
# @param [String] id
|
53
113
|
# @param [Attune::Model::BlacklistParams] body
|
54
|
-
# @return [Attune::Model::
|
114
|
+
# @return [Attune::Model::BlacklistUpdateResponse]
|
55
115
|
# @raise [ArgumentError] for invalid inputs
|
56
116
|
# @raise [Faraday::Error::ClientError] if the request fails or exceeds the timeout
|
57
117
|
# @raise [AuthenticationException] if authorization header not accepted
|
58
|
-
def
|
118
|
+
def blacklist_update (id,body)
|
59
119
|
query_param_keys = []
|
60
120
|
|
121
|
+
# verify existence of params
|
122
|
+
raise ArgumentError, "id is required" if id.nil?
|
61
123
|
# set default values and merge with input
|
62
124
|
options = {
|
63
|
-
:
|
125
|
+
:id => id,
|
126
|
+
:body => body}
|
64
127
|
|
65
128
|
#resource path
|
66
|
-
path = "/entities/rankings/blacklists".sub('{format}','json')
|
129
|
+
path = "/entities/rankings/blacklists/{id}".sub('{format}','json').sub('{' + 'id' + '}', escapeString(id))
|
130
|
+
|
67
131
|
|
68
132
|
# pull querystring keys from options
|
69
133
|
queryopts = options.select do |key,value|
|
@@ -92,14 +156,98 @@ module Attune
|
|
92
156
|
end
|
93
157
|
end
|
94
158
|
end
|
95
|
-
response = @client.request(:
|
159
|
+
response = @client.request(:PUT, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
96
160
|
if response
|
97
|
-
Attune::Model::
|
161
|
+
Attune::Model::BlacklistUpdateResponse.new(JSON.parse(response.body))
|
98
162
|
else
|
99
|
-
mockProc = MOCKS['Entities.
|
163
|
+
mockProc = MOCKS['Entities.blacklist_update']
|
100
164
|
if mockProc
|
101
|
-
mockResponse = mockProc.call(body)
|
102
|
-
Attune::Model::
|
165
|
+
mockResponse = mockProc.call(id,body)
|
166
|
+
Attune::Model::BlacklistUpdateResponse.new(mockResponse)
|
167
|
+
else
|
168
|
+
nil
|
169
|
+
end
|
170
|
+
end
|
171
|
+
|
172
|
+
end
|
173
|
+
|
174
|
+
# Delete blacklist by id.
|
175
|
+
#
|
176
|
+
# @param [String] id
|
177
|
+
# @return [Attune::Model::BlacklistDeleteResponse]
|
178
|
+
# @raise [ArgumentError] for invalid inputs
|
179
|
+
# @raise [Faraday::Error::ClientError] if the request fails or exceeds the timeout
|
180
|
+
# @raise [AuthenticationException] if authorization header not accepted
|
181
|
+
def blacklist_delete (id)
|
182
|
+
query_param_keys = []
|
183
|
+
|
184
|
+
# verify existence of params
|
185
|
+
raise ArgumentError, "id is required" if id.nil?
|
186
|
+
# set default values and merge with input
|
187
|
+
options = {
|
188
|
+
:id => id}
|
189
|
+
|
190
|
+
#resource path
|
191
|
+
path = "/entities/rankings/blacklists/{id}".sub('{format}','json').sub('{' + 'id' + '}', escapeString(id))
|
192
|
+
|
193
|
+
|
194
|
+
# pull querystring keys from options
|
195
|
+
queryopts = options.select do |key,value|
|
196
|
+
query_param_keys.include? key
|
197
|
+
end
|
198
|
+
|
199
|
+
headers = nil
|
200
|
+
post_body = nil
|
201
|
+
response = @client.request(:DELETE, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
202
|
+
if response
|
203
|
+
Attune::Model::BlacklistDeleteResponse.new(JSON.parse(response.body))
|
204
|
+
else
|
205
|
+
mockProc = MOCKS['Entities.blacklist_delete']
|
206
|
+
if mockProc
|
207
|
+
mockResponse = mockProc.call(id)
|
208
|
+
Attune::Model::BlacklistDeleteResponse.new(mockResponse)
|
209
|
+
else
|
210
|
+
nil
|
211
|
+
end
|
212
|
+
end
|
213
|
+
|
214
|
+
end
|
215
|
+
|
216
|
+
# Returns the blacklist with the specified ID.
|
217
|
+
#
|
218
|
+
# @param [String] id
|
219
|
+
# @return [Attune::Model::Blacklist]
|
220
|
+
# @raise [ArgumentError] for invalid inputs
|
221
|
+
# @raise [Faraday::Error::ClientError] if the request fails or exceeds the timeout
|
222
|
+
# @raise [AuthenticationException] if authorization header not accepted
|
223
|
+
def blacklist_get (id)
|
224
|
+
query_param_keys = []
|
225
|
+
|
226
|
+
# verify existence of params
|
227
|
+
raise ArgumentError, "id is required" if id.nil?
|
228
|
+
# set default values and merge with input
|
229
|
+
options = {
|
230
|
+
:id => id}
|
231
|
+
|
232
|
+
#resource path
|
233
|
+
path = "/entities/rankings/blacklists/{id}".sub('{format}','json').sub('{' + 'id' + '}', escapeString(id))
|
234
|
+
|
235
|
+
|
236
|
+
# pull querystring keys from options
|
237
|
+
queryopts = options.select do |key,value|
|
238
|
+
query_param_keys.include? key
|
239
|
+
end
|
240
|
+
|
241
|
+
headers = nil
|
242
|
+
post_body = nil
|
243
|
+
response = @client.request(:GET, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
|
244
|
+
if response
|
245
|
+
Attune::Model::Blacklist.new(JSON.parse(response.body))
|
246
|
+
else
|
247
|
+
mockProc = MOCKS['Entities.blacklist_get']
|
248
|
+
if mockProc
|
249
|
+
mockResponse = mockProc.call(id)
|
250
|
+
Attune::Model::Blacklist.new(mockResponse)
|
103
251
|
else
|
104
252
|
nil
|
105
253
|
end
|
@@ -3,40 +3,44 @@ module Attune
|
|
3
3
|
#
|
4
4
|
#
|
5
5
|
# @attr [String] id
|
6
|
-
# @attr [Boolean] disabled
|
7
|
-
# @attr [String] consumer
|
8
6
|
# @attr [String] entity_type
|
9
|
-
# @attr [String]
|
7
|
+
# @attr [String] consumer
|
10
8
|
# @attr [String] end_date
|
9
|
+
# @attr [Boolean] disabled
|
11
10
|
# @attr [String] created_at
|
12
|
-
# @attr [
|
11
|
+
# @attr [String] start_date
|
13
12
|
# @attr [Array<String>] scope
|
13
|
+
# @attr [Array<String>] ids
|
14
|
+
# @attr [Boolean] active
|
14
15
|
class Blacklist
|
15
16
|
attr_accessor :id
|
16
17
|
|
17
18
|
|
18
|
-
attr_accessor :
|
19
|
+
attr_accessor :entity_type
|
19
20
|
|
20
21
|
|
21
22
|
attr_accessor :consumer
|
22
23
|
|
23
24
|
|
24
|
-
attr_accessor :
|
25
|
+
attr_accessor :end_date
|
25
26
|
|
26
27
|
|
27
|
-
attr_accessor :
|
28
|
+
attr_accessor :disabled
|
28
29
|
|
29
30
|
|
30
|
-
attr_accessor :
|
31
|
+
attr_accessor :created_at
|
31
32
|
|
32
33
|
|
33
|
-
attr_accessor :
|
34
|
+
attr_accessor :start_date
|
35
|
+
|
36
|
+
|
37
|
+
attr_accessor :scope
|
34
38
|
|
35
39
|
|
36
40
|
attr_accessor :ids
|
37
41
|
|
38
42
|
|
39
|
-
attr_accessor :
|
43
|
+
attr_accessor :active
|
40
44
|
|
41
45
|
|
42
46
|
def initialize(attributes = {})
|
@@ -44,27 +48,29 @@ module Attune
|
|
44
48
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
45
49
|
@id = attributes["id"] || attributes[:"id"]
|
46
50
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
47
|
-
@disabled = attributes["disabled"] || attributes[:"disabled"]
|
48
|
-
# Workaround since JSON.parse has accessors as strings rather than symbols
|
49
|
-
@consumer = attributes["consumer"] || attributes[:"consumer"]
|
50
|
-
# Workaround since JSON.parse has accessors as strings rather than symbols
|
51
51
|
@entity_type = attributes["entityType"] || attributes[:"entity_type"]
|
52
52
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
53
|
-
@
|
53
|
+
@consumer = attributes["consumer"] || attributes[:"consumer"]
|
54
54
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
55
55
|
@end_date = attributes["endDate"] || attributes[:"end_date"]
|
56
56
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
57
|
+
@disabled = attributes["disabled"] || attributes[:"disabled"]
|
58
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
57
59
|
@created_at = attributes["createdAt"] || attributes[:"created_at"]
|
58
|
-
|
60
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
61
|
+
@start_date = attributes["startDate"] || attributes[:"start_date"]
|
62
|
+
value = attributes["scope"] || attributes[:"scope"]
|
59
63
|
if value.is_a?(Array)
|
60
|
-
@
|
64
|
+
@scope = value
|
61
65
|
|
62
66
|
end
|
63
|
-
value = attributes["
|
67
|
+
value = attributes["ids"] || attributes[:"ids"]
|
64
68
|
if value.is_a?(Array)
|
65
|
-
@
|
69
|
+
@ids = value
|
66
70
|
|
67
71
|
end
|
72
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
73
|
+
@active = attributes["active"] || attributes[:"active"]
|
68
74
|
|
69
75
|
|
70
76
|
end
|
@@ -84,14 +90,15 @@ module Attune
|
|
84
90
|
# :internal => :external
|
85
91
|
ATTRIBUTE_MAP = {
|
86
92
|
:id => :id,
|
87
|
-
:disabled => :disabled,
|
88
|
-
:consumer => :consumer,
|
89
93
|
:entity_type => :entityType,
|
90
|
-
:
|
94
|
+
:consumer => :consumer,
|
91
95
|
:end_date => :endDate,
|
96
|
+
:disabled => :disabled,
|
92
97
|
:created_at => :createdAt,
|
98
|
+
:start_date => :startDate,
|
99
|
+
:scope => :scope,
|
93
100
|
:ids => :ids,
|
94
|
-
:
|
101
|
+
:active => :active
|
95
102
|
|
96
103
|
}
|
97
104
|
end
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Attune
|
2
|
+
module Model
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# @attr [String] result
|
6
|
+
class BlacklistDeleteResponse
|
7
|
+
attr_accessor :result
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(attributes = {})
|
11
|
+
return if attributes.empty?
|
12
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
13
|
+
@result = attributes["result"] || attributes[:"result"]
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_body
|
19
|
+
Hash[ATTRIBUTE_MAP.map do |internal, external|
|
20
|
+
next unless value = send(internal)
|
21
|
+
[external, value]
|
22
|
+
end.compact]
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_json(options = {})
|
26
|
+
to_body.to_json
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
# :internal => :external
|
31
|
+
ATTRIBUTE_MAP = {
|
32
|
+
:result => :result
|
33
|
+
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -2,14 +2,14 @@ module Attune
|
|
2
2
|
module Model
|
3
3
|
#
|
4
4
|
#
|
5
|
-
# @attr [
|
5
|
+
# @attr [Boolean] disabled
|
6
6
|
# @attr [String] entity_type
|
7
7
|
# @attr [Array<String>] ids
|
8
|
-
# @attr [
|
8
|
+
# @attr [Array<Attune::Model::ScopeEntry>] scope
|
9
9
|
# @attr [String] active_from
|
10
10
|
# @attr [String] active_to
|
11
11
|
class BlacklistParams
|
12
|
-
attr_accessor :
|
12
|
+
attr_accessor :disabled
|
13
13
|
|
14
14
|
|
15
15
|
attr_accessor :entity_type
|
@@ -18,7 +18,7 @@ module Attune
|
|
18
18
|
attr_accessor :ids
|
19
19
|
|
20
20
|
|
21
|
-
attr_accessor :
|
21
|
+
attr_accessor :scope
|
22
22
|
|
23
23
|
|
24
24
|
attr_accessor :active_from
|
@@ -29,11 +29,8 @@ module Attune
|
|
29
29
|
|
30
30
|
def initialize(attributes = {})
|
31
31
|
return if attributes.empty?
|
32
|
-
|
33
|
-
|
34
|
-
@scope = value
|
35
|
-
|
36
|
-
end
|
32
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
33
|
+
@disabled = attributes["disabled"] || attributes[:"disabled"]
|
37
34
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
38
35
|
@entity_type = attributes["entityType"] || attributes[:"entity_type"]
|
39
36
|
value = attributes["ids"] || attributes[:"ids"]
|
@@ -41,8 +38,11 @@ module Attune
|
|
41
38
|
@ids = value
|
42
39
|
|
43
40
|
end
|
44
|
-
|
45
|
-
|
41
|
+
value = attributes["scope"] || attributes[:"scope"]
|
42
|
+
if value.is_a?(Array)
|
43
|
+
@scope = value.map{ |v| ScopeEntry.new(v) }
|
44
|
+
|
45
|
+
end
|
46
46
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
47
47
|
@active_from = attributes["activeFrom"] || attributes[:"active_from"]
|
48
48
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
@@ -65,10 +65,10 @@ module Attune
|
|
65
65
|
private
|
66
66
|
# :internal => :external
|
67
67
|
ATTRIBUTE_MAP = {
|
68
|
-
:
|
68
|
+
:disabled => :disabled,
|
69
69
|
:entity_type => :entityType,
|
70
70
|
:ids => :ids,
|
71
|
-
:
|
71
|
+
:scope => :scope,
|
72
72
|
:active_from => :activeFrom,
|
73
73
|
:active_to => :activeTo
|
74
74
|
|
@@ -0,0 +1,38 @@
|
|
1
|
+
module Attune
|
2
|
+
module Model
|
3
|
+
#
|
4
|
+
#
|
5
|
+
# @attr [String] result
|
6
|
+
class BlacklistUpdateResponse
|
7
|
+
attr_accessor :result
|
8
|
+
|
9
|
+
|
10
|
+
def initialize(attributes = {})
|
11
|
+
return if attributes.empty?
|
12
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
13
|
+
@result = attributes["result"] || attributes[:"result"]
|
14
|
+
|
15
|
+
|
16
|
+
end
|
17
|
+
|
18
|
+
def to_body
|
19
|
+
Hash[ATTRIBUTE_MAP.map do |internal, external|
|
20
|
+
next unless value = send(internal)
|
21
|
+
[external, value]
|
22
|
+
end.compact]
|
23
|
+
end
|
24
|
+
|
25
|
+
def to_json(options = {})
|
26
|
+
to_body.to_json
|
27
|
+
end
|
28
|
+
|
29
|
+
private
|
30
|
+
# :internal => :external
|
31
|
+
ATTRIBUTE_MAP = {
|
32
|
+
:result => :result
|
33
|
+
|
34
|
+
}
|
35
|
+
end
|
36
|
+
end
|
37
|
+
end
|
38
|
+
|
@@ -3,29 +3,29 @@ module Attune
|
|
3
3
|
# List of ids in ranked order. If an error occurs, returns message and status code.
|
4
4
|
#
|
5
5
|
# @attr [String] message Error message if ranking failed
|
6
|
-
# @attr [Array<String>] ranking List of ids in ranked order
|
7
6
|
# @attr [Integer] status HTTP status code if ranking failed
|
7
|
+
# @attr [Array<String>] ranking List of ids in ranked order
|
8
8
|
class RankedEntities
|
9
9
|
attr_accessor :message
|
10
10
|
|
11
11
|
|
12
|
-
attr_accessor :
|
12
|
+
attr_accessor :status
|
13
13
|
|
14
14
|
|
15
|
-
attr_accessor :
|
15
|
+
attr_accessor :ranking
|
16
16
|
|
17
17
|
|
18
18
|
def initialize(attributes = {})
|
19
19
|
return if attributes.empty?
|
20
20
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
21
21
|
@message = attributes["message"] || attributes[:"message"]
|
22
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
23
|
+
@status = attributes["status"] || attributes[:"status"]
|
22
24
|
value = attributes["ranking"] || attributes[:"ranking"]
|
23
25
|
if value.is_a?(Array)
|
24
26
|
@ranking = value
|
25
27
|
|
26
28
|
end
|
27
|
-
# Workaround since JSON.parse has accessors as strings rather than symbols
|
28
|
-
@status = attributes["status"] || attributes[:"status"]
|
29
29
|
|
30
30
|
|
31
31
|
end
|
@@ -45,8 +45,8 @@ module Attune
|
|
45
45
|
# :internal => :external
|
46
46
|
ATTRIBUTE_MAP = {
|
47
47
|
:message => :message,
|
48
|
-
:
|
49
|
-
:
|
48
|
+
:status => :status,
|
49
|
+
:ranking => :ranking
|
50
50
|
|
51
51
|
}
|
52
52
|
end
|
@@ -2,25 +2,25 @@ module Attune
|
|
2
2
|
module Model
|
3
3
|
# Inputs for ranking a set of ids for a particular user.
|
4
4
|
#
|
5
|
-
# @attr [Array<Attune::Model::ScopeEntry>] scope
|
6
5
|
# @attr [String] view
|
7
|
-
# @attr [String] ip
|
8
6
|
# @attr [String] user_agent
|
7
|
+
# @attr [String] ip
|
8
|
+
# @attr [String] customer
|
9
9
|
# @attr [String] entity_type
|
10
10
|
# @attr [Array<String>] ids
|
11
|
-
# @attr [
|
11
|
+
# @attr [Array<Attune::Model::ScopeEntry>] scope
|
12
12
|
# @attr [String] anonymous
|
13
13
|
class RankingParams
|
14
|
-
attr_accessor :
|
14
|
+
attr_accessor :view
|
15
15
|
|
16
16
|
|
17
|
-
attr_accessor :
|
17
|
+
attr_accessor :user_agent
|
18
18
|
|
19
19
|
|
20
20
|
attr_accessor :ip
|
21
21
|
|
22
22
|
|
23
|
-
attr_accessor :
|
23
|
+
attr_accessor :customer
|
24
24
|
|
25
25
|
|
26
26
|
attr_accessor :entity_type
|
@@ -29,7 +29,7 @@ module Attune
|
|
29
29
|
attr_accessor :ids
|
30
30
|
|
31
31
|
|
32
|
-
attr_accessor :
|
32
|
+
attr_accessor :scope
|
33
33
|
|
34
34
|
|
35
35
|
attr_accessor :anonymous
|
@@ -37,17 +37,14 @@ module Attune
|
|
37
37
|
|
38
38
|
def initialize(attributes = {})
|
39
39
|
return if attributes.empty?
|
40
|
-
value = attributes["scope"] || attributes[:"scope"]
|
41
|
-
if value.is_a?(Array)
|
42
|
-
@scope = value.map{ |v| ScopeEntry.new(v) }
|
43
|
-
|
44
|
-
end
|
45
40
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
46
41
|
@view = attributes["view"] || attributes[:"view"]
|
47
42
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
43
|
+
@user_agent = attributes["userAgent"] || attributes[:"user_agent"]
|
44
|
+
# Workaround since JSON.parse has accessors as strings rather than symbols
|
48
45
|
@ip = attributes["ip"] || attributes[:"ip"]
|
49
46
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
50
|
-
@
|
47
|
+
@customer = attributes["customer"] || attributes[:"customer"]
|
51
48
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
52
49
|
@entity_type = attributes["entityType"] || attributes[:"entity_type"]
|
53
50
|
value = attributes["ids"] || attributes[:"ids"]
|
@@ -55,8 +52,11 @@ module Attune
|
|
55
52
|
@ids = value
|
56
53
|
|
57
54
|
end
|
58
|
-
|
59
|
-
|
55
|
+
value = attributes["scope"] || attributes[:"scope"]
|
56
|
+
if value.is_a?(Array)
|
57
|
+
@scope = value.map{ |v| ScopeEntry.new(v) }
|
58
|
+
|
59
|
+
end
|
60
60
|
# Workaround since JSON.parse has accessors as strings rather than symbols
|
61
61
|
@anonymous = attributes["anonymous"] || attributes[:"anonymous"]
|
62
62
|
|
@@ -77,13 +77,13 @@ module Attune
|
|
77
77
|
private
|
78
78
|
# :internal => :external
|
79
79
|
ATTRIBUTE_MAP = {
|
80
|
-
:scope => :scope,
|
81
80
|
:view => :view,
|
82
|
-
:ip => :ip,
|
83
81
|
:user_agent => :userAgent,
|
82
|
+
:ip => :ip,
|
83
|
+
:customer => :customer,
|
84
84
|
:entity_type => :entityType,
|
85
85
|
:ids => :ids,
|
86
|
-
:
|
86
|
+
:scope => :scope,
|
87
87
|
:anonymous => :anonymous
|
88
88
|
|
89
89
|
}
|
data/lib/attune/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: attune
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- John Hawthorn
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2014-07-
|
12
|
+
date: 2014-07-24 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
@@ -154,9 +154,11 @@ files:
|
|
154
154
|
- lib/attune/models/batch_ranking_request.rb
|
155
155
|
- lib/attune/models/batch_ranking_result.rb
|
156
156
|
- lib/attune/models/blacklist.rb
|
157
|
+
- lib/attune/models/blacklist_delete_response.rb
|
157
158
|
- lib/attune/models/blacklist_get_response.rb
|
158
159
|
- lib/attune/models/blacklist_params.rb
|
159
160
|
- lib/attune/models/blacklist_save_response.rb
|
161
|
+
- lib/attune/models/blacklist_update_response.rb
|
160
162
|
- lib/attune/models/customer.rb
|
161
163
|
- lib/attune/models/ranked_entities.rb
|
162
164
|
- lib/attune/models/ranking_params.rb
|
@@ -201,3 +203,4 @@ test_files:
|
|
201
203
|
- spec/attune_spec.rb
|
202
204
|
- spec/remote_spec.rb
|
203
205
|
- spec/spec_helper.rb
|
206
|
+
has_rdoc:
|