access 2.0.43 → 2.0.44
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 +1 -1
- data/lib/access.rb +1 -0
- data/lib/access/member.rb +4 -1
- data/lib/access/organization.rb +12 -0
- data/lib/access/request.rb +7 -7
- data/lib/access/response.rb +4 -1
- data/lib/access/version.rb +1 -1
- data/test/access/campaign_test.rb +0 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: aa314bee14dfeaec11d67ee2197270aa85d50065
|
4
|
+
data.tar.gz: 4da809cd4aa445c8458724d4b3dc333f83fd3aba
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0f74fb119fbe129152bbde7ef8e38781a70d6b3f91af44091b521ffa8ba497440853588b3bdf0e2d9dfdcbdb233afc38bc5766ddbe548418e742aaf657e67d0b
|
7
|
+
data.tar.gz: f5f4c56917b6ff3b12cc7d3977796302ec7e882947306434ad4838b1117c7663993f77883ffd31cd0c353a4364e54dd9eed9d55ea21d17bef48b25493214374c
|
data/Gemfile.lock
CHANGED
data/lib/access.rb
CHANGED
data/lib/access/member.rb
CHANGED
@@ -6,10 +6,13 @@ module Access
|
|
6
6
|
end
|
7
7
|
|
8
8
|
def initialize(values)
|
9
|
-
self.class.class_eval {attr_reader *values.keys }
|
9
|
+
self.class.class_eval {attr_reader *values.keys + [:user] }
|
10
10
|
values.each do |attribute_name, attribute_value|
|
11
11
|
self.instance_variable_set("@#{attribute_name}", attribute_value)
|
12
12
|
end
|
13
|
+
@user = @user ? Access::User.new(@user) : nil
|
14
|
+
@program = Access::Program.new(@program) if @program
|
15
|
+
@organization = Access::Organization.new(@organization) if @organization
|
13
16
|
end
|
14
17
|
|
15
18
|
def self.show(member_key, options = {})
|
@@ -0,0 +1,12 @@
|
|
1
|
+
module Access
|
2
|
+
class Organization
|
3
|
+
|
4
|
+
def initialize(values)
|
5
|
+
self.class.class_eval {attr_reader *values.keys }
|
6
|
+
values.each do |attribute_name, attribute_value|
|
7
|
+
self.instance_variable_set("@#{attribute_name}", attribute_value)
|
8
|
+
end
|
9
|
+
end
|
10
|
+
|
11
|
+
end
|
12
|
+
end
|
data/lib/access/request.rb
CHANGED
@@ -2,14 +2,14 @@ module Access
|
|
2
2
|
class Request
|
3
3
|
include HTTParty
|
4
4
|
|
5
|
-
attr_reader :url, :headers, :timeout, :return_json, :
|
5
|
+
attr_reader :url, :headers, :timeout, :return_json, :use_hashify
|
6
6
|
|
7
7
|
def base_setup(path, api_type, options)
|
8
8
|
@url = set_base(path, api_type, options.delete(:api_environment))
|
9
9
|
@headers = set_headers options.delete(:access_token)
|
10
10
|
@timeout = options.delete(:access_timeout) || Access.config.access_timeout
|
11
11
|
@return_json = should_return_json?(options.delete(:return_json))
|
12
|
-
@
|
12
|
+
@use_hashify = hashify_results?(options.delete(:hashify))
|
13
13
|
@debug_output = options.delete(:access_debug_output) || Access.config.access_debug_output
|
14
14
|
end
|
15
15
|
|
@@ -17,7 +17,7 @@ module Access
|
|
17
17
|
base_setup(path, api_type, options)
|
18
18
|
results = self.class.get(url, headers: headers, query: options, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
|
19
19
|
if return_json
|
20
|
-
|
20
|
+
use_hashify ? results.hashify : results
|
21
21
|
else
|
22
22
|
block.call results
|
23
23
|
end
|
@@ -31,7 +31,7 @@ module Access
|
|
31
31
|
base_setup(path, api_type, options)
|
32
32
|
results = self.class.put(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
|
33
33
|
if return_json
|
34
|
-
|
34
|
+
use_hashify ? results.hashify : results
|
35
35
|
else
|
36
36
|
block.call results
|
37
37
|
end
|
@@ -45,7 +45,7 @@ module Access
|
|
45
45
|
base_setup(path, api_type, options)
|
46
46
|
results = self.class.post(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
|
47
47
|
if return_json
|
48
|
-
|
48
|
+
use_hashify ? results.hashify : results
|
49
49
|
else
|
50
50
|
block.call results
|
51
51
|
end
|
@@ -59,7 +59,7 @@ module Access
|
|
59
59
|
base_setup(path, api_type, options)
|
60
60
|
results = self.class.delete(url, headers: headers, body: options.to_json, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
|
61
61
|
if return_json
|
62
|
-
|
62
|
+
use_hashify ? results.hashify : results
|
63
63
|
else
|
64
64
|
block.call results
|
65
65
|
end
|
@@ -73,7 +73,7 @@ module Access
|
|
73
73
|
base_setup(path, api_type, options)
|
74
74
|
results = self.class.post(url, headers: headers, body: filter, timeout: timeout, debug_output: (@debug_output == 'true' ? $stdout : nil))
|
75
75
|
if return_json
|
76
|
-
|
76
|
+
use_hashify ? results.hashify : results
|
77
77
|
else
|
78
78
|
block.call results
|
79
79
|
end
|
data/lib/access/response.rb
CHANGED
@@ -139,7 +139,10 @@ module Access
|
|
139
139
|
|
140
140
|
class UserResponse < Response
|
141
141
|
def process_data
|
142
|
-
|
142
|
+
if @members
|
143
|
+
@members = Access::Member.process_batch(@members)
|
144
|
+
@users = @members.map {|x| x if x.user }.compact
|
145
|
+
end
|
143
146
|
end
|
144
147
|
end
|
145
148
|
|
data/lib/access/version.rb
CHANGED
@@ -37,7 +37,6 @@ class CampaignTest < Minitest::Test
|
|
37
37
|
base_attributes.each do |att|
|
38
38
|
assert campaigns_response.respond_to?(att), "#{att} not found"
|
39
39
|
end
|
40
|
-
binding.pry
|
41
40
|
assert_kind_of Array, campaigns_response.spot_list
|
42
41
|
assert_kind_of Access::Spot, campaigns_response.spot_list.first
|
43
42
|
assert_kind_of Access::Link, campaigns_response.spot_list.first.links.first
|
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.
|
4
|
+
version: 2.0.44
|
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-01
|
13
|
+
date: 2016-02-01 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: bundler
|
@@ -237,6 +237,7 @@ files:
|
|
237
237
|
- lib/access/member.rb
|
238
238
|
- lib/access/oauth_application.rb
|
239
239
|
- lib/access/offer.rb
|
240
|
+
- lib/access/organization.rb
|
240
241
|
- lib/access/program.rb
|
241
242
|
- lib/access/redeem.rb
|
242
243
|
- lib/access/redemption.rb
|