stampery 0.1.1 → 0.1.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d80c3a9ebfb800c25cae888c6247d043ab17e811
4
- data.tar.gz: 268588272064d6d0ae6c77b97fbf5b9835ac6c6d
3
+ metadata.gz: 1534e27adafd15f44bbb8906d184a4b46bf7c6e1
4
+ data.tar.gz: 5575bcb669a5366ef27d3e68c149086a256119f5
5
5
  SHA512:
6
- metadata.gz: c91281e106ba86eb29d1e6fef3b5882b599b489f64f36ef27e0fa318216a84d2cd9cab27a8504ef6c8bc8069404bb56449b55ab4c3c0d7d0fe6cca2c87f75431
7
- data.tar.gz: b27b29d9fea673c42cfc1eb1b713379ef5e934a1912ccc5adfbf1a65e021e58130759545e1667d496ce3f23ecb7b7bbbe2415a84282ff6ee5e0f48f8a92158d5
6
+ metadata.gz: ecb7ab3c49a2e65a54ac84215182d610f28912265f36102e274d0ba41bbeb0b789bd9d4adefe9799a621bc1c2fde94207d06b6424ec024f6114cf86fd56df352
7
+ data.tar.gz: 9c15da2e5a4ecc0072e6694f8ecf98a4a559222c3789e2be3847a3dc34211a0f58d52a026dfe102ac26abcd419b436bc68444c72e3fea47b3542da2aa2730ea7
data/README.md CHANGED
@@ -21,7 +21,8 @@ Or install it yourself as:
21
21
  ```ruby
22
22
  require 'stampery'
23
23
 
24
- stampery = Client.new '2d4cdee7-38b0-4a66-da87-c1ab05b43768'
24
+ # Sign up and get your secret token at https://api-dashboard.stampery.com
25
+ stampery = Client.new 'user-secret'
25
26
 
26
27
  stampery.on :proof do |hash, proof|
27
28
  puts 'Received proof for'
data/example.rb ADDED
@@ -0,0 +1,22 @@
1
+ require 'stampery'
2
+
3
+ # Sign up and get your secret token at https://api-dashboard.stampery.com
4
+ stampery = Client.new 'user-secret'
5
+
6
+ stampery.on :proof do |hash, proof|
7
+ puts 'Received proof for'
8
+ puts hash
9
+ puts 'Proof'
10
+ puts proof.to_s
11
+ end
12
+
13
+ stampery.on :error do |err|
14
+ puts "Woot: #{err}"
15
+ end
16
+
17
+ stampery.on :ready do
18
+ digest = stampery.hash 'Hello, blockchain!'
19
+ stampery.stamp digest
20
+ end
21
+
22
+ stampery.start
data/lib/stampery.rb CHANGED
@@ -22,7 +22,9 @@ class Client
22
22
 
23
23
  def start
24
24
  api_login @api_end_point
25
- amqp_login @amqp_end_point
25
+ if @auth
26
+ amqp_login @amqp_end_point
27
+ end
26
28
  end
27
29
 
28
30
  def stamp data
@@ -46,7 +48,11 @@ class Client
46
48
  req = @api_client.call_async('stampery.3.auth', @client_id, @client_secret, user_agent)
47
49
  req.join
48
50
  @auth = req.result
49
- puts "logged #{@client_id}"
51
+ if @auth
52
+ puts "logged #{@client_id}"
53
+ else
54
+ emit :error, "Couldn't log in"
55
+ end
50
56
  end
51
57
 
52
58
  def amqp_login end_point
data/stampery.gemspec CHANGED
@@ -5,7 +5,7 @@ require 'stampery/version'
5
5
 
6
6
  Gem::Specification.new do |spec|
7
7
  spec.name = "stampery"
8
- spec.version = "0.1.1"
8
+ spec.version = "0.1.2"
9
9
  spec.authors = ["Johann Ortiz"]
10
10
  spec.email = ["johann@stampery.com"]
11
11
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: stampery
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Johann Ortiz
@@ -120,6 +120,7 @@ files:
120
120
  - Rakefile
121
121
  - bin/console
122
122
  - bin/setup
123
+ - example.rb
123
124
  - lib/stampery.rb
124
125
  - lib/stampery/version.rb
125
126
  - stampery.gemspec