atrium-ruby 0.3.1 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/atrium.rb +1 -0
- data/lib/atrium/challenge.rb +15 -0
- data/lib/atrium/member.rb +13 -9
- data/lib/atrium/paginate.rb +2 -2
- data/lib/atrium/version.rb +1 -1
- metadata +19 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 42caf39875be0fa993e181c51b3459db1c1d440e
|
4
|
+
data.tar.gz: 4918bb0cb78f99640a59d17582959d0bd20a914b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5572677570fdc3c930466f8ab46672ae2e36a022b2ec034a3d53d8b3db8a5faa6071ed2f3bf004c970eac49bae266e4de441d26c94cc86ac95c44145f21e5340
|
7
|
+
data.tar.gz: 65519bb471aae9b9613ac3a3b7d0bdddf9c7209b2093cdefdb4920cee4fcf72a5cefe8208d6d274836fe71eeafd39e427f6c5ac7b7d0cc77d5285527d4ea85bd
|
data/lib/atrium.rb
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
module Atrium
|
2
|
+
class Challenge
|
3
|
+
include ::ActiveAttr::Model
|
4
|
+
include ::ActiveAttr::Attributes
|
5
|
+
|
6
|
+
attribute :field_name
|
7
|
+
attribute :guid
|
8
|
+
attribute :label
|
9
|
+
attribute :type
|
10
|
+
attribute :image_data
|
11
|
+
attribute :options
|
12
|
+
attribute :member_guid
|
13
|
+
|
14
|
+
end
|
15
|
+
end
|
data/lib/atrium/member.rb
CHANGED
@@ -13,6 +13,7 @@ module Atrium
|
|
13
13
|
attribute :successfully_aggregated_at
|
14
14
|
attribute :user_guid
|
15
15
|
|
16
|
+
|
16
17
|
##
|
17
18
|
# CLASS METHODS
|
18
19
|
#
|
@@ -46,7 +47,7 @@ module Atrium
|
|
46
47
|
# INSTANCE METHODS
|
47
48
|
#
|
48
49
|
def accounts
|
49
|
-
endpoint = "users/#{self.user_guid}/members/#{self.guid}/accounts"
|
50
|
+
endpoint = "/users/#{self.user_guid}/members/#{self.guid}/accounts"
|
50
51
|
accounts_response = ::Atrium.client.make_request(:get, endpoint)
|
51
52
|
|
52
53
|
accounts_response["accounts"].map do |account|
|
@@ -55,7 +56,7 @@ module Atrium
|
|
55
56
|
end
|
56
57
|
|
57
58
|
def aggregate
|
58
|
-
endpoint = "users/#{self.user_guid}/members/#{self.guid}/aggregate"
|
59
|
+
endpoint = "/users/#{self.user_guid}/members/#{self.guid}/aggregate"
|
59
60
|
member_response = ::Atrium.client.make_request(:post, endpoint)
|
60
61
|
|
61
62
|
member_params = member_response["member"]
|
@@ -76,9 +77,12 @@ module Atrium
|
|
76
77
|
endpoint = "/users/#{self.user_guid}/members/#{self.guid}/challenges"
|
77
78
|
member_response = ::Atrium.client.make_request(:get, endpoint)
|
78
79
|
|
79
|
-
member_params = member_response["
|
80
|
-
|
81
|
-
|
80
|
+
member_params = member_response["challenges"]
|
81
|
+
challenges = member_params.map do |ch|
|
82
|
+
ch[:member_guid] = self.guid
|
83
|
+
::Atrium::Challenge.new(ch)
|
84
|
+
end
|
85
|
+
challenges
|
82
86
|
end
|
83
87
|
|
84
88
|
def delete
|
@@ -99,7 +103,7 @@ module Atrium
|
|
99
103
|
def resume(challenge_credentials)
|
100
104
|
endpoint = "/users/#{self.user_guid}/members/#{self.guid}/resume"
|
101
105
|
body = resume_params(challenge_credentials)
|
102
|
-
member_response = ::Atrium.client.make_request(:
|
106
|
+
member_response = ::Atrium.client.make_request(:put, endpoint, body)
|
103
107
|
|
104
108
|
member_params = member_response["member"]
|
105
109
|
self.assign_attributes(member_params)
|
@@ -117,7 +121,7 @@ module Atrium
|
|
117
121
|
end
|
118
122
|
|
119
123
|
def transactions
|
120
|
-
endpoint = "users/#{self.user_guid}/members/#{self.guid}/transactions"
|
124
|
+
endpoint = "/users/#{self.user_guid}/members/#{self.guid}/transactions"
|
121
125
|
transactions_response = ::Atrium.client.make_request(:get, endpoint)
|
122
126
|
|
123
127
|
transactions_response["transactions"].map do |transaction|
|
@@ -168,9 +172,9 @@ module Atrium
|
|
168
172
|
def resume_params(challenge_credentials)
|
169
173
|
{
|
170
174
|
:member => {
|
171
|
-
:
|
175
|
+
:challenges => challenge_credentials
|
172
176
|
}
|
173
177
|
}
|
174
178
|
end
|
175
179
|
end
|
176
|
-
end
|
180
|
+
end
|
data/lib/atrium/paginate.rb
CHANGED
@@ -9,9 +9,9 @@ module Atrium
|
|
9
9
|
|
10
10
|
def endpoint_name(query_params: nil)
|
11
11
|
@endpoint = if query_params.present?
|
12
|
-
|
12
|
+
"/" + klass_name + "?" + URI.encode_www_form(query_params) + "&"
|
13
13
|
else
|
14
|
-
klass_name + "?"
|
14
|
+
"/" + klass_name + "?"
|
15
15
|
end
|
16
16
|
end
|
17
17
|
|
data/lib/atrium/version.rb
CHANGED
metadata
CHANGED
@@ -1,94 +1,94 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: atrium-ruby
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jon Carstens, Dan Jones, Zach Toolson
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-06-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name: active_attr
|
15
14
|
requirement: !ruby/object:Gem::Requirement
|
16
15
|
requirements:
|
17
16
|
- - ">="
|
18
17
|
- !ruby/object:Gem::Version
|
19
18
|
version: '0'
|
20
|
-
|
19
|
+
name: active_attr
|
21
20
|
prerelease: false
|
21
|
+
type: :runtime
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name: httpclient
|
29
28
|
requirement: !ruby/object:Gem::Requirement
|
30
29
|
requirements:
|
31
30
|
- - ">="
|
32
31
|
- !ruby/object:Gem::Version
|
33
32
|
version: '0'
|
34
|
-
|
33
|
+
name: httpclient
|
35
34
|
prerelease: false
|
35
|
+
type: :runtime
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
|
-
name: bundler
|
43
42
|
requirement: !ruby/object:Gem::Requirement
|
44
43
|
requirements:
|
45
44
|
- - "~>"
|
46
45
|
- !ruby/object:Gem::Version
|
47
46
|
version: '1.12'
|
48
|
-
|
47
|
+
name: bundler
|
49
48
|
prerelease: false
|
49
|
+
type: :development
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '1.12'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
|
-
name: pry
|
57
56
|
requirement: !ruby/object:Gem::Requirement
|
58
57
|
requirements:
|
59
58
|
- - ">="
|
60
59
|
- !ruby/object:Gem::Version
|
61
60
|
version: '0'
|
62
|
-
|
61
|
+
name: pry
|
63
62
|
prerelease: false
|
63
|
+
type: :development
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - ">="
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name: rake
|
71
70
|
requirement: !ruby/object:Gem::Requirement
|
72
71
|
requirements:
|
73
72
|
- - "~>"
|
74
73
|
- !ruby/object:Gem::Version
|
75
74
|
version: '10.0'
|
76
|
-
|
75
|
+
name: rake
|
77
76
|
prerelease: false
|
77
|
+
type: :development
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '10.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
|
-
name: rspec
|
85
84
|
requirement: !ruby/object:Gem::Requirement
|
86
85
|
requirements:
|
87
86
|
- - ">="
|
88
87
|
- !ruby/object:Gem::Version
|
89
88
|
version: '0'
|
90
|
-
|
89
|
+
name: rspec
|
91
90
|
prerelease: false
|
91
|
+
type: :development
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - ">="
|
@@ -111,6 +111,7 @@ files:
|
|
111
111
|
- bin/setup
|
112
112
|
- lib/atrium.rb
|
113
113
|
- lib/atrium/account.rb
|
114
|
+
- lib/atrium/challenge.rb
|
114
115
|
- lib/atrium/client.rb
|
115
116
|
- lib/atrium/credential.rb
|
116
117
|
- lib/atrium/error.rb
|
@@ -125,7 +126,7 @@ homepage: http://github.com/mxenabled/atrium-ruby
|
|
125
126
|
licenses:
|
126
127
|
- MIT
|
127
128
|
metadata: {}
|
128
|
-
post_install_message:
|
129
|
+
post_install_message:
|
129
130
|
rdoc_options: []
|
130
131
|
require_paths:
|
131
132
|
- lib
|
@@ -140,9 +141,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
140
141
|
- !ruby/object:Gem::Version
|
141
142
|
version: '0'
|
142
143
|
requirements: []
|
143
|
-
rubyforge_project:
|
144
|
+
rubyforge_project:
|
144
145
|
rubygems_version: 2.6.8
|
145
|
-
signing_key:
|
146
|
+
signing_key:
|
146
147
|
specification_version: 4
|
147
148
|
summary: Ruby wrapper for the Atrium API by MX
|
148
149
|
test_files: []
|