wes-data-api 1.7.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wes/data/api/user.rb +42 -40
- data/lib/wes/data/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ce69c6c00f48474db5b1f3701ce160cbdd5272bb
|
4
|
+
data.tar.gz: 1f8b5363e01e94be41c15d620103a2e884f87a0d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 23d59de2b08b9024de438cd4f94cdd8f40582102542e0887661bee06395bb333df001bb0a4b2f6217467c38bef3f54e002ff4e50ff71d0de4cc83ff86a93d878
|
7
|
+
data.tar.gz: 94b70c47e1a653ba642f3814a6bd5d7bc590593ede28076adb0da49455e6a1cfad2d0522d8d37f9e4c89b3a7ca2c1a36c8d284f7a892db1e6618a15b44cf5d89
|
data/lib/wes/data/api/user.rb
CHANGED
@@ -5,74 +5,76 @@ module Wes
|
|
5
5
|
module Data
|
6
6
|
module API
|
7
7
|
class User
|
8
|
-
|
9
|
-
|
8
|
+
attr_reader :attributes
|
9
|
+
|
10
|
+
def initialize(attributes)
|
11
|
+
@attributes = attributes
|
10
12
|
end
|
11
13
|
|
12
|
-
|
13
|
-
|
14
|
+
class << self
|
15
|
+
def client
|
16
|
+
Client.new
|
17
|
+
end
|
18
|
+
|
19
|
+
def configuration
|
20
|
+
Configuration
|
21
|
+
end
|
22
|
+
|
23
|
+
def create(id)
|
24
|
+
attributes = client.post("#{routes.user}/#{id}", {}).first
|
25
|
+
new(attributes)
|
26
|
+
end
|
27
|
+
|
28
|
+
def find(key, value)
|
29
|
+
attrs = key == :id ? client.get("#{routes.user}/#{value}")
|
30
|
+
: client.get("#{routes.user}?#{key}=#{value}")
|
31
|
+
new(attrs.first)
|
32
|
+
end
|
33
|
+
|
34
|
+
def routes
|
35
|
+
configuration.routes
|
36
|
+
end
|
14
37
|
end
|
15
38
|
|
16
39
|
def closed_submissions
|
17
|
-
check_for_id!
|
18
40
|
client.get "#{routes.user}/#{id}#{routes.submissions}/closed"
|
19
41
|
end
|
20
42
|
|
21
|
-
def
|
22
|
-
|
23
|
-
client.post("#{routes.user}/#{id}#{routes.metadata}", {})
|
24
|
-
end
|
25
|
-
|
26
|
-
def find_by_attribute(key, value)
|
27
|
-
client.get("#{routes.user}#{routes.metadata}?#{key}=#{value}")
|
28
|
-
end
|
29
|
-
|
30
|
-
def metadata
|
31
|
-
check_for_id!
|
32
|
-
client.get "#{routes.user}/#{id}#{routes.metadata}"
|
43
|
+
def method_missing(method_sym)
|
44
|
+
attributes.send method_sym
|
33
45
|
end
|
34
46
|
|
35
47
|
def open_submissions
|
36
|
-
|
37
|
-
client.get "#{routes.user}/#{id}#{routes.submissions}/open"
|
48
|
+
client.get("#{routes.user}/#{id}#{routes.submissions}/open")
|
38
49
|
end
|
39
50
|
|
40
51
|
def submissions
|
41
|
-
|
42
|
-
client.get "#{routes.user}/#{id}#{routes.submissions}"
|
52
|
+
client.get("#{routes.user}/#{id}#{routes.submissions}")
|
43
53
|
end
|
44
54
|
|
45
|
-
def
|
46
|
-
|
47
|
-
client.put(
|
48
|
-
"#{routes.user}/#{id}#{routes.metadata}",
|
49
|
-
metadata.first.to_h.merge(new_metadata)
|
50
|
-
).first
|
55
|
+
def videos
|
56
|
+
client.get("#{routes.user}/#{id}#{routes.videos}")
|
51
57
|
end
|
52
58
|
|
53
|
-
def
|
54
|
-
|
55
|
-
|
59
|
+
def update(changes)
|
60
|
+
@attributes = client.put(
|
61
|
+
"#{routes.user}/#{id}",
|
62
|
+
@attributes.to_h.merge(changes)
|
63
|
+
).first
|
56
64
|
end
|
57
65
|
|
58
66
|
private
|
59
67
|
|
60
|
-
attr_reader :id
|
61
|
-
|
62
|
-
def check_for_id!
|
63
|
-
raise(ArgumentError, "ID not set for User") if id.nil?
|
64
|
-
end
|
65
|
-
|
66
68
|
def client
|
67
|
-
|
69
|
+
self.class.client
|
68
70
|
end
|
69
71
|
|
70
|
-
def
|
71
|
-
|
72
|
+
def id
|
73
|
+
attributes.auth0_id
|
72
74
|
end
|
73
75
|
|
74
76
|
def routes
|
75
|
-
|
77
|
+
self.class.routes
|
76
78
|
end
|
77
79
|
end
|
78
80
|
end
|
data/lib/wes/data/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wes-data-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- ''
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-04-
|
11
|
+
date: 2016-04-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|