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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4243cfb5d7f06f20b0d44efe0afba6dffc59d16bc3fe916397f00c57d53b1bc9
4
- data.tar.gz: 29d670ec373e52e519d94360fe28e6aa03031490dc9ec10c294979946a25d9d4
3
+ metadata.gz: 2f535aaa746912a01d3714e68d52d4e2b9e3e03fce7ca98b1108317248d77874
4
+ data.tar.gz: 8b084642a6c2e7b9a6945cfd78456bca341a1dffa9296a9fa0d639734f7ddcc1
5
5
  SHA512:
6
- metadata.gz: f1dca620b3e1c7e3d94d9c58d52a4e27d57136c7b39eb7fc0b31335757f2bebedb79acf1f67d9904622d8ba7552c74ec470b967e1a5e007a97012dc2f6df5891
7
- data.tar.gz: 23ce321d1ace5e48695e06ee960096f193b2ebe5df1a8666897820f4048cf75743dab9877508a775d35a956c1fc03f6b5282ce2cd0ad612cd6f8a79743678122
6
+ metadata.gz: b327dfe66b6c4956a52379bb14807f6ee8e22abb31e1356fe38933fbfe838e6a880903b9b19b9c6b404d2a98a573421f956bb43e7b9cbb1715d90d6b94fc7dd5
7
+ data.tar.gz: 3291060a8867a139dd17cbcd0be4c129ffcaa67cce2b318cdacc86dc23c13feed48992d67ff41c23255813c476075315daebc00566c489e2ff7683d9d5001859
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- daru-apiclient (0.0.1)
4
+ daru-apiclient (0.0.2)
5
5
  daru
6
6
  httparty
7
7
 
@@ -1,23 +1,47 @@
1
1
  require 'httparty'
2
2
  require 'daru'
3
- require "daru/apiclient/version"
3
+ require 'daru/apiclient/version'
4
4
 
5
5
  module Daru
6
- class APIClient
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
- end
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
@@ -1,5 +1,5 @@
1
1
  module Daru
2
2
  class APIClient
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
4
4
  end
5
5
  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.1
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-01-30 00:00:00.000000000 Z
11
+ date: 2019-02-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: daru