bitsy_client 0.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.envrc +1 -0
- data/.gitignore +17 -0
- data/.ruby-version +1 -0
- data/Gemfile +6 -0
- data/LICENSE.txt +22 -0
- data/README.md +53 -0
- data/Rakefile +1 -0
- data/bitsy_client.gemspec +29 -0
- data/lib/bitsy_client.rb +21 -0
- data/lib/bitsy_client/models.rb +2 -0
- data/lib/bitsy_client/models/payment_depot.rb +5 -0
- data/lib/bitsy_client/models/resource_base.rb +7 -0
- data/lib/bitsy_client/version.rb +3 -0
- data/spec/bitsy_client/models/payment_depot_spec.rb +17 -0
- data/spec/bitsy_client/models/resource_base_spec.rb +7 -0
- data/spec/bitsy_client_spec.rb +37 -0
- data/spec/fixtures/vcr_cassettes/BitsyClient_PaymentDepot/communicates_with_Bitsy.yml +355 -0
- data/spec/spec_helper.rb +12 -0
- metadata +165 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: d5f471a52cc2def9700f5af26a26d0f60682da7a
|
4
|
+
data.tar.gz: 8f88330bd152a3cd34afe63acfaf8328b3af6de1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: d6d6b779b53bdbffeb2a051019d4fababebd79965f123ff5be57726123d7e3fa4c3057dcb7368ed9f16c1dfb6ca73d149d4dd4a8123fc2319c73d195af36188e
|
7
|
+
data.tar.gz: 0ea5d345c1c1487a98314117c459af2831e6f952e5628d74bffd816949d3d46227693c1e0822a3d134b931f01738140823d3d62a20134ed530cce0b5208119d1
|
data/.envrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
export PATH=$PWD/bin:$PATH
|
data/.gitignore
ADDED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
ruby-2.1.1
|
data/Gemfile
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2014 Ramon Tayag
|
2
|
+
|
3
|
+
MIT License
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,53 @@
|
|
1
|
+
# BitsyClient
|
2
|
+
|
3
|
+
TODO: Write a gem description
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
gem 'bitsy_client'
|
10
|
+
|
11
|
+
And then execute:
|
12
|
+
|
13
|
+
$ bundle
|
14
|
+
|
15
|
+
Or install it yourself as:
|
16
|
+
|
17
|
+
$ gem install bitsy_client
|
18
|
+
|
19
|
+
## Usage
|
20
|
+
|
21
|
+
First, you have to tell the gem where to find the Bitsy server:
|
22
|
+
|
23
|
+
BitsyClient.site = "http://someserver.com:80"
|
24
|
+
|
25
|
+
Then you can call:
|
26
|
+
|
27
|
+
pd = BitsyClient::PaymentDepot.create(
|
28
|
+
min_payment: 0.2,
|
29
|
+
initial_tax_rate: 0.5,
|
30
|
+
added_tax_rate: 0.1,
|
31
|
+
tax_address: "the taxes go here",
|
32
|
+
owner_address: "the rest of the money goes here",
|
33
|
+
)
|
34
|
+
pd.id # the database id
|
35
|
+
pd.address # the payment depot's Bitcoin address
|
36
|
+
|
37
|
+
BitsyClient::PaymentDepot.find(2)
|
38
|
+
|
39
|
+
## Testing
|
40
|
+
|
41
|
+
bundle exec rspec spec
|
42
|
+
|
43
|
+
If you delete the vcr cassettes, then when you run the specs it will attempt to connect to a Bitsy server at `http://localhost:3000`. If that does not start it will complain. Remember to start the Bitcoin daemon for Bitsy too.
|
44
|
+
|
45
|
+
## Contributing
|
46
|
+
|
47
|
+
1. Fork it
|
48
|
+
2. Create your feature branch (`git checkout -b my-new-feature`)
|
49
|
+
3. Commit your changes (`git commit -am 'Add some feature'`)
|
50
|
+
4. Push to the branch (`git push origin my-new-feature`)
|
51
|
+
5. Create new Pull Request
|
52
|
+
|
53
|
+
If you find this useful, consider sharing some BTC love: `1PwQWijmJ39hWXk9X3CdAhEdExdkANEAPk`
|
data/Rakefile
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
require "bundler/gem_tasks"
|
@@ -0,0 +1,29 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'bitsy_client/version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "bitsy_client"
|
8
|
+
spec.version = BitsyClient::VERSION
|
9
|
+
spec.authors = ["Ramon Tayag"]
|
10
|
+
spec.email = ["ramon.tayag@gmail.com"]
|
11
|
+
spec.description = %q{Bitsy Client gem used to create and query payment depots}
|
12
|
+
spec.summary = %q{Interface with the Bitsy Bitcoin payment server}
|
13
|
+
spec.homepage = ""
|
14
|
+
spec.license = "MIT"
|
15
|
+
|
16
|
+
spec.files = `git ls-files`.split($/)
|
17
|
+
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
+
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
+
spec.require_paths = ["lib"]
|
20
|
+
|
21
|
+
spec.add_development_dependency "bundler", "~> 1.3"
|
22
|
+
spec.add_development_dependency "rake"
|
23
|
+
spec.add_development_dependency "rspec", "~> 2.14"
|
24
|
+
spec.add_development_dependency "vcr", "~> 2.8"
|
25
|
+
spec.add_development_dependency "webmock"
|
26
|
+
|
27
|
+
spec.add_dependency "activeresource", "~> 4.0"
|
28
|
+
spec.add_dependency "activesupport", "~> 4.0"
|
29
|
+
end
|
data/lib/bitsy_client.rb
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
require "bitsy_client/version"
|
2
|
+
require "active_resource"
|
3
|
+
require "active_support/core_ext/module/attribute_accessors"
|
4
|
+
require "bitsy_client/models"
|
5
|
+
|
6
|
+
module BitsyClient
|
7
|
+
|
8
|
+
API_VERSION = "v1"
|
9
|
+
|
10
|
+
mattr_reader :site
|
11
|
+
|
12
|
+
def self.configure
|
13
|
+
yield self if block_given?
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.site=(val)
|
17
|
+
@@site = (val.split("/") << API_VERSION).join("/")
|
18
|
+
ResourceBase.site = @@site
|
19
|
+
end
|
20
|
+
|
21
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
module BitsyClient
|
4
|
+
describe PaymentDepot do
|
5
|
+
|
6
|
+
it "communicates with Bitsy", vcr: {record: :once} do
|
7
|
+
payment_depot = described_class.new(min_payment: 2.0,
|
8
|
+
initial_tax_rate: 0.8,
|
9
|
+
added_tax_rate: 0.2)
|
10
|
+
payment_depot.save
|
11
|
+
id = payment_depot.id
|
12
|
+
payment_depot = described_class.find(payment_depot.id)
|
13
|
+
expect(payment_depot.id).to eq id
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,37 @@
|
|
1
|
+
require "spec_helper"
|
2
|
+
|
3
|
+
describe BitsyClient do
|
4
|
+
|
5
|
+
describe ".configure" do
|
6
|
+
it "allows configuration" do
|
7
|
+
described_class.configure do |c|
|
8
|
+
c.site = "http://some.host.com:8080"
|
9
|
+
end
|
10
|
+
|
11
|
+
expect(described_class.site).to include("http://some.host.com:8080")
|
12
|
+
end
|
13
|
+
end
|
14
|
+
|
15
|
+
describe ".site=" do
|
16
|
+
it "allows setting of .site" do
|
17
|
+
described_class.site = "abc"
|
18
|
+
expect(described_class.site).to include "abc"
|
19
|
+
end
|
20
|
+
|
21
|
+
it "sets ResourceBase.site" do
|
22
|
+
described_class.site = "ab.com"
|
23
|
+
expect(BitsyClient::ResourceBase.site.to_s).to include "ab.com"
|
24
|
+
end
|
25
|
+
|
26
|
+
it "sets the API version prefix" do
|
27
|
+
described_class.site = "http://hello.com"
|
28
|
+
expected_site = "http://hello.com/#{BitsyClient::API_VERSION}"
|
29
|
+
expect(described_class.site.to_s).to eq expected_site
|
30
|
+
|
31
|
+
described_class.site = "http://hello.com/"
|
32
|
+
expected_site = "http://hello.com/#{BitsyClient::API_VERSION}"
|
33
|
+
expect(described_class.site.to_s).to eq expected_site
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
end
|
@@ -0,0 +1,355 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: http://localhost:3000/v0/payment_depots.json
|
6
|
+
body:
|
7
|
+
encoding: UTF-8
|
8
|
+
string: '{"min_payment":2.0}'
|
9
|
+
headers:
|
10
|
+
Content-Type:
|
11
|
+
- application/json
|
12
|
+
Accept-Encoding:
|
13
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
14
|
+
Accept:
|
15
|
+
- "*/*"
|
16
|
+
User-Agent:
|
17
|
+
- Ruby
|
18
|
+
response:
|
19
|
+
status:
|
20
|
+
code: 404
|
21
|
+
message: 'Not Found '
|
22
|
+
headers:
|
23
|
+
Content-Type:
|
24
|
+
- text/html; charset=utf-8
|
25
|
+
Content-Length:
|
26
|
+
- '13984'
|
27
|
+
X-Request-Id:
|
28
|
+
- c76fcdc0-c91d-45e6-b0b2-726e4762adc4
|
29
|
+
X-Runtime:
|
30
|
+
- '0.022232'
|
31
|
+
Server:
|
32
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
33
|
+
Date:
|
34
|
+
- Fri, 14 Mar 2014 12:59:05 GMT
|
35
|
+
Connection:
|
36
|
+
- Keep-Alive
|
37
|
+
body:
|
38
|
+
encoding: UTF-8
|
39
|
+
string: "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n <meta charset=\"utf-8\"
|
40
|
+
/>\n <title>Action Controller: Exception caught</title>\n <style>\n body
|
41
|
+
{\n background-color: #FAFAFA;\n color: #333;\n margin: 0px;\n
|
42
|
+
\ }\n\n body, p, ol, ul, td {\n font-family: helvetica, verdana,
|
43
|
+
arial, sans-serif;\n font-size: 13px;\n line-height: 18px;\n }\n\n
|
44
|
+
\ pre {\n font-size: 11px;\n white-space: pre-wrap;\n }\n\n
|
45
|
+
\ pre.box {\n border: 1px solid #EEE;\n padding: 10px;\n margin:
|
46
|
+
0px;\n width: 958px;\n }\n\n header {\n color: #F0F0F0;\n
|
47
|
+
\ background: #C52F24;\n padding: 0.5em 1.5em;\n }\n\n h1 {\n
|
48
|
+
\ margin: 0.2em 0;\n line-height: 1.1em;\n font-size: 2em;\n
|
49
|
+
\ }\n\n h2 {\n color: #C52F24;\n line-height: 25px;\n }\n\n
|
50
|
+
\ .details {\n border: 1px solid #D0D0D0;\n border-radius: 4px;\n
|
51
|
+
\ margin: 1em 0px;\n display: block;\n width: 978px;\n }\n\n
|
52
|
+
\ .summary {\n padding: 8px 15px;\n border-bottom: 1px solid #D0D0D0;\n
|
53
|
+
\ display: block;\n }\n\n .details pre {\n margin: 5px;\n border:
|
54
|
+
none;\n }\n\n #container {\n box-sizing: border-box;\n width:
|
55
|
+
100%;\n padding: 0 1.5em;\n }\n\n .source * {\n margin: 0px;\n
|
56
|
+
\ padding: 0px;\n }\n\n .source {\n border: 1px solid #D9D9D9;\n
|
57
|
+
\ background: #ECECEC;\n width: 978px;\n }\n\n .source pre
|
58
|
+
{\n padding: 10px 0px;\n border: none;\n }\n\n .source .data
|
59
|
+
{\n font-size: 80%;\n overflow: auto;\n background-color: #FFF;\n
|
60
|
+
\ }\n\n .info {\n padding: 0.5em;\n }\n\n .source .data .line_numbers
|
61
|
+
{\n background-color: #ECECEC;\n color: #AAA;\n padding: 1em
|
62
|
+
.5em;\n border-right: 1px solid #DDD;\n text-align: right;\n }\n\n
|
63
|
+
\ .line {\n padding-left: 10px;\n }\n\n .line:hover {\n background-color:
|
64
|
+
#F6F6F6;\n }\n\n .line.active {\n background-color: #FFCCCC;\n
|
65
|
+
\ }\n\n a { color: #980905; }\n a:visited { color: #666; }\n a:hover
|
66
|
+
{ color: #C52F24; }\n\n #route_table {\n margin: 0 auto 0;\n border-collapse:
|
67
|
+
collapse;\n }\n\n #route_table td {\n padding: 0 30px;\n }\n\n #route_table
|
68
|
+
tr.bottom th {\n padding-bottom: 10px;\n line-height: 15px;\n }\n\n
|
69
|
+
\ #route_table .matched_paths {\n background-color: LightGoldenRodYellow;\n
|
70
|
+
\ }\n\n #route_table .matched_paths {\n border-bottom: solid 3px SlateGrey;\n
|
71
|
+
\ }\n\n #path_search {\n width: 80%;\n font-size: inherit;\n }\n\n
|
72
|
+
\ </style>\n\n <script>\n var toggle = function(id) {\n var s = document.getElementById(id).style;\n
|
73
|
+
\ s.display = s.display == 'none' ? 'block' : 'none';\n return false;\n
|
74
|
+
\ }\n var show = function(id) {\n document.getElementById(id).style.display
|
75
|
+
= 'block';\n }\n var hide = function(id) {\n document.getElementById(id).style.display
|
76
|
+
= 'none';\n }\n var toggleTrace = function() {\n return toggle('blame_trace');\n
|
77
|
+
\ }\n var toggleSessionDump = function() {\n return toggle('session_dump');\n
|
78
|
+
\ }\n var toggleEnvDump = function() {\n return toggle('env_dump');\n
|
79
|
+
\ }\n </script>\n</head>\n<body>\n\n<header>\n <h1>Routing Error</h1>\n</header>\n<div
|
80
|
+
id=\"container\">\n <h2>No route matches [POST] "/v0/payment_depots.json"</h2>\n\n
|
81
|
+
\ \n<p><code>Rails.root: /vagrant/bitsy</code></p>\n\n<div id=\"traces\">\n
|
82
|
+
\ <a href=\"#\" onclick=\"hide('Framework-Trace');hide('Full-Trace');show('Application-Trace');;
|
83
|
+
return false;\">Application Trace</a> |\n <a href=\"#\" onclick=\"hide('Application-Trace');hide('Full-Trace');show('Framework-Trace');;
|
84
|
+
return false;\">Framework Trace</a> |\n <a href=\"#\" onclick=\"hide('Application-Trace');hide('Framework-Trace');show('Full-Trace');;
|
85
|
+
return false;\">Full Trace</a> \n\n <div id=\"Application-Trace\" style=\"display:
|
86
|
+
block;\">\n <pre><code></code></pre>\n </div>\n <div id=\"Framework-Trace\"
|
87
|
+
style=\"display: none;\">\n <pre><code>actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in
|
88
|
+
`call'\nactionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in
|
89
|
+
`call'\nrailties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'\nrailties
|
90
|
+
(4.0.3) lib/rails/rack/logger.rb:20:in `block in call'\nactivesupport
|
91
|
+
(4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'\nactivesupport
|
92
|
+
(4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'\nactivesupport
|
93
|
+
(4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'\nrailties
|
94
|
+
(4.0.3) lib/rails/rack/logger.rb:20:in `call'\nactionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in
|
95
|
+
`call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport
|
96
|
+
(4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call'\nrack
|
97
|
+
(1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in
|
98
|
+
`call'\nrailties (4.0.3) lib/rails/engine.rb:511:in `call'\nrailties
|
99
|
+
(4.0.3) lib/rails/application.rb:97:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in
|
100
|
+
`call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\nrack
|
101
|
+
(1.5.2) lib/rack/handler/webrick.rb:60:in `service'\n/home/vagrant/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
|
102
|
+
`service'\n/home/vagrant/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:94:in
|
103
|
+
`run'\n/home/vagrant/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:295:in
|
104
|
+
`block in start_thread'</code></pre>\n </div>\n <div id=\"Full-Trace\"
|
105
|
+
style=\"display: none;\">\n <pre><code>actionpack (4.0.3) lib/action_dispatch/middleware/debug_exceptions.rb:21:in
|
106
|
+
`call'\nactionpack (4.0.3) lib/action_dispatch/middleware/show_exceptions.rb:30:in
|
107
|
+
`call'\nrailties (4.0.3) lib/rails/rack/logger.rb:38:in `call_app'\nrailties
|
108
|
+
(4.0.3) lib/rails/rack/logger.rb:20:in `block in call'\nactivesupport
|
109
|
+
(4.0.3) lib/active_support/tagged_logging.rb:67:in `block in tagged'\nactivesupport
|
110
|
+
(4.0.3) lib/active_support/tagged_logging.rb:25:in `tagged'\nactivesupport
|
111
|
+
(4.0.3) lib/active_support/tagged_logging.rb:67:in `tagged'\nrailties
|
112
|
+
(4.0.3) lib/rails/rack/logger.rb:20:in `call'\nactionpack (4.0.3) lib/action_dispatch/middleware/request_id.rb:21:in
|
113
|
+
`call'\nrack (1.5.2) lib/rack/runtime.rb:17:in `call'\nactivesupport
|
114
|
+
(4.0.3) lib/active_support/cache/strategy/local_cache.rb:83:in `call'\nrack
|
115
|
+
(1.5.2) lib/rack/lock.rb:17:in `call'\nactionpack (4.0.3) lib/action_dispatch/middleware/static.rb:64:in
|
116
|
+
`call'\nrailties (4.0.3) lib/rails/engine.rb:511:in `call'\nrailties
|
117
|
+
(4.0.3) lib/rails/application.rb:97:in `call'\nrack (1.5.2) lib/rack/lock.rb:17:in
|
118
|
+
`call'\nrack (1.5.2) lib/rack/content_length.rb:14:in `call'\nrack
|
119
|
+
(1.5.2) lib/rack/handler/webrick.rb:60:in `service'\n/home/vagrant/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:138:in
|
120
|
+
`service'\n/home/vagrant/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/httpserver.rb:94:in
|
121
|
+
`run'\n/home/vagrant/.rvm/rubies/ruby-2.1.1/lib/ruby/2.1.0/webrick/server.rb:295:in
|
122
|
+
`block in start_thread'</code></pre>\n </div>\n</div>\n\n\n <h2>\n
|
123
|
+
\ Routes\n </h2>\n\n <p>\n Routes match in priority from top
|
124
|
+
to bottom\n </p>\n\n \n<table id='route_table' class='route_table'>\n
|
125
|
+
\ <thead>\n <tr>\n <th>Helper</th>\n <th>HTTP Verb</th>\n <th>Path</th>\n
|
126
|
+
\ <th>Controller#Action</th>\n </tr>\n <tr class='bottom'>\n <th>\n
|
127
|
+
\ <a data-route-helper=\"_path\" href=\"#\" title=\"Returns a relative
|
128
|
+
path (without the http or domain)\">Path</a> /\n <a data-route-helper=\"_url\"
|
129
|
+
href=\"#\" title=\"Returns an absolute url (with the http and domain)\">Url</a>\n
|
130
|
+
\ </th>\n <th>\n </th>\n <th>\n <input id=\"path_search\"
|
131
|
+
name=\"path[]\" placeholder=\"Path Match\" type=\"search\" />\n </th>\n
|
132
|
+
\ <th>\n </th>\n </tr>\n </thead>\n <tbody class='matched_paths'
|
133
|
+
id='matched_paths'>\n </tbody>\n <tbody>\n <tr class='route_row' data-helper='path'>\n
|
134
|
+
\ <td data-route-name='v1_payment_depots'>\n v1_payment_depots<span class='helper'>_path</span>\n
|
135
|
+
\ </td>\n <td data-route-verb='GET'>\n GET\n </td>\n <td data-route-path='/v1/payment_depots(.:format)'
|
136
|
+
data-regexp='^\\/v1\\/payment_depots(?:\\.([^\\/.?]+))?$'>\n /v1/payment_depots(.:format)\n
|
137
|
+
\ </td>\n <td data-route-reqs='v1/payment_depots#index'>\n v1/payment_depots#index\n
|
138
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name=''>\n
|
139
|
+
\ </td>\n <td data-route-verb='POST'>\n POST\n </td>\n <td data-route-path='/v1/payment_depots(.:format)'
|
140
|
+
data-regexp='^\\/v1\\/payment_depots(?:\\.([^\\/.?]+))?$'>\n /v1/payment_depots(.:format)\n
|
141
|
+
\ </td>\n <td data-route-reqs='v1/payment_depots#create'>\n v1/payment_depots#create\n
|
142
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='new_v1_payment_depot'>\n
|
143
|
+
\ new_v1_payment_depot<span class='helper'>_path</span>\n </td>\n <td
|
144
|
+
data-route-verb='GET'>\n GET\n </td>\n <td data-route-path='/v1/payment_depots/new(.:format)'
|
145
|
+
data-regexp='^\\/v1\\/payment_depots\\/new(?:\\.([^\\/.?]+))?$'>\n /v1/payment_depots/new(.:format)\n
|
146
|
+
\ </td>\n <td data-route-reqs='v1/payment_depots#new'>\n v1/payment_depots#new\n
|
147
|
+
\ </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n <td data-route-name='edit_v1_payment_depot'>\n
|
148
|
+
\ edit_v1_payment_depot<span class='helper'>_path</span>\n </td>\n <td
|
149
|
+
data-route-verb='GET'>\n GET\n </td>\n <td data-route-path='/v1/payment_depots/:id/edit(.:format)'
|
150
|
+
data-regexp='^\\/v1\\/payment_depots\\/([^\\/.?]+)\\/edit(?:\\.([^\\/.?]+))?$'>\n
|
151
|
+
\ /v1/payment_depots/:id/edit(.:format)\n </td>\n <td data-route-reqs='v1/payment_depots#edit'>\n
|
152
|
+
\ v1/payment_depots#edit\n </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n
|
153
|
+
\ <td data-route-name='v1_payment_depot'>\n v1_payment_depot<span class='helper'>_path</span>\n
|
154
|
+
\ </td>\n <td data-route-verb='GET'>\n GET\n </td>\n <td data-route-path='/v1/payment_depots/:id(.:format)'
|
155
|
+
data-regexp='^\\/v1\\/payment_depots\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
156
|
+
\ /v1/payment_depots/:id(.:format)\n </td>\n <td data-route-reqs='v1/payment_depots#show'>\n
|
157
|
+
\ v1/payment_depots#show\n </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n
|
158
|
+
\ <td data-route-name=''>\n </td>\n <td data-route-verb='PATCH'>\n PATCH\n
|
159
|
+
\ </td>\n <td data-route-path='/v1/payment_depots/:id(.:format)' data-regexp='^\\/v1\\/payment_depots\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
160
|
+
\ /v1/payment_depots/:id(.:format)\n </td>\n <td data-route-reqs='v1/payment_depots#update'>\n
|
161
|
+
\ v1/payment_depots#update\n </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n
|
162
|
+
\ <td data-route-name=''>\n </td>\n <td data-route-verb='PUT'>\n PUT\n
|
163
|
+
\ </td>\n <td data-route-path='/v1/payment_depots/:id(.:format)' data-regexp='^\\/v1\\/payment_depots\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
164
|
+
\ /v1/payment_depots/:id(.:format)\n </td>\n <td data-route-reqs='v1/payment_depots#update'>\n
|
165
|
+
\ v1/payment_depots#update\n </td>\n</tr>\n<tr class='route_row' data-helper='path'>\n
|
166
|
+
\ <td data-route-name=''>\n </td>\n <td data-route-verb='DELETE'>\n DELETE\n
|
167
|
+
\ </td>\n <td data-route-path='/v1/payment_depots/:id(.:format)' data-regexp='^\\/v1\\/payment_depots\\/([^\\/.?]+)(?:\\.([^\\/.?]+))?$'>\n
|
168
|
+
\ /v1/payment_depots/:id(.:format)\n </td>\n <td data-route-reqs='v1/payment_depots#destroy'>\n
|
169
|
+
\ v1/payment_depots#destroy\n </td>\n</tr>\n\n </tbody>\n</table>\n\n<script
|
170
|
+
type='text/javascript'>\n function each(elems, func) {\n if (!elems instanceof
|
171
|
+
Array) { elems = [elems]; }\n for (var i = 0, len = elems.length; i < len;
|
172
|
+
i++) {\n func(elems[i]);\n }\n }\n\n function setValOn(elems, val)
|
173
|
+
{\n each(elems, function(elem) {\n elem.innerHTML = val;\n });\n
|
174
|
+
\ }\n\n function onClick(elems, func) {\n each(elems, function(elem) {\n
|
175
|
+
\ elem.onclick = func;\n });\n }\n\n // Enables functionality to
|
176
|
+
toggle between `_path` and `_url` helper suffixes\n function setupRouteToggleHelperLinks()
|
177
|
+
{\n var toggleLinks = document.querySelectorAll('#route_table [data-route-helper]');\n
|
178
|
+
\ onClick(toggleLinks, function(){\n var helperTxt = this.getAttribute(\"data-route-helper\"),\n
|
179
|
+
\ helperElems = document.querySelectorAll('[data-route-name] span.helper');\n
|
180
|
+
\ setValOn(helperElems, helperTxt);\n });\n }\n\n // takes an array
|
181
|
+
of elements with a data-regexp attribute and\n // passes their their parent
|
182
|
+
<tr> into the callback function\n // if the regexp matchs a given path\n
|
183
|
+
\ function eachElemsForPath(elems, path, func) {\n each(elems, function(e){\n
|
184
|
+
\ var reg = e.getAttribute(\"data-regexp\");\n if (path.match(RegExp(reg)))
|
185
|
+
{\n func(e.parentNode.cloneNode(true));\n }\n })\n }\n\n //
|
186
|
+
Ensure path always starts with a slash \"/\" and remove params or fragments\n
|
187
|
+
\ function sanitizePath(path) {\n var path = path.charAt(0) == '/' ? path
|
188
|
+
: \"/\" + path;\n return path.replace(/\\#.*|\\?.*/, '');\n }\n\n //
|
189
|
+
Enables path search functionality\n function setupMatchPaths() {\n var
|
190
|
+
regexpElems = document.querySelectorAll('#route_table [data-regexp]'),\n
|
191
|
+
\ pathElem = document.querySelector('#path_search'),\n selectedSection
|
192
|
+
= document.querySelector('#matched_paths'),\n noMatchText = '<tr><th
|
193
|
+
colspan=\"4\">None</th></tr>';\n\n\n // Remove matches if no path is present\n
|
194
|
+
\ pathElem.onblur = function(e) {\n if (pathElem.value === \"\") selectedSection.innerHTML
|
195
|
+
= \"\";\n }\n\n // On key press perform a search for matching paths\n
|
196
|
+
\ pathElem.onkeyup = function(e){\n var path = sanitizePath(pathElem.value),\n
|
197
|
+
\ defaultText = '<tr><th colspan=\"4\">Paths Matching (' + path +
|
198
|
+
'):</th></tr>';\n\n // Clear out results section\n selectedSection.innerHTML=
|
199
|
+
defaultText;\n\n // Display matches if they exist\n eachElemsForPath(regexpElems,
|
200
|
+
path, function(e){\n selectedSection.appendChild(e);\n });\n\n
|
201
|
+
\ // If no match present, tell the user\n if (selectedSection.innerHTML
|
202
|
+
=== defaultText) {\n selectedSection.innerHTML = selectedSection.innerHTML
|
203
|
+
+ noMatchText;\n }\n }\n }\n\n setupMatchPaths();\n setupRouteToggleHelperLinks();\n</script>\n\n</div>\n\n\n</body>\n</html>\n"
|
204
|
+
http_version:
|
205
|
+
recorded_at: Fri, 14 Mar 2014 12:59:05 GMT
|
206
|
+
- request:
|
207
|
+
method: get
|
208
|
+
uri: http://localhost:3000/v1/payment_depots/1.json
|
209
|
+
body:
|
210
|
+
encoding: US-ASCII
|
211
|
+
string: ''
|
212
|
+
headers:
|
213
|
+
Accept:
|
214
|
+
- application/json
|
215
|
+
Accept-Encoding:
|
216
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
217
|
+
User-Agent:
|
218
|
+
- Ruby
|
219
|
+
response:
|
220
|
+
status:
|
221
|
+
code: 200
|
222
|
+
message: 'OK '
|
223
|
+
headers:
|
224
|
+
X-Frame-Options:
|
225
|
+
- SAMEORIGIN
|
226
|
+
X-Xss-Protection:
|
227
|
+
- 1; mode=block
|
228
|
+
X-Content-Type-Options:
|
229
|
+
- nosniff
|
230
|
+
X-Ua-Compatible:
|
231
|
+
- chrome=1
|
232
|
+
Content-Type:
|
233
|
+
- application/json; charset=utf-8
|
234
|
+
Etag:
|
235
|
+
- '"5e6a9d9c5dcbdda84ec7a766ddbc6459"'
|
236
|
+
Cache-Control:
|
237
|
+
- max-age=0, private, must-revalidate
|
238
|
+
X-Request-Id:
|
239
|
+
- 95a7a113-ab39-4d12-82be-dfefe7b06071
|
240
|
+
X-Runtime:
|
241
|
+
- '0.013653'
|
242
|
+
Server:
|
243
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
244
|
+
Date:
|
245
|
+
- Fri, 14 Mar 2014 13:03:55 GMT
|
246
|
+
Content-Length:
|
247
|
+
- '85'
|
248
|
+
Connection:
|
249
|
+
- Keep-Alive
|
250
|
+
body:
|
251
|
+
encoding: UTF-8
|
252
|
+
string: '{"payment_depot":{"id":1,"min_payment_received":false,"total_received_amount":"0.0"}}'
|
253
|
+
http_version:
|
254
|
+
recorded_at: Fri, 14 Mar 2014 13:03:55 GMT
|
255
|
+
- request:
|
256
|
+
method: post
|
257
|
+
uri: http://localhost:3000/v1/payment_depots.json
|
258
|
+
body:
|
259
|
+
encoding: UTF-8
|
260
|
+
string: '{"payment_depot":{"min_payment":2.0,"initial_tax_rate":0.8,"added_tax_rate":0.2}}'
|
261
|
+
headers:
|
262
|
+
Content-Type:
|
263
|
+
- application/json
|
264
|
+
Accept-Encoding:
|
265
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
266
|
+
Accept:
|
267
|
+
- "*/*"
|
268
|
+
User-Agent:
|
269
|
+
- Ruby
|
270
|
+
response:
|
271
|
+
status:
|
272
|
+
code: 200
|
273
|
+
message: 'OK '
|
274
|
+
headers:
|
275
|
+
X-Frame-Options:
|
276
|
+
- SAMEORIGIN
|
277
|
+
X-Xss-Protection:
|
278
|
+
- 1; mode=block
|
279
|
+
X-Content-Type-Options:
|
280
|
+
- nosniff
|
281
|
+
X-Ua-Compatible:
|
282
|
+
- chrome=1
|
283
|
+
Content-Type:
|
284
|
+
- application/json; charset=utf-8
|
285
|
+
Etag:
|
286
|
+
- '"fcd5209bd44238a795b0e36a01b7870d"'
|
287
|
+
Cache-Control:
|
288
|
+
- max-age=0, private, must-revalidate
|
289
|
+
X-Request-Id:
|
290
|
+
- c64af92a-3ee2-424f-9bcf-77597e73665e
|
291
|
+
X-Runtime:
|
292
|
+
- '0.026270'
|
293
|
+
Server:
|
294
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
295
|
+
Date:
|
296
|
+
- Fri, 14 Mar 2014 13:04:26 GMT
|
297
|
+
Content-Length:
|
298
|
+
- '85'
|
299
|
+
Connection:
|
300
|
+
- Keep-Alive
|
301
|
+
body:
|
302
|
+
encoding: UTF-8
|
303
|
+
string: '{"payment_depot":{"id":2,"min_payment_received":false,"total_received_amount":"0.0"}}'
|
304
|
+
http_version:
|
305
|
+
recorded_at: Fri, 14 Mar 2014 13:04:26 GMT
|
306
|
+
- request:
|
307
|
+
method: get
|
308
|
+
uri: http://localhost:3000/v1/payment_depots/2.json
|
309
|
+
body:
|
310
|
+
encoding: US-ASCII
|
311
|
+
string: ''
|
312
|
+
headers:
|
313
|
+
Accept:
|
314
|
+
- application/json
|
315
|
+
Accept-Encoding:
|
316
|
+
- gzip;q=1.0,deflate;q=0.6,identity;q=0.3
|
317
|
+
User-Agent:
|
318
|
+
- Ruby
|
319
|
+
response:
|
320
|
+
status:
|
321
|
+
code: 200
|
322
|
+
message: 'OK '
|
323
|
+
headers:
|
324
|
+
X-Frame-Options:
|
325
|
+
- SAMEORIGIN
|
326
|
+
X-Xss-Protection:
|
327
|
+
- 1; mode=block
|
328
|
+
X-Content-Type-Options:
|
329
|
+
- nosniff
|
330
|
+
X-Ua-Compatible:
|
331
|
+
- chrome=1
|
332
|
+
Content-Type:
|
333
|
+
- application/json; charset=utf-8
|
334
|
+
Etag:
|
335
|
+
- '"fcd5209bd44238a795b0e36a01b7870d"'
|
336
|
+
Cache-Control:
|
337
|
+
- max-age=0, private, must-revalidate
|
338
|
+
X-Request-Id:
|
339
|
+
- e44b8119-f573-4967-a667-27f1a2d617b9
|
340
|
+
X-Runtime:
|
341
|
+
- '0.012418'
|
342
|
+
Server:
|
343
|
+
- WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
|
344
|
+
Date:
|
345
|
+
- Fri, 14 Mar 2014 13:04:26 GMT
|
346
|
+
Content-Length:
|
347
|
+
- '85'
|
348
|
+
Connection:
|
349
|
+
- Keep-Alive
|
350
|
+
body:
|
351
|
+
encoding: UTF-8
|
352
|
+
string: '{"payment_depot":{"id":2,"min_payment_received":false,"total_received_amount":"0.0"}}'
|
353
|
+
http_version:
|
354
|
+
recorded_at: Fri, 14 Mar 2014 13:04:26 GMT
|
355
|
+
recorded_with: VCR 2.8.0
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
Bundler.setup(:default, :development, :test)
|
2
|
+
require "pry"
|
3
|
+
require "vcr"
|
4
|
+
require "bitsy_client"
|
5
|
+
|
6
|
+
BitsyClient.site = "http://localhost:3000"
|
7
|
+
|
8
|
+
VCR.configure do |c|
|
9
|
+
c.cassette_library_dir = 'spec/fixtures/vcr_cassettes'
|
10
|
+
c.hook_into :webmock
|
11
|
+
c.configure_rspec_metadata!
|
12
|
+
end
|
metadata
ADDED
@@ -0,0 +1,165 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: bitsy_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Ramon Tayag
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2014-03-20 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.3'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.3'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
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: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '2.14'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '2.14'
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: vcr
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - "~>"
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: '2.8'
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - "~>"
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: '2.8'
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: webmock
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - ">="
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - ">="
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: activeresource
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '4.0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '4.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: activesupport
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '4.0'
|
104
|
+
type: :runtime
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - "~>"
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: '4.0'
|
111
|
+
description: Bitsy Client gem used to create and query payment depots
|
112
|
+
email:
|
113
|
+
- ramon.tayag@gmail.com
|
114
|
+
executables: []
|
115
|
+
extensions: []
|
116
|
+
extra_rdoc_files: []
|
117
|
+
files:
|
118
|
+
- ".envrc"
|
119
|
+
- ".gitignore"
|
120
|
+
- ".ruby-version"
|
121
|
+
- Gemfile
|
122
|
+
- LICENSE.txt
|
123
|
+
- README.md
|
124
|
+
- Rakefile
|
125
|
+
- bitsy_client.gemspec
|
126
|
+
- lib/bitsy_client.rb
|
127
|
+
- lib/bitsy_client/models.rb
|
128
|
+
- lib/bitsy_client/models/payment_depot.rb
|
129
|
+
- lib/bitsy_client/models/resource_base.rb
|
130
|
+
- lib/bitsy_client/version.rb
|
131
|
+
- spec/bitsy_client/models/payment_depot_spec.rb
|
132
|
+
- spec/bitsy_client/models/resource_base_spec.rb
|
133
|
+
- spec/bitsy_client_spec.rb
|
134
|
+
- spec/fixtures/vcr_cassettes/BitsyClient_PaymentDepot/communicates_with_Bitsy.yml
|
135
|
+
- spec/spec_helper.rb
|
136
|
+
homepage: ''
|
137
|
+
licenses:
|
138
|
+
- MIT
|
139
|
+
metadata: {}
|
140
|
+
post_install_message:
|
141
|
+
rdoc_options: []
|
142
|
+
require_paths:
|
143
|
+
- lib
|
144
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
145
|
+
requirements:
|
146
|
+
- - ">="
|
147
|
+
- !ruby/object:Gem::Version
|
148
|
+
version: '0'
|
149
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
150
|
+
requirements:
|
151
|
+
- - ">="
|
152
|
+
- !ruby/object:Gem::Version
|
153
|
+
version: '0'
|
154
|
+
requirements: []
|
155
|
+
rubyforge_project:
|
156
|
+
rubygems_version: 2.2.2
|
157
|
+
signing_key:
|
158
|
+
specification_version: 4
|
159
|
+
summary: Interface with the Bitsy Bitcoin payment server
|
160
|
+
test_files:
|
161
|
+
- spec/bitsy_client/models/payment_depot_spec.rb
|
162
|
+
- spec/bitsy_client/models/resource_base_spec.rb
|
163
|
+
- spec/bitsy_client_spec.rb
|
164
|
+
- spec/fixtures/vcr_cassettes/BitsyClient_PaymentDepot/communicates_with_Bitsy.yml
|
165
|
+
- spec/spec_helper.rb
|