doge_api 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/lib/doge_api.rb +19 -17
- data/lib/doge_chain.rb +24 -0
- data/main.rb +2 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ab027d6d7738cf745138b714f1dda0bbe23371d3
|
4
|
+
data.tar.gz: 018a4d9035946d2880a97c1f6dd4e8b942a36e3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2e306fcd9fbaa7ef17b8d611445d8ad2da23f7ce2612e1b8415917be50562e38d0d78565c48489b570f28bf6fafdae46a0741fd8c148bac10ae0739b16529982
|
7
|
+
data.tar.gz: 7372cc4fce05e06fb61dab46c634dbc82f9570ce789892ec6b6c2bfa1022d67bd2e1d75a33158990e8efea2960565d3feb1e1f912d91f316b94d7a4c5b0c27e4
|
data/lib/doge_api.rb
CHANGED
@@ -1,26 +1,28 @@
|
|
1
1
|
require 'uri'
|
2
2
|
require 'open-uri'
|
3
3
|
|
4
|
-
|
5
|
-
|
4
|
+
module DogeApi
|
5
|
+
class DogeApi
|
6
|
+
attr_accessor :api_key
|
6
7
|
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
8
|
+
def initialize(api_key)
|
9
|
+
@api_key = api_key
|
10
|
+
@base_uri = URI.parse('https://www.dogeapi.com/wow')
|
11
|
+
end
|
11
12
|
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
def build_uri(m, args)
|
14
|
+
uri = @base_uri
|
15
|
+
params = args.merge(:a => m, :api_key => @api_key)
|
16
|
+
uri.query = URI.encode_www_form(params)
|
17
|
+
uri
|
18
|
+
end
|
18
19
|
|
19
|
-
|
20
|
-
|
21
|
-
|
20
|
+
def fetch_uri(uri)
|
21
|
+
uri.open.read
|
22
|
+
end
|
22
23
|
|
23
|
-
|
24
|
-
|
24
|
+
def method_missing(m, args = {}, &block)
|
25
|
+
fetch_uri build_uri(m, args)
|
26
|
+
end
|
25
27
|
end
|
26
28
|
end
|
data/lib/doge_chain.rb
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
require 'uri'
|
2
|
+
require 'open-uri'
|
3
|
+
|
4
|
+
module DogeApi
|
5
|
+
class DogeChain
|
6
|
+
def initialize
|
7
|
+
@base_uri = 'http://dogechain.info/chain/Dogecoin/q'
|
8
|
+
end
|
9
|
+
|
10
|
+
def build_uri(m, params)
|
11
|
+
list = params.join '/'
|
12
|
+
uri = URI.parse("#{@base_uri}/#{m}/#{list}")
|
13
|
+
uri
|
14
|
+
end
|
15
|
+
|
16
|
+
def fetch_uri(uri)
|
17
|
+
uri.open.read
|
18
|
+
end
|
19
|
+
|
20
|
+
def method_missing(m, *args, &block)
|
21
|
+
fetch_uri build_uri(m, args)
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/main.rb
ADDED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: doge_api
|
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
|
- Maxwell Bernstein
|
@@ -16,8 +16,10 @@ executables: []
|
|
16
16
|
extensions: []
|
17
17
|
extra_rdoc_files: []
|
18
18
|
files:
|
19
|
+
- main.rb
|
19
20
|
- lib/doge_api.rb
|
20
|
-
|
21
|
+
- lib/doge_chain.rb
|
22
|
+
homepage: http://github.com/tekknolagi/doge_api
|
21
23
|
licenses:
|
22
24
|
- MIT
|
23
25
|
metadata: {}
|