dogecoin 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: eb855978ee8c8d37366af8a04aa1bb0ac9da129c
4
+ data.tar.gz: 90dcc0b64a68d7792fbc94e3e205b20fdfc917a6
5
+ SHA512:
6
+ metadata.gz: ca420e9b99c9fa22b6000078dde6832a91692019766212458939562961593590e6c52f14b1889fda48227b909f788ddc612f0a8be5909a87766c656772b6ac99
7
+ data.tar.gz: 4d3c3819dcd1a37b6b9b8db24ba5bfd887929846040b543520241f3934347f4485d9ec81dfe66555fe8afbdf5700e9528ae5281c430446cc2bbed56d9b14cd86
@@ -0,0 +1,5 @@
1
+ lib/**/*.rb
2
+ bin/*
3
+ -
4
+ features/**/*.feature
5
+ LICENSE.txt
data/Gemfile ADDED
@@ -0,0 +1,13 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # To make HTTP requests
4
+ gem 'faraday'
5
+
6
+ group :development do
7
+ gem 'pry'
8
+ gem 'shoulda', '>= 0'
9
+ gem 'rdoc', '~> 3.12'
10
+ gem 'bundler', '~> 1.0'
11
+ gem 'jeweler', '~> 1.8.7'
12
+ gem 'simplecov'
13
+ end
@@ -0,0 +1,88 @@
1
+ GEM
2
+ remote: https://rubygems.org/
3
+ specs:
4
+ activesupport (4.0.2)
5
+ i18n (~> 0.6, >= 0.6.4)
6
+ minitest (~> 4.2)
7
+ multi_json (~> 1.3)
8
+ thread_safe (~> 0.1)
9
+ tzinfo (~> 0.3.37)
10
+ addressable (2.3.5)
11
+ atomic (1.1.14)
12
+ builder (3.2.2)
13
+ coderay (1.1.0)
14
+ docile (1.1.1)
15
+ faraday (0.8.8)
16
+ multipart-post (~> 1.2.0)
17
+ git (1.2.6)
18
+ github_api (0.10.1)
19
+ addressable
20
+ faraday (~> 0.8.1)
21
+ hashie (>= 1.2)
22
+ multi_json (~> 1.4)
23
+ nokogiri (~> 1.5.2)
24
+ oauth2
25
+ hashie (2.0.5)
26
+ highline (1.6.20)
27
+ httpauth (0.2.0)
28
+ i18n (0.6.9)
29
+ jeweler (1.8.8)
30
+ builder
31
+ bundler (~> 1.0)
32
+ git (>= 1.2.5)
33
+ github_api (= 0.10.1)
34
+ highline (>= 1.6.15)
35
+ nokogiri (= 1.5.10)
36
+ rake
37
+ rdoc
38
+ json (1.8.1)
39
+ jwt (0.1.8)
40
+ multi_json (>= 1.5)
41
+ method_source (0.8.2)
42
+ minitest (4.7.5)
43
+ multi_json (1.8.2)
44
+ multi_xml (0.5.5)
45
+ multipart-post (1.2.0)
46
+ nokogiri (1.5.10)
47
+ oauth2 (0.9.2)
48
+ faraday (~> 0.8)
49
+ httpauth (~> 0.2)
50
+ jwt (~> 0.1.4)
51
+ multi_json (~> 1.0)
52
+ multi_xml (~> 0.5)
53
+ rack (~> 1.2)
54
+ pry (0.9.12.4)
55
+ coderay (~> 1.0)
56
+ method_source (~> 0.8)
57
+ slop (~> 3.4)
58
+ rack (1.5.2)
59
+ rake (10.1.1)
60
+ rdoc (3.12.2)
61
+ json (~> 1.4)
62
+ shoulda (3.5.0)
63
+ shoulda-context (~> 1.0, >= 1.0.1)
64
+ shoulda-matchers (>= 1.4.1, < 3.0)
65
+ shoulda-context (1.1.6)
66
+ shoulda-matchers (2.4.0)
67
+ activesupport (>= 3.0.0)
68
+ simplecov (0.8.2)
69
+ docile (~> 1.1.0)
70
+ multi_json
71
+ simplecov-html (~> 0.8.0)
72
+ simplecov-html (0.8.0)
73
+ slop (3.4.7)
74
+ thread_safe (0.1.3)
75
+ atomic
76
+ tzinfo (0.3.38)
77
+
78
+ PLATFORMS
79
+ ruby
80
+
81
+ DEPENDENCIES
82
+ bundler (~> 1.0)
83
+ faraday
84
+ jeweler (~> 1.8.7)
85
+ pry
86
+ rdoc (~> 3.12)
87
+ shoulda
88
+ simplecov
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2014 Rahul Horé
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
@@ -0,0 +1,91 @@
1
+ # dogecoin
2
+
3
+ Ruby wrapper for the [DogeAPI](https://www.dogeapi.com). Send and receive Dogecoins. Currently very alpha, while the API is so beta. Such wow, regardless — with much amaze planned for the future.
4
+
5
+ ## Installation
6
+
7
+ You can either `gem install dogecoin` or add `gem 'dogecoin'` to your Gemfile and `bundle` it, doge.
8
+
9
+ ## Configuration
10
+
11
+ Most methods require an API key. Get yours — and many free coin! — [here](https://www.dogeapi.com). Configure like so, plz:
12
+ ```ruby
13
+ @shibe = DogeCoin::Client.new
14
+
15
+ @shibe.configure do |config|
16
+ config.api_key = 'YOUR_API_KEY'
17
+ end
18
+ ```
19
+ ## Usage
20
+
21
+ Descriptions and examples of the supported actions are below.
22
+
23
+ - Returns the DOGE balance of your entire account to 8 decimal places.
24
+
25
+ ```ruby
26
+ @shibe.get_balance
27
+ ```
28
+
29
+ - Withdraws `amount` doge to a `payment_address` you specify. For now, this must be more than 5 doge, and you must have enough extra in your wallet to pay all fees (another 1-3 doge).
30
+
31
+ ```ruby
32
+ @shibe.withdraw(amount, payment_address)
33
+ ```
34
+
35
+ - Returns a new payment address for your account.
36
+
37
+ ```ruby
38
+ @shibe.get_new_address
39
+ ```
40
+
41
+ You can also pass an optional alphanumeric `address_label` as a label for the address.
42
+
43
+ ```ruby
44
+ @shibe.get_new_address(address_label)
45
+ ```
46
+
47
+ - Returns an array of all payment addresses/address IDs for your account.
48
+
49
+ ```ruby
50
+ @shibe.get_my_addresses
51
+ ```
52
+
53
+ - Returns the current amount received to all addresses with `payment_address` or `address_label`.
54
+
55
+ ```ruby
56
+ @shibe.get_address_received(payment_address_or_address_label)
57
+ ```
58
+
59
+ - Returns the payment address for the given `address_label`.
60
+
61
+ ```ruby
62
+ @shibe.get_address_by_label(address_label)
63
+ ```
64
+
65
+ - Returns the current difficulty. This doesn't require an API key.
66
+
67
+ ```ruby
68
+ @shibe.get_difficulty
69
+ ```
70
+
71
+ - Returns the current block. This doesn't require an API key.
72
+
73
+ ```ruby
74
+ @shibe.get_current_block
75
+ ```
76
+
77
+ ## Contributing to dogecoin
78
+
79
+ * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
80
+ * Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.
81
+ * Fork the project.
82
+ * Start a feature/bugfix branch.
83
+ * Commit and push until you are happy with your contribution.
84
+ * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
85
+ * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
86
+
87
+ ## Copyright
88
+
89
+ Copyright (c) 2014 Rahul Horé. See LICENSE.txt for
90
+ further details.
91
+
@@ -0,0 +1,26 @@
1
+ # encoding: utf-8
2
+
3
+ require 'rubygems'
4
+ require 'bundler'
5
+ begin
6
+ Bundler.setup(:default, :development)
7
+ rescue Bundler::BundlerError => e
8
+ $stderr.puts e.message
9
+ $stderr.puts "Run `bundle install` to install missing gems"
10
+ exit e.status_code
11
+ end
12
+ require 'rake'
13
+
14
+ require 'jeweler'
15
+ Jeweler::Tasks.new do |gem|
16
+ # gem is a Gem::Specification... see http://docs.rubygems.org/read/chapter/20 for more options
17
+ gem.name = "dogecoin"
18
+ gem.homepage = "http://github.com/O-I/dogecoin"
19
+ gem.license = "MIT"
20
+ gem.summary = %Q{Ruby wrapper for the DogeAPI}
21
+ gem.description = %Q{Such wow! Send and receive much Dogecoins!}
22
+ gem.email = "hore.rahul@gmail.com"
23
+ gem.authors = ["Rahul Horé"]
24
+ # dependencies defined in Gemfile
25
+ end
26
+ Jeweler::RubygemsDotOrgTasks.new
data/VERSION ADDED
@@ -0,0 +1 @@
1
+ 0.0.1
@@ -0,0 +1,21 @@
1
+ require 'dogecoin/client'
2
+
3
+ module DogeCoin
4
+ class << self
5
+
6
+ # Creates an alias for DogeCoin::Client.new
7
+ def new
8
+ @client ||= DogeCoin::Client.new
9
+ end
10
+
11
+ # Delegate to DogeCoin::Client
12
+ def method_missing(method, *args, &block)
13
+ return super unless new.respond_to?(method)
14
+ new.send(method, *args, &block)
15
+ end
16
+
17
+ def respond_to?(method, include_private = false)
18
+ new.respond_to?(method, include_private) || super(method, include_private)
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,70 @@
1
+ require 'pry'
2
+ require 'json'
3
+ require 'faraday'
4
+ require 'dogecoin/configuration'
5
+
6
+ module DogeCoin
7
+ class Client
8
+ include DogeCoin::Configuration
9
+ include Faraday
10
+
11
+ BASE_URL = "https://dogeapi.com/wow/?"
12
+
13
+ def initialize
14
+ reset
15
+ end
16
+
17
+ # Returns the DOGE balance of your entire account to 8 decimal places.
18
+ def get_balance
19
+ # /wow/?api_key={API_KEY}&a=get_balance
20
+ Faraday.get("#{BASE_URL}api_key=#{api_key}&a=get_balance").body
21
+ end
22
+
23
+ # Withdraws {AMOUNT} doge to a {PAYMENT_ADDRESS} you specify.
24
+ # For now this must be more than 5 doge, and you must have enough extra in your wallet to pay all fees (another 1-3 doge).
25
+ def withdraw(amount, payment_address)
26
+ # /wow/?api_key={API_KEY}&a=withdraw&amount={AMOUNT}&payment_address={PAYMENT_ADDRESS}
27
+ Faraday.get("#{BASE_URL}api_key=#{api_key}&a=withdraw&amount=#{amount}&payment_address=#{payment_address}").body
28
+ end
29
+
30
+ # Returns a new payment address for your account. You can pass an optional alphanumeric {ADDRESS_LABEL} as a label for the address.
31
+ def get_new_address(address_label = nil)
32
+ # /wow/?api_key={API_KEY}&a=get_new_address&address_label={ADDRESS_LABEL}
33
+ if address_label
34
+ Faraday.get("#{BASE_URL}api_key=#{api_key}&a=get_new_address&address_label=#{address_label}").body
35
+ else
36
+ Faraday.get("#{BASE_URL}api_key=#{api_key}&a=get_new_address").body
37
+ end
38
+ end
39
+
40
+ # Returns all payment addresses/address_ids for your account.
41
+ def get_my_addresses
42
+ # /wow/?api_key={API_KEY}&a=get_my_addresses
43
+ Faraday.get("#{BASE_URL}api_key=#{api_key}&a=get_my_addresses").body
44
+ end
45
+
46
+ # Returns the current amount received to all addresses with {ADDRESS_LABEL} or {PAYMENT_ADDRESS}.
47
+ def get_address_received(payment_address_or_address_label)
48
+ # /wow/?api_key={API_KEY}&a=get_address_received&payment_address={PAYMENT_ADDRESS}
49
+ Faraday.get("#{BASE_URL}api_key=#{api_key}&a=get_address_received&payment_address=#{payment_address_or_address_label}").body
50
+ end
51
+
52
+ # Returns the payment address for the given {ADDRESS_LABEL}
53
+ def get_address_by_label(address_label)
54
+ # /wow/?api_key={API_KEY}&a=get_address_by_label&address_label={ADDRESS_LABEL}
55
+ Faraday.get("#{BASE_URL}api_key=#{api_key}&a=get__address_by_label&address_label=#{address_label}").body
56
+ end
57
+
58
+ # Returns the current difficulty. This doesn't require an API key.
59
+ def get_difficulty
60
+ # /wow/?a=get_difficulty
61
+ Faraday.get("#{BASE_URL}&a=get_difficulty").body
62
+ end
63
+
64
+ # Returns the current block. This doesn't require an API key.
65
+ def get_current_block
66
+ # /wow/?a=get_current_block
67
+ Faraday.get("#{BASE_URL}#&a=get_current_block").body
68
+ end
69
+ end
70
+ end
@@ -0,0 +1,15 @@
1
+ module DogeCoin
2
+ module Configuration
3
+
4
+ attr_accessor :api_key
5
+
6
+ def configure
7
+ yield self
8
+ end
9
+
10
+ def reset
11
+ self.api_key = nil
12
+ self
13
+ end
14
+ end
15
+ end
metadata ADDED
@@ -0,0 +1,153 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: dogecoin
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Rahul Horé
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-01-10 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: faraday
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: pry
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: shoulda
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
55
+ - !ruby/object:Gem::Dependency
56
+ name: rdoc
57
+ requirement: !ruby/object:Gem::Requirement
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: '3.12'
62
+ type: :development
63
+ prerelease: false
64
+ version_requirements: !ruby/object:Gem::Requirement
65
+ requirements:
66
+ - - ~>
67
+ - !ruby/object:Gem::Version
68
+ version: '3.12'
69
+ - !ruby/object:Gem::Dependency
70
+ name: bundler
71
+ requirement: !ruby/object:Gem::Requirement
72
+ requirements:
73
+ - - ~>
74
+ - !ruby/object:Gem::Version
75
+ version: '1.0'
76
+ type: :development
77
+ prerelease: false
78
+ version_requirements: !ruby/object:Gem::Requirement
79
+ requirements:
80
+ - - ~>
81
+ - !ruby/object:Gem::Version
82
+ version: '1.0'
83
+ - !ruby/object:Gem::Dependency
84
+ name: jeweler
85
+ requirement: !ruby/object:Gem::Requirement
86
+ requirements:
87
+ - - ~>
88
+ - !ruby/object:Gem::Version
89
+ version: 1.8.7
90
+ type: :development
91
+ prerelease: false
92
+ version_requirements: !ruby/object:Gem::Requirement
93
+ requirements:
94
+ - - ~>
95
+ - !ruby/object:Gem::Version
96
+ version: 1.8.7
97
+ - !ruby/object:Gem::Dependency
98
+ name: simplecov
99
+ requirement: !ruby/object:Gem::Requirement
100
+ requirements:
101
+ - - '>='
102
+ - !ruby/object:Gem::Version
103
+ version: '0'
104
+ type: :development
105
+ prerelease: false
106
+ version_requirements: !ruby/object:Gem::Requirement
107
+ requirements:
108
+ - - '>='
109
+ - !ruby/object:Gem::Version
110
+ version: '0'
111
+ description: Such wow! Send and receive much Dogecoins!
112
+ email: hore.rahul@gmail.com
113
+ executables: []
114
+ extensions: []
115
+ extra_rdoc_files:
116
+ - LICENSE.txt
117
+ - README.md
118
+ files:
119
+ - .document
120
+ - Gemfile
121
+ - Gemfile.lock
122
+ - LICENSE.txt
123
+ - README.md
124
+ - Rakefile
125
+ - VERSION
126
+ - lib/dogecoin.rb
127
+ - lib/dogecoin/client.rb
128
+ - lib/dogecoin/configuration.rb
129
+ homepage: http://github.com/O-I/dogecoin
130
+ licenses:
131
+ - MIT
132
+ metadata: {}
133
+ post_install_message:
134
+ rdoc_options: []
135
+ require_paths:
136
+ - lib
137
+ required_ruby_version: !ruby/object:Gem::Requirement
138
+ requirements:
139
+ - - '>='
140
+ - !ruby/object:Gem::Version
141
+ version: '0'
142
+ required_rubygems_version: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - '>='
145
+ - !ruby/object:Gem::Version
146
+ version: '0'
147
+ requirements: []
148
+ rubyforge_project:
149
+ rubygems_version: 2.1.9
150
+ signing_key:
151
+ specification_version: 4
152
+ summary: Ruby wrapper for the DogeAPI
153
+ test_files: []