daru-apiclient 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/daru/apiclient.rb +31 -7
- data/lib/daru/apiclient/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2f535aaa746912a01d3714e68d52d4e2b9e3e03fce7ca98b1108317248d77874
|
4
|
+
data.tar.gz: 8b084642a6c2e7b9a6945cfd78456bca341a1dffa9296a9fa0d639734f7ddcc1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b327dfe66b6c4956a52379bb14807f6ee8e22abb31e1356fe38933fbfe838e6a880903b9b19b9c6b404d2a98a573421f956bb43e7b9cbb1715d90d6b94fc7dd5
|
7
|
+
data.tar.gz: 3291060a8867a139dd17cbcd0be4c129ffcaa67cce2b318cdacc86dc23c13feed48992d67ff41c23255813c476075315daebc00566c489e2ff7683d9d5001859
|
data/Gemfile.lock
CHANGED
data/lib/daru/apiclient.rb
CHANGED
@@ -1,23 +1,47 @@
|
|
1
1
|
require 'httparty'
|
2
2
|
require 'daru'
|
3
|
-
require
|
3
|
+
require 'daru/apiclient/version'
|
4
4
|
|
5
5
|
module Daru
|
6
|
-
class
|
6
|
+
class APIClientTemplate
|
7
7
|
include HTTParty
|
8
8
|
|
9
|
-
def initialize(uri)
|
10
|
-
self.class.base_uri uri
|
11
|
-
end
|
12
|
-
|
13
9
|
def get(*args)
|
14
10
|
response = self.class.get(*args)
|
15
11
|
Daru::DataFrame.new(response.to_a)
|
16
|
-
|
12
|
+
end
|
17
13
|
|
18
14
|
def post(*args)
|
19
15
|
response = self.class.post(*args)
|
20
16
|
Daru::DataFrame.new(response.to_a)
|
21
17
|
end
|
22
18
|
end
|
19
|
+
|
20
|
+
class APIClient
|
21
|
+
def initialize(uri)
|
22
|
+
client_class = Class.new(Daru::APIClientTemplate)
|
23
|
+
client_class.base_uri uri
|
24
|
+
@c = client_class.new
|
25
|
+
end
|
26
|
+
|
27
|
+
def get(*args)
|
28
|
+
@c.get(*args)
|
29
|
+
end
|
30
|
+
|
31
|
+
def post(*args)
|
32
|
+
@c.post(*args)
|
33
|
+
end
|
34
|
+
|
35
|
+
def hget(*args)
|
36
|
+
@c.class.get(*args).to_h
|
37
|
+
end
|
38
|
+
|
39
|
+
def hpost(*args)
|
40
|
+
@c.class.post(*args).to_h
|
41
|
+
end
|
42
|
+
|
43
|
+
def c
|
44
|
+
@c.class
|
45
|
+
end
|
46
|
+
end
|
23
47
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: daru-apiclient
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- kojix2
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-02-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: daru
|