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.
Files changed (5) hide show
  1. checksums.yaml +4 -4
  2. data/lib/doge_api.rb +19 -17
  3. data/lib/doge_chain.rb +24 -0
  4. data/main.rb +2 -0
  5. metadata +4 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fe21f4d6d848ebfa21f0971c355ddb5215e2c720
4
- data.tar.gz: 75f67327c7133bc0f323fd7f896a3f0ceba28ebd
3
+ metadata.gz: ab027d6d7738cf745138b714f1dda0bbe23371d3
4
+ data.tar.gz: 018a4d9035946d2880a97c1f6dd4e8b942a36e3f
5
5
  SHA512:
6
- metadata.gz: d1ca159dfed22da5fb0c9e9b0c983a2e1af8468df28f87b5c34e8d58a45e80cbc381476b2a7121688d8d8786580e37d065199446a0c4832c77ecd755071566af
7
- data.tar.gz: 026801f355ae9fab2c60c7f45785870f5fe5bc6a61b5bae51c54a876873500d8bb1a39e31929d2fdb0e3412a289fc58abceb979988999107514a9726579867f4
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
- class DogeApi
5
- attr_accessor :api_key
4
+ module DogeApi
5
+ class DogeApi
6
+ attr_accessor :api_key
6
7
 
7
- def initialize(api_key)
8
- @api_key = api_key
9
- @base_uri = URI.parse('https://www.dogeapi.com/wow')
10
- end
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
- def build_uri(m, args)
13
- uri = @base_uri
14
- params = args.merge(:a => m, :api_key => @api_key)
15
- uri.query = URI.encode_www_form(params)
16
- uri
17
- end
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
- def fetch_uri(uri)
20
- uri.open.read
21
- end
20
+ def fetch_uri(uri)
21
+ uri.open.read
22
+ end
22
23
 
23
- def method_missing(m, args = {}, &block)
24
- fetch_uri build_uri(m, args)
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
@@ -0,0 +1,2 @@
1
+ require './lib/doge_api'
2
+ require './lib/doge_chain'
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.1
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
- homepage: http://rubygems.org/gems/doge_api
21
+ - lib/doge_chain.rb
22
+ homepage: http://github.com/tekknolagi/doge_api
21
23
  licenses:
22
24
  - MIT
23
25
  metadata: {}