attune 1.0.17 → 1.0.18

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8230dee1fb1dfdd00d7ecafdac74c1d2b201b6fb
4
- data.tar.gz: 206ce4cbc055a9840de86b9b81bddcb7c0908609
3
+ metadata.gz: b82bbe147e7a55657adf794d2bc4eb8674f83df8
4
+ data.tar.gz: 9f65ceb0b571d5ff090133f94dfb9b95b10b2f10
5
5
  SHA512:
6
- metadata.gz: 5bef816aabbdbc5452d9d11f07fe6610203fa333f40ffdc70145ce995c749a94f5a2f20204e87b580270ac12d5b018bd199962d9e4cffd0cf1fd1499d0868d70
7
- data.tar.gz: 1db4fda86189b962b830e8575a022768dcc70a549a1fb57e7eb29ba7cff3c145972379042bd2313775a0f1e7d6c18daaa2f017420a3435c733b4e7d61a66724e
6
+ metadata.gz: 6a69cc215591ced45b1734d538ea381281dcdc9e506b37a2a180e26048449bb8b1a788f2e87bfa807a53b1c51ee623796350ce1161ebea8400f3f79aa9eb3bd3
7
+ data.tar.gz: 3dd50cb6a319c97f33ecf1b3116da189fe2d2f64c502b3bd14a203012007f483d76e37ab39436164e8ce8300bd5e989c64c221a048130182c8971b84619ddbe0
@@ -33,10 +33,10 @@ module Attune
33
33
 
34
34
  headers = nil
35
35
  post_body = nil
36
- #response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
37
- #if response
38
- # Attune::Model::AnonymousResult.new(JSON.parse(response.body))
39
- #else
36
+ response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
37
+ if response
38
+ Attune::Model::AnonymousResult.new(JSON.parse(response.body))
39
+ else
40
40
  mockProc = MOCKS['Anonymous.create']
41
41
  if mockProc
42
42
  mockResponse = mockProc.call()
@@ -44,7 +44,7 @@ module Attune
44
44
  else
45
45
  nil
46
46
  end
47
- # end
47
+ end
48
48
 
49
49
  end
50
50
 
@@ -59,11 +59,7 @@ module Attune
59
59
  query_param_keys = []
60
60
 
61
61
  # verify existence of params
62
- #raise ArgumentError, "anonymous is required" if anonymous.nil?
63
- if anonymous == nil
64
- anonymous = SecureRandom.uuid
65
- end
66
-
62
+ raise ArgumentError, "anonymous is required" if anonymous.nil?
67
63
  raise ArgumentError, "body is required" if body.nil?
68
64
  # set default values and merge with input
69
65
  options = {
@@ -116,11 +112,7 @@ module Attune
116
112
  query_param_keys = []
117
113
 
118
114
  # verify existence of params
119
- # raise ArgumentError, "anonymous is required" if anonymous.nil?
120
- if anonymous == nil
121
- anonymous = SecureRandom.uuid
122
- end
123
-
115
+ raise ArgumentError, "anonymous is required" if anonymous.nil?
124
116
  # set default values and merge with input
125
117
  options = {
126
118
  :anonymous => anonymous}
@@ -274,8 +274,6 @@ module Attune
274
274
  #resource path
275
275
  path = "/entities/ranking".sub('{format}','json')
276
276
 
277
-
278
-
279
277
  # pull querystring keys from options
280
278
  queryopts = options.select do |key,value|
281
279
  query_param_keys.include? key
@@ -303,11 +301,6 @@ module Attune
303
301
  end
304
302
  end
305
303
  end
306
-
307
- if !post_body.has_key?("anonymous".to_sym)
308
- post_body['anonymous'] = SecureRandom.uuid
309
- end
310
-
311
304
  response = @client.request(:POST, path, {:params=>queryopts,:headers=>headers, :body=>post_body })
312
305
  if response
313
306
  Attune::Model::RankedEntities.new(JSON.parse(response.body))
@@ -70,7 +70,6 @@ module Attune
70
70
  adapter_method.call do |req|
71
71
  req.url path
72
72
  req.headers['Content-Type'] = 'application/json'
73
- req.headers['User-Agent'] = 'Attune RClient ' + Attune::VERSION
74
73
  req.headers.merge! opts[:headers] if opts[:headers]
75
74
  req.params = opts[:params] if opts[:params]
76
75
  req.body = ::JSON.dump(opts[:body]) if opts[:body]
@@ -3,71 +3,71 @@ module Attune
3
3
  #
4
4
  #
5
5
  # @attr [String] id
6
- # @attr [String] end_date
7
- # @attr [String] start_date
8
- # @attr [String] entity_type
9
- # @attr [String] consumer
10
6
  # @attr [Array<String>] ids
11
- # @attr [String] created_date
12
- # @attr [String] updated_date
7
+ # @attr [String] consumer
8
+ # @attr [String] entity_type
9
+ # @attr [String] start_date
10
+ # @attr [String] end_date
13
11
  # @attr [String] scope
14
12
  # @attr [Boolean] disabled
13
+ # @attr [String] created_date
14
+ # @attr [String] updated_date
15
15
  class Blacklist
16
16
  attr_accessor :id
17
17
 
18
18
 
19
- attr_accessor :end_date
19
+ attr_accessor :ids
20
20
 
21
21
 
22
- attr_accessor :start_date
22
+ attr_accessor :consumer
23
23
 
24
24
 
25
25
  attr_accessor :entity_type
26
26
 
27
27
 
28
- attr_accessor :consumer
28
+ attr_accessor :start_date
29
29
 
30
30
 
31
- attr_accessor :ids
31
+ attr_accessor :end_date
32
32
 
33
33
 
34
- attr_accessor :created_date
34
+ attr_accessor :scope
35
35
 
36
36
 
37
- attr_accessor :updated_date
37
+ attr_accessor :disabled
38
38
 
39
39
 
40
- attr_accessor :scope
40
+ attr_accessor :created_date
41
41
 
42
42
 
43
- attr_accessor :disabled
43
+ attr_accessor :updated_date
44
44
 
45
45
 
46
46
  def initialize(attributes = {})
47
47
  return if attributes.empty?
48
48
  # Workaround since JSON.parse has accessors as strings rather than symbols
49
49
  @id = attributes["id"] || attributes[:"id"]
50
- # Workaround since JSON.parse has accessors as strings rather than symbols
51
- @end_date = attributes["endDate"] || attributes[:"end_date"]
52
- # Workaround since JSON.parse has accessors as strings rather than symbols
53
- @start_date = attributes["startDate"] || attributes[:"start_date"]
54
- # Workaround since JSON.parse has accessors as strings rather than symbols
55
- @entity_type = attributes["entityType"] || attributes[:"entity_type"]
56
- # Workaround since JSON.parse has accessors as strings rather than symbols
57
- @consumer = attributes["consumer"] || attributes[:"consumer"]
58
50
  value = attributes["ids"] || attributes[:"ids"]
59
51
  if value.is_a?(Array)
60
52
  @ids = value
61
53
 
62
54
  end
63
55
  # Workaround since JSON.parse has accessors as strings rather than symbols
64
- @created_date = attributes["createdDate"] || attributes[:"created_date"]
56
+ @consumer = attributes["consumer"] || attributes[:"consumer"]
65
57
  # Workaround since JSON.parse has accessors as strings rather than symbols
66
- @updated_date = attributes["updatedDate"] || attributes[:"updated_date"]
58
+ @entity_type = attributes["entityType"] || attributes[:"entity_type"]
59
+ # Workaround since JSON.parse has accessors as strings rather than symbols
60
+ @start_date = attributes["startDate"] || attributes[:"start_date"]
61
+ # Workaround since JSON.parse has accessors as strings rather than symbols
62
+ @end_date = attributes["endDate"] || attributes[:"end_date"]
67
63
  # Workaround since JSON.parse has accessors as strings rather than symbols
68
64
  @scope = attributes["scope"] || attributes[:"scope"]
69
65
  # Workaround since JSON.parse has accessors as strings rather than symbols
70
66
  @disabled = attributes["disabled"] || attributes[:"disabled"]
67
+ # Workaround since JSON.parse has accessors as strings rather than symbols
68
+ @created_date = attributes["createdDate"] || attributes[:"created_date"]
69
+ # Workaround since JSON.parse has accessors as strings rather than symbols
70
+ @updated_date = attributes["updatedDate"] || attributes[:"updated_date"]
71
71
 
72
72
 
73
73
  end
@@ -87,15 +87,15 @@ module Attune
87
87
  # :internal => :external
88
88
  ATTRIBUTE_MAP = {
89
89
  :id => :id,
90
- :end_date => :endDate,
91
- :start_date => :startDate,
92
- :entity_type => :entityType,
93
- :consumer => :consumer,
94
90
  :ids => :ids,
95
- :created_date => :createdDate,
96
- :updated_date => :updatedDate,
91
+ :consumer => :consumer,
92
+ :entity_type => :entityType,
93
+ :start_date => :startDate,
94
+ :end_date => :endDate,
97
95
  :scope => :scope,
98
- :disabled => :disabled
96
+ :disabled => :disabled,
97
+ :created_date => :createdDate,
98
+ :updated_date => :updatedDate
99
99
 
100
100
  }
101
101
  end
@@ -2,42 +2,33 @@ module Attune
2
2
  module Model
3
3
  #
4
4
  #
5
- # @attr [String] entity_type
6
- # @attr [Array<String>] ids
7
- # @attr [Boolean] disabled
8
5
  # @attr [Array<Attune::Model::ScopeEntry>] scope
9
6
  # @attr [String] active_from
10
7
  # @attr [String] active_to
8
+ # @attr [String] entity_type
9
+ # @attr [Array<String>] ids
10
+ # @attr [Boolean] disabled
11
11
  class BlacklistParams
12
- attr_accessor :entity_type
12
+ attr_accessor :scope
13
13
 
14
14
 
15
- attr_accessor :ids
15
+ attr_accessor :active_from
16
16
 
17
17
 
18
- attr_accessor :disabled
18
+ attr_accessor :active_to
19
19
 
20
20
 
21
- attr_accessor :scope
21
+ attr_accessor :entity_type
22
22
 
23
23
 
24
- attr_accessor :active_from
24
+ attr_accessor :ids
25
25
 
26
26
 
27
- attr_accessor :active_to
27
+ attr_accessor :disabled
28
28
 
29
29
 
30
30
  def initialize(attributes = {})
31
31
  return if attributes.empty?
32
- # Workaround since JSON.parse has accessors as strings rather than symbols
33
- @entity_type = attributes["entityType"] || attributes[:"entity_type"]
34
- value = attributes["ids"] || attributes[:"ids"]
35
- if value.is_a?(Array)
36
- @ids = value
37
-
38
- end
39
- # Workaround since JSON.parse has accessors as strings rather than symbols
40
- @disabled = attributes["disabled"] || attributes[:"disabled"]
41
32
  value = attributes["scope"] || attributes[:"scope"]
42
33
  if value.is_a?(Array)
43
34
  @scope = value.map{ |v| ScopeEntry.new(v) }
@@ -47,6 +38,15 @@ module Attune
47
38
  @active_from = attributes["activeFrom"] || attributes[:"active_from"]
48
39
  # Workaround since JSON.parse has accessors as strings rather than symbols
49
40
  @active_to = attributes["activeTo"] || attributes[:"active_to"]
41
+ # Workaround since JSON.parse has accessors as strings rather than symbols
42
+ @entity_type = attributes["entityType"] || attributes[:"entity_type"]
43
+ value = attributes["ids"] || attributes[:"ids"]
44
+ if value.is_a?(Array)
45
+ @ids = value
46
+
47
+ end
48
+ # Workaround since JSON.parse has accessors as strings rather than symbols
49
+ @disabled = attributes["disabled"] || attributes[:"disabled"]
50
50
 
51
51
 
52
52
  end
@@ -65,12 +65,12 @@ module Attune
65
65
  private
66
66
  # :internal => :external
67
67
  ATTRIBUTE_MAP = {
68
- :entity_type => :entityType,
69
- :ids => :ids,
70
- :disabled => :disabled,
71
68
  :scope => :scope,
72
69
  :active_from => :activeFrom,
73
- :active_to => :activeTo
70
+ :active_to => :activeTo,
71
+ :entity_type => :entityType,
72
+ :ids => :ids,
73
+ :disabled => :disabled
74
74
 
75
75
  }
76
76
  end
@@ -3,35 +3,35 @@ 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 [Integer] status HTTP status code if ranking failed
7
6
  # @attr [String] cell Cell assignment
8
7
  # @attr [Array<String>] ranking List of ids in ranked order
8
+ # @attr [Integer] status HTTP status code if ranking failed
9
9
  class RankedEntities
10
10
  attr_accessor :message
11
11
 
12
12
 
13
- attr_accessor :status
14
-
15
-
16
13
  attr_accessor :cell
17
14
 
18
15
 
19
16
  attr_accessor :ranking
20
17
 
21
18
 
19
+ attr_accessor :status
20
+
21
+
22
22
  def initialize(attributes = {})
23
23
  return if attributes.empty?
24
24
  # Workaround since JSON.parse has accessors as strings rather than symbols
25
25
  @message = attributes["message"] || attributes[:"message"]
26
26
  # Workaround since JSON.parse has accessors as strings rather than symbols
27
- @status = attributes["status"] || attributes[:"status"]
28
- # Workaround since JSON.parse has accessors as strings rather than symbols
29
27
  @cell = attributes["cell"] || attributes[:"cell"]
30
28
  value = attributes["ranking"] || attributes[:"ranking"]
31
29
  if value.is_a?(Array)
32
30
  @ranking = value
33
31
 
34
32
  end
33
+ # Workaround since JSON.parse has accessors as strings rather than symbols
34
+ @status = attributes["status"] || attributes[:"status"]
35
35
 
36
36
 
37
37
  end
@@ -51,9 +51,9 @@ module Attune
51
51
  # :internal => :external
52
52
  ATTRIBUTE_MAP = {
53
53
  :message => :message,
54
- :status => :status,
55
54
  :cell => :cell,
56
- :ranking => :ranking
55
+ :ranking => :ranking,
56
+ :status => :status
57
57
 
58
58
  }
59
59
  end
@@ -2,72 +2,78 @@ module Attune
2
2
  module Model
3
3
  # Inputs for ranking a set of ids for a particular user.
4
4
  #
5
+ # @attr [String] user_agent
6
+ # @attr [String] ip
7
+ # @attr [Array<Attune::Model::ScopeEntry>] scope
5
8
  # @attr [String] anonymous
6
9
  # @attr [String] entity_type
7
10
  # @attr [Array<String>] ids
8
- # @attr [String] view
9
- # @attr [String] user_agent
10
- # @attr [Array<Attune::Model::ScopeEntry>] scope
11
- # @attr [String] ip
12
- # @attr [Array<Attune::Model::int>] quantities
13
11
  # @attr [String] customer
12
+ # @attr [Array<Attune::Model::int>] quantities
13
+ # @attr [String] application
14
+ # @attr [String] view
14
15
  class RankingParams
15
- attr_accessor :anonymous
16
+ attr_accessor :user_agent
16
17
 
17
18
 
18
- attr_accessor :entity_type
19
+ attr_accessor :ip
19
20
 
20
21
 
21
- attr_accessor :ids
22
+ attr_accessor :scope
22
23
 
23
24
 
24
- attr_accessor :view
25
+ attr_accessor :anonymous
25
26
 
26
27
 
27
- attr_accessor :user_agent
28
+ attr_accessor :entity_type
28
29
 
29
30
 
30
- attr_accessor :scope
31
+ attr_accessor :ids
31
32
 
32
33
 
33
- attr_accessor :ip
34
+ attr_accessor :customer
34
35
 
35
36
 
36
37
  attr_accessor :quantities
37
38
 
38
39
 
39
- attr_accessor :customer
40
+ attr_accessor :application
41
+
42
+
43
+ attr_accessor :view
40
44
 
41
45
 
42
46
  def initialize(attributes = {})
43
47
  return if attributes.empty?
44
48
  # Workaround since JSON.parse has accessors as strings rather than symbols
45
- @anonymous = attributes["anonymous"] || attributes[:"anonymous"]
49
+ @user_agent = attributes["userAgent"] || attributes[:"user_agent"]
46
50
  # Workaround since JSON.parse has accessors as strings rather than symbols
47
- @entity_type = attributes["entityType"] || attributes[:"entity_type"]
48
- value = attributes["ids"] || attributes[:"ids"]
51
+ @ip = attributes["ip"] || attributes[:"ip"]
52
+ value = attributes["scope"] || attributes[:"scope"]
49
53
  if value.is_a?(Array)
50
- @ids = value
54
+ @scope = value.map{ |v| ScopeEntry.new(v) }
51
55
 
52
56
  end
53
57
  # Workaround since JSON.parse has accessors as strings rather than symbols
54
- @view = attributes["view"] || attributes[:"view"]
58
+ @anonymous = attributes["anonymous"] || attributes[:"anonymous"]
55
59
  # Workaround since JSON.parse has accessors as strings rather than symbols
56
- @user_agent = attributes["userAgent"] || attributes[:"user_agent"]
57
- value = attributes["scope"] || attributes[:"scope"]
60
+ @entity_type = attributes["entityType"] || attributes[:"entity_type"]
61
+ value = attributes["ids"] || attributes[:"ids"]
58
62
  if value.is_a?(Array)
59
- @scope = value.map{ |v| ScopeEntry.new(v) }
63
+ @ids = value
60
64
 
61
65
  end
62
66
  # Workaround since JSON.parse has accessors as strings rather than symbols
63
- @ip = attributes["ip"] || attributes[:"ip"]
67
+ @customer = attributes["customer"] || attributes[:"customer"]
64
68
  value = attributes["quantities"] || attributes[:"quantities"]
65
69
  if value.is_a?(Array)
66
70
  @quantities = value
67
71
 
68
72
  end
69
73
  # Workaround since JSON.parse has accessors as strings rather than symbols
70
- @customer = attributes["customer"] || attributes[:"customer"]
74
+ @application = attributes["application"] || attributes[:"application"]
75
+ # Workaround since JSON.parse has accessors as strings rather than symbols
76
+ @view = attributes["view"] || attributes[:"view"]
71
77
 
72
78
 
73
79
  end
@@ -86,15 +92,16 @@ module Attune
86
92
  private
87
93
  # :internal => :external
88
94
  ATTRIBUTE_MAP = {
95
+ :user_agent => :userAgent,
96
+ :ip => :ip,
97
+ :scope => :scope,
89
98
  :anonymous => :anonymous,
90
99
  :entity_type => :entityType,
91
100
  :ids => :ids,
92
- :view => :view,
93
- :user_agent => :userAgent,
94
- :scope => :scope,
95
- :ip => :ip,
101
+ :customer => :customer,
96
102
  :quantities => :quantities,
97
- :customer => :customer
103
+ :application => :application,
104
+ :view => :view
98
105
 
99
106
  }
100
107
  end
@@ -1,4 +1,4 @@
1
1
  module Attune
2
- VERSION = "1.0.17"
2
+ VERSION = "1.0.18"
3
3
  end
4
4
 
@@ -38,10 +38,11 @@ describe "remote requests" do
38
38
  # anonymous_result = client.anonymous.create
39
39
  params = Attune::Model::RankingParams.new
40
40
  # params.anonymous = anonymous_result.id
41
- # params.anonymous = SecureRandom.uuid
41
+ params.anonymous = SecureRandom.uuid
42
42
  params.view = 'b/mens-pants'
43
43
  params.entity_type = 'products'
44
44
  params.ids = entities
45
+ params.application = 'myapp'
45
46
  @result = client.entities.get_rankings(params)
46
47
  end
47
48
  it "can get ranked entities" do
@@ -59,6 +60,7 @@ describe "remote requests" do
59
60
  params.view = 'b/mens-pants'
60
61
  params.entity_type = 'products'
61
62
  params.ids = entities
63
+ params.application = 'myapp'
62
64
  batch_request = Attune::Model::BatchRankingRequest.new
63
65
  batch_request.requests = [params]
64
66
  @results = client.entities.batch_get_rankings(batch_request)
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.17
4
+ version: 1.0.18
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-10-18 00:00:00.000000000 Z
12
+ date: 2015-02-06 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: faraday