doge_api 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/doge_api.rb +26 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: fe21f4d6d848ebfa21f0971c355ddb5215e2c720
4
+ data.tar.gz: 75f67327c7133bc0f323fd7f896a3f0ceba28ebd
5
+ SHA512:
6
+ metadata.gz: d1ca159dfed22da5fb0c9e9b0c983a2e1af8468df28f87b5c34e8d58a45e80cbc381476b2a7121688d8d8786580e37d065199446a0c4832c77ecd755071566af
7
+ data.tar.gz: 026801f355ae9fab2c60c7f45785870f5fe5bc6a61b5bae51c54a876873500d8bb1a39e31929d2fdb0e3412a289fc58abceb979988999107514a9726579867f4
data/lib/doge_api.rb ADDED
@@ -0,0 +1,26 @@
1
+ require 'uri'
2
+ require 'open-uri'
3
+
4
+ class DogeApi
5
+ attr_accessor :api_key
6
+
7
+ def initialize(api_key)
8
+ @api_key = api_key
9
+ @base_uri = URI.parse('https://www.dogeapi.com/wow')
10
+ end
11
+
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
18
+
19
+ def fetch_uri(uri)
20
+ uri.open.read
21
+ end
22
+
23
+ def method_missing(m, args = {}, &block)
24
+ fetch_uri build_uri(m, args)
25
+ end
26
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: doge_api
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Maxwell Bernstein
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-25 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: dogeapi@bernsteinbear.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/doge_api.rb
20
+ homepage: http://rubygems.org/gems/doge_api
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.0.4
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: Ruby wrapper for DogeAPI
44
+ test_files: []