bitsy_client 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 0beb496f9e24d59031d1b6df6e7199fb830db352
4
- data.tar.gz: 8e5b981ec27a069cf9df47d87994aaf62fa2e2a7
3
+ metadata.gz: 61d20a3eca1ed2f85ed4714f22db979f6dcb97d3
4
+ data.tar.gz: 60de3044e08da1a9ea71ed13f11f58e9038c19f0
5
5
  SHA512:
6
- metadata.gz: dbb1b8c1d072173a4bcce2b688a0149ad3187479cb4b8fe0d7ba99176a86cebf6891186d2616c99af96428232df5f57bf7cac7251c78bac7b2da18480f51ca8b
7
- data.tar.gz: b16a38140bef1630e6fe73b173664971c24add83f1342150103c1b26b2d6379be53553013c68c54967029c45eb6cde794c3cc19eee7e4d7b169fbe7750e21dab
6
+ metadata.gz: 8560717239117d62d2617a42b5e17e79bf05e2dabd6fe19f5ede7c22130092c99773b5acf17fa6d24502f29840ac5c4a924c061777b37740fff1a3658e40cde4
7
+ data.tar.gz: 4da53faf2c0fbe5d4b58b30c3a674657fcbb432418f4ef6f461658b4bd216f241e6933096e558e257b533b6ff9b934df1262230cde311c8f4576f1d5b9992dba
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ # v0.2.0
2
+
3
+ - Add `BitsyClient.truncate` to trigger truncation on Bitsy (see [this](https://github.com/ramontayag/bitsy/issues/6))
4
+ - Convert `BitsyClient::Sync.create` to be used as `BitsyClient.sync` instead for brevity
5
+
1
6
  # v0.1.0
2
7
 
3
8
  - Add `BitsyClient::Sync` to trigger a transaction sync manually
data/lib/bitsy_client.rb CHANGED
@@ -18,4 +18,14 @@ module BitsyClient
18
18
  ResourceBase.site = @@site
19
19
  end
20
20
 
21
+ def self.sync
22
+ uri = URI.parse("#{self.site}/syncs")
23
+ Net::HTTP.post_form(uri, {})
24
+ end
25
+
26
+ def self.truncate
27
+ uri = URI.parse("#{self.site}/truncations")
28
+ Net::HTTP.post_form(uri, {})
29
+ end
30
+
21
31
  end
@@ -1,3 +1,3 @@
1
1
  module BitsyClient
2
- VERSION = "0.1.0"
2
+ VERSION = "0.2.0"
3
3
  end
@@ -34,4 +34,26 @@ describe BitsyClient do
34
34
  end
35
35
  end
36
36
 
37
+ describe ".sync" do
38
+ it "triggers the transaction sync on Bitsy" do
39
+ uri = URI.parse("#{described_class.site}/syncs")
40
+ response = double
41
+ expect(Net::HTTP).to receive(:post_form).with(uri, {}).
42
+ and_return(response)
43
+ resulting_response = described_class.sync
44
+ expect(resulting_response).to eq response
45
+ end
46
+ end
47
+
48
+ describe ".truncate" do
49
+ it "truncates the Bitsy database" do
50
+ uri = URI.parse("#{described_class.site}/truncations")
51
+ response = double
52
+ expect(Net::HTTP).to receive(:post_form).with(uri, {}).
53
+ and_return(response)
54
+ resulting_response = described_class.truncate
55
+ expect(resulting_response).to eq response
56
+ end
57
+ end
58
+
37
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bitsy_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ramon Tayag
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-03-22 00:00:00.000000000 Z
11
+ date: 2014-03-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -128,14 +128,11 @@ files:
128
128
  - lib/bitsy_client/models.rb
129
129
  - lib/bitsy_client/models/payment_depot.rb
130
130
  - lib/bitsy_client/models/resource_base.rb
131
- - lib/bitsy_client/models/sync.rb
132
131
  - lib/bitsy_client/version.rb
133
132
  - spec/bitsy_client/models/payment_depot_spec.rb
134
133
  - spec/bitsy_client/models/resource_base_spec.rb
135
- - spec/bitsy_client/models/sync_spec.rb
136
134
  - spec/bitsy_client_spec.rb
137
135
  - spec/fixtures/vcr_cassettes/BitsyClient_PaymentDepot/communicates_with_Bitsy.yml
138
- - spec/fixtures/vcr_cassettes/BitsyClient_Sync/triggers_a_sync_in_Bitsy.yml
139
136
  - spec/spec_helper.rb
140
137
  homepage: ''
141
138
  licenses:
@@ -164,8 +161,6 @@ summary: Interface with the Bitsy Bitcoin payment server
164
161
  test_files:
165
162
  - spec/bitsy_client/models/payment_depot_spec.rb
166
163
  - spec/bitsy_client/models/resource_base_spec.rb
167
- - spec/bitsy_client/models/sync_spec.rb
168
164
  - spec/bitsy_client_spec.rb
169
165
  - spec/fixtures/vcr_cassettes/BitsyClient_PaymentDepot/communicates_with_Bitsy.yml
170
- - spec/fixtures/vcr_cassettes/BitsyClient_Sync/triggers_a_sync_in_Bitsy.yml
171
166
  - spec/spec_helper.rb
@@ -1,5 +0,0 @@
1
- module BitsyClient
2
- class Sync < ResourceBase
3
-
4
- end
5
- end
@@ -1,9 +0,0 @@
1
- module BitsyClient
2
- describe Sync, vcr: {record: :once} do
3
-
4
- it "triggers a sync in Bitsy" do
5
- expect { described_class.create }.to_not raise_error
6
- end
7
-
8
- end
9
- end
@@ -1,52 +0,0 @@
1
- ---
2
- http_interactions:
3
- - request:
4
- method: post
5
- uri: http://localhost:3000/v1/syncs.json
6
- body:
7
- encoding: UTF-8
8
- string: '{"sync":{}}'
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: 200
21
- message: 'OK '
22
- headers:
23
- X-Frame-Options:
24
- - SAMEORIGIN
25
- X-Xss-Protection:
26
- - 1; mode=block
27
- X-Content-Type-Options:
28
- - nosniff
29
- X-Ua-Compatible:
30
- - chrome=1
31
- Content-Type:
32
- - text/html; charset=utf-8
33
- Cache-Control:
34
- - no-cache
35
- X-Request-Id:
36
- - b28c1825-1463-44a0-9233-e8d26c94c322
37
- X-Runtime:
38
- - '0.655866'
39
- Server:
40
- - WEBrick/1.3.1 (Ruby/2.1.1/2014-02-24)
41
- Date:
42
- - Sat, 22 Mar 2014 14:32:52 GMT
43
- Content-Length:
44
- - '0'
45
- Connection:
46
- - Keep-Alive
47
- body:
48
- encoding: UTF-8
49
- string: ''
50
- http_version:
51
- recorded_at: Sat, 22 Mar 2014 14:32:52 GMT
52
- recorded_with: VCR 2.8.0