ddr-aux-client 1.0.0 → 1.1.0
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/lib/ddr_aux/client/api.rb +34 -18
- data/lib/ddr_aux/client/api/admin_set.rb +9 -0
- data/lib/ddr_aux/client/api/license.rb +9 -0
- data/lib/ddr_aux/client/api/model.rb +26 -0
- data/lib/ddr_aux/client/version.rb +1 -1
- metadata +5 -5
- data/lib/ddr_aux/client/api/find_license.rb +0 -10
- data/lib/ddr_aux/client/api/get_license.rb +0 -9
- data/lib/ddr_aux/client/api/get_licenses.rb +0 -9
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8f9c3cc6c1e5f15ab0e067460e227071a3493f11
|
4
|
+
data.tar.gz: ecf92af2bfd5010f4bd33295c661996f3732f7a7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f8fb113dd55fbb8fa53471e6fa006dc57424e9700e08319a5a6aaa8ab3377bcc126545d33014df45c349c946f6ea1209b07c1651339105ae1c0ec8c974eff036
|
7
|
+
data.tar.gz: b1d6a84bffb0d269b82ba086aac61e1d33deecd0b0e3c38d366d6077cf067175703ed2d6dbf4518959a2735c7e7997702426f4eb602bad2e5f1db84f421bf3fb
|
data/lib/ddr_aux/client/api.rb
CHANGED
@@ -1,28 +1,44 @@
|
|
1
|
+
require "uri"
|
2
|
+
require_relative "api/model"
|
3
|
+
require_relative "api/license"
|
4
|
+
require_relative "api/admin_set"
|
5
|
+
|
1
6
|
module DdrAux::Client
|
2
7
|
module Api
|
3
8
|
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
+
MODELS = {
|
10
|
+
license: License,
|
11
|
+
admin_set: AdminSet,
|
12
|
+
}.freeze
|
13
|
+
|
14
|
+
MODELS.each do |key, klass|
|
15
|
+
# get_license(id) => License.get(id)
|
16
|
+
define_method "get_#{key}" do |id|
|
17
|
+
klass.get(id)
|
9
18
|
end
|
10
|
-
end
|
11
19
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
20
|
+
# get_licenses => License.list
|
21
|
+
# licenses => License.list
|
22
|
+
define_method "get_#{key}s" do
|
23
|
+
klass.list
|
24
|
+
end
|
25
|
+
alias_method "#{key}s", "get_#{key}s"
|
16
26
|
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
alias_method :licenses, :get_licenses
|
27
|
+
# find_license(**args) => License.find(**args)
|
28
|
+
define_method "find_#{key}" do |args|
|
29
|
+
klass.find **args
|
30
|
+
end
|
22
31
|
|
23
|
-
|
24
|
-
|
25
|
-
|
32
|
+
# license(arg)
|
33
|
+
# => find_license(**(arg.to_h))
|
34
|
+
# => get_license(arg)
|
35
|
+
define_method key do |arg|
|
36
|
+
if arg.respond_to?(:to_h)
|
37
|
+
send "find_#{key}", **(arg.to_h)
|
38
|
+
else
|
39
|
+
send "get_#{key}", arg
|
40
|
+
end
|
41
|
+
end
|
26
42
|
end
|
27
43
|
|
28
44
|
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
require "uri"
|
2
|
+
|
3
|
+
module DdrAux::Client
|
4
|
+
module Api
|
5
|
+
class Model
|
6
|
+
|
7
|
+
class << self
|
8
|
+
attr_accessor :path
|
9
|
+
|
10
|
+
def get(id)
|
11
|
+
Connection.call [path, id].join("/")
|
12
|
+
end
|
13
|
+
|
14
|
+
def list
|
15
|
+
Connection.call path
|
16
|
+
end
|
17
|
+
alias_method :all, :list
|
18
|
+
|
19
|
+
def find(**args)
|
20
|
+
Connection.call "#{path}/find?%s" % URI.encode_www_form(args)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ddr-aux-client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Chandek-Stark
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-09-
|
11
|
+
date: 2015-09-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -85,9 +85,9 @@ files:
|
|
85
85
|
- ddr-aux-client.gemspec
|
86
86
|
- lib/ddr_aux/client.rb
|
87
87
|
- lib/ddr_aux/client/api.rb
|
88
|
-
- lib/ddr_aux/client/api/
|
89
|
-
- lib/ddr_aux/client/api/
|
90
|
-
- lib/ddr_aux/client/api/
|
88
|
+
- lib/ddr_aux/client/api/admin_set.rb
|
89
|
+
- lib/ddr_aux/client/api/license.rb
|
90
|
+
- lib/ddr_aux/client/api/model.rb
|
91
91
|
- lib/ddr_aux/client/connection.rb
|
92
92
|
- lib/ddr_aux/client/version.rb
|
93
93
|
homepage: https://github.com/duke-libraries/ddr-aux-client
|