access 2.0.49 → 2.0.50

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: 28c658968f7aed7074f50c1f9712b07be7d94373
4
- data.tar.gz: 0850ae0bcda8af6d01dc9f5e85fe1dede1e4c2fb
3
+ metadata.gz: c5ed08475fdadb16bdbc54e45dc6db7d058a0713
4
+ data.tar.gz: 1bb3b424c3ddae0bbc7849ec3927163221c126e8
5
5
  SHA512:
6
- metadata.gz: 21ae743167223044c25ab811350f3f386c038582ecebf8d9acf618d4edd7b7ca0c8f4d66b2804290c708a3bb93aa5bb30bc51085e38bda460ec2d24217f4ddbb
7
- data.tar.gz: dc959528e17003912c40d423b55d97668657526a307624aefeec5dc374b95d91f1a2173d54cd605dd1348272602d4a8bce57590a1fabb29ee7f8d3335c579df7
6
+ metadata.gz: 04324e402c211bc154da26835c956885d8aebdbfbed2adb65eafcc863621e371b69ad5fd63ff6824759dfd383c1e02692aa248af9ce6a1e7287a3a3cf000be5e
7
+ data.tar.gz: 77599fd81319634e36b2b8f99e2fc36b07a8b950f570922e3ad1a9722f0de65f64fae3bcf7cd034ef2761841ad75450f62c2b92b6de7ebe1819c9f13be6f23e0
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- access (2.0.49)
4
+ access (2.0.50)
5
5
  hashie (~> 3.3.1)
6
6
  httparty (~> 0.13.3)
7
7
 
@@ -14,7 +14,7 @@ module Access
14
14
 
15
15
  class Config
16
16
  DOMAINS = {'production' => '', 'demo' => '-demo', 'stage' => '-stage', 'staging' => '-stage', 'development' => '' }
17
- attr_accessor :access_token, :api_environment, :return_json, :hashify, :access_timeout, :access_debug_output
17
+ attr_accessor :access_token, :api_environment, :return_json, :hashify, :access_timeout, :access_debug_output, :used_fields
18
18
 
19
19
  def initialize
20
20
  @access_token = ENV['ACCESS_TOKEN']
@@ -28,6 +28,7 @@ module Access
28
28
  @access_timeout = ENV['ACCESS_TIMEOUT'] || '10'
29
29
  # Set to 'true' to see the raw output of the httparty call
30
30
  @access_debug_output = ENV['ACCESS_DEBUG_OUTPUT'] || 'false'
31
+ @used_fields = ENV['USED_FIELDS'] || 'false'
31
32
  end
32
33
 
33
34
  def reset
@@ -38,6 +39,7 @@ module Access
38
39
  self.hashify = ENV['ACCESS_HASHIFY'] || 'false'
39
40
  self.access_timeout = ENV['ACCESS_TIMEOUT'] || '10'
40
41
  self.access_debug_output = ENV['ACCESS_DEBUG_OUTPUT'] || 'false'
42
+ self.used_fields = ENV['USED_FIELDS'] || 'false'
41
43
  end
42
44
  end
43
45
 
@@ -1,6 +1,6 @@
1
1
  module Access
2
2
  class Offer
3
- attr_reader :store, :location
3
+ attr_reader :store, :location, :used_fields
4
4
 
5
5
  def self.search(options = {})
6
6
  Access::Api.new.search_offers options
@@ -19,7 +19,20 @@ module Access
19
19
  end
20
20
 
21
21
  def initialize(values)
22
- self.class.class_eval { attr_reader *values.keys }
22
+ unless Access.config.used_fields == 'true'
23
+ self.class.class_eval { attr_reader *values.keys }
24
+ else
25
+ self.class.class_eval do
26
+ values.keys.each do |k|
27
+ define_method(k.to_sym) do
28
+ @used_fields ||= []
29
+ @used_fields << k.to_sym
30
+ instance_variable_get("@#{k.to_sym}")
31
+ end
32
+ end
33
+ end
34
+ end
35
+
23
36
  values.each do |attribute_name, attribute_value|
24
37
  self.instance_variable_set("@#{attribute_name}", attribute_value)
25
38
  end
@@ -57,6 +57,10 @@ module Access
57
57
  @offer_count_by_facet = Access::Aggregations.process_batch(@offer_count_by_facet) if @offer_count_by_facet
58
58
  @custom_aggregation = Access::Aggregations.process_batch(@custom_aggregation) if @custom_aggregation
59
59
  end
60
+
61
+ def used_fields
62
+ offers.flat_map(&:used_fields).compact.uniq
63
+ end
60
64
  end
61
65
 
62
66
  class StoreResponse < Response
@@ -1,4 +1,4 @@
1
1
  module Access
2
- VERSION = "2.0.49"
2
+ VERSION = "2.0.50"
3
3
  end
4
4
 
@@ -112,7 +112,7 @@ class UserTest < Minitest::Test
112
112
  first_name: 'RubyGem',
113
113
  last_name: 'Test',
114
114
  postal_code: 84047,
115
- email: "rubygemtest-#{SecureRandom.hex(4)}@accessdevelopment.com",
115
+ email: "rubygemtest-6@accessdevelopment.com",
116
116
  password: 'test1234',
117
117
  shared_secret: 'thanks',
118
118
  program_url: "saversclub.accessdevelopment.com",
@@ -98,4 +98,53 @@ http_interactions:
98
98
  Perks Demo","provisioning_method":"SHARED_SECRET"},"member":{"member_id":93256795,"member_key":"227061","email":"rubygemtest-c8f922c4@accessdevelopment.com","first_name":"RubyGem","last_name":"Test","cvt":"25cb61a228db3db62a0cb6cd740accc5762d3e99","postal_code":"84047"},"user":{"email":"rubygemtest-c8f922c4@accessdevelopment.com","first_name":"RubyGem","last_name":"Test","reg_id":1298125,"roles":[],"has_password":true,"password_expired":false}}]}'
99
99
  http_version:
100
100
  recorded_at: Tue, 23 Feb 2016 17:55:36 GMT
101
+ - request:
102
+ method: post
103
+ uri: https://mms-stage.adcrws.com/v1/register
104
+ body:
105
+ encoding: UTF-8
106
+ string: '{"program_id":2412,"first_name":"RubyGem","last_name":"Test","postal_code":84047,"email":"rubygemtest-6@accessdevelopment.com","password":"test1234","shared_secret":"thanks","program_url":"saversclub.accessdevelopment.com"}'
107
+ headers:
108
+ Access-Token:
109
+ - "<ACCESS_TOKEN>"
110
+ Content-Type:
111
+ - application/json
112
+ Accept:
113
+ - application/json
114
+ response:
115
+ status:
116
+ code: 200
117
+ message: OK
118
+ headers:
119
+ Server:
120
+ - Apache-Coyote/1.1
121
+ X-Content-Type-Options:
122
+ - nosniff
123
+ X-Xss-Protection:
124
+ - 1; mode=block
125
+ Cache-Control:
126
+ - no-cache, no-store, max-age=0, must-revalidate
127
+ Pragma:
128
+ - no-cache
129
+ Expires:
130
+ - '0'
131
+ X-Frame-Options:
132
+ - DENY
133
+ X-Application-Context:
134
+ - application:main,stage:10120
135
+ Content-Type:
136
+ - application/json;charset=UTF-8
137
+ Transfer-Encoding:
138
+ - chunked
139
+ Date:
140
+ - Tue, 23 Feb 2016 18:10:07 GMT
141
+ body:
142
+ encoding: UTF-8
143
+ string: '{"users":[{"program_id":2412,"program_key":"TYP123","program_name":"Access
144
+ Perks Demo","organization_id":2000896,"organization_key":"TYPDEMO","organization_name":"Access
145
+ Perks Demo","member_id":93256796,"member_key":"227062","email":"rubygemtest-6@accessdevelopment.com","first_name":"RubyGem","last_name":"Test","reg_id":1298126,"cvt":"bfabd2645fb429561bf3aabc3c091b12d904c025","postal_code":"84047","roles":[],"program_provisioning_method":"SHARED_SECRET","user_has_password":true}],"members":[{"organization":{"organization_id":2000896,"organization_key":"TYPDEMO","name":"Access
146
+ Perks Demo"},"program":{"program_id":2412,"program_key":"TYP123","name":"Access
147
+ Perks Demo","provisioning_method":"SHARED_SECRET"},"member":{"member_id":93256796,"member_key":"227062","email":"rubygemtest-6@accessdevelopment.com","first_name":"RubyGem","last_name":"Test","cvt":"bfabd2645fb429561bf3aabc3c091b12d904c025","postal_code":"84047"},"user":{"email":"rubygemtest-6@accessdevelopment.com","first_name":"RubyGem","last_name":"Test","reg_id":1298126,"roles":[],"has_password":true,"password_expired":false}}]}'
148
+ http_version:
149
+ recorded_at: Tue, 23 Feb 2016 18:10:07 GMT
101
150
  recorded_with: VCR 3.0.1
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: access
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.0.49
4
+ version: 2.0.50
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Eggett
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2016-02-23 00:00:00.000000000 Z
13
+ date: 2016-04-19 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: bundler