dropzone_ruby 0.1.2 → 0.1.3

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: 002a3c52fb4d1c4a622a1912b359adeffb2b4d9b
4
- data.tar.gz: 0d6e7f4f848e95e507eac992dd75596b1e0a9841
3
+ metadata.gz: e1b7b2c5315e091f51cac362b232d3c3512fc746
4
+ data.tar.gz: 5030f97c3474a1a7646ccf478d651cd053594fcd
5
5
  SHA512:
6
- metadata.gz: 730eeb352aa24143eb363539eddc34849b6c7e81479d10275e5744461ce8985770bea4364f051bd498652bfae089f9a64dfef15f6d0cd586213daf203222a6e0
7
- data.tar.gz: bb721453be95e7e21992a5ce6e8dabf468a83f86ed05695fd0d13e83de9e8ad8d50b1e55e979b46b3b0f70c9b21029ce8a65e841b7ce8c0d118afa9fa1685ef0
6
+ metadata.gz: 4475a7296863b5ba323521176845709eb98edabcb2df7a33c1e37dd76e31e23a8ae64c93e1216022e57649733c8743ad2ae083dfa3d0e84662a07903c7d8eedf
7
+ data.tar.gz: 36bbddc69a5f483be6c7b5d42956bb01cf73deca38346bdf669cac09a2fdde229418f3729c99cd577db082d47fe0996c61eb156e369a0c90b7872e11f3cbef68
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- dropzone_ruby (0.1.2)
4
+ dropzone_ruby (0.1.3)
5
5
  commander (~> 4.3)
6
6
  counterparty_ruby (~> 1.2)
7
7
  sequel (~> 4.21)
data/README.md CHANGED
@@ -19,6 +19,10 @@ Find a list of commands with:
19
19
 
20
20
  $ dropzone help
21
21
 
22
+ Online help for individual commands can be obtained like so (example for `chat list`):
23
+
24
+ $ dropzone help chat list
25
+
22
26
  Fund a testnet key with tBTC or a mainnet key with BTC
23
27
 
24
28
  Create a seller or buyer profile
@@ -133,16 +133,16 @@ command 'listing find' do |c|
133
133
  c.example 'Find listings in block 371812',
134
134
  'dropzone listing find 0 --start_at 371812'
135
135
 
136
- c.option '--latitude LAT ', Float,
136
+ c.option '--latitude LAT', Float,
137
137
  'The approximate latitude of your location.'
138
- c.option '--longitude LON ', Float,
138
+ c.option '--longitude LON', Float,
139
139
  'The approximate longitude of your location.'
140
- c.option '--radius METERS ', Integer, multi(<<-eos)
140
+ c.option '--radius METERS', Integer, multi(<<-eos)
141
141
  The approximate diameter you wish to search around the provided
142
142
  latitude and longitude. The expected unit of distance is in meters.
143
143
  eos
144
144
 
145
- c.option '--start_at BLOCKHEIGHT ', Integer, multi(<<-eos)
145
+ c.option '--start_at BLOCKHEIGHT', Integer, multi(<<-eos)
146
146
  Start searching from the specified block height until <block_depth>
147
147
  'blocks down'. The default behavior is to start at the current blockchain
148
148
  height.
@@ -164,9 +164,9 @@ def listing_create_update_options(cmd)
164
164
  A three or four digit currency identifier. Common values would include
165
165
  'BTC' or 'USD', though any identifier can be specified
166
166
  eos
167
- cmd.option '--price_in_units PRICE ', Integer,
167
+ cmd.option '--price_in_units PRICE', Integer,
168
168
  'The price of the specified item denominated in cents, or satoshis, etc.'
169
- cmd.option '--expiration_in NBLOCKS ', Integer, multi(<<-eos)
169
+ cmd.option '--expiration_in NBLOCKS', Integer, multi(<<-eos)
170
170
  The expiration time of the item. "Times" are to be indicated in the number
171
171
  of blocks that this listing is available for. Omitting this field indicates
172
172
  no expiration. Note that clients will likely override the seller's
@@ -349,7 +349,7 @@ command 'invoice create' do |c|
349
349
 
350
350
  c.option '--amount_due BTC', String,
351
351
  'Amount due, denominated in Bitcoin (ie "0.5")'
352
- c.option '--expiration_in NBLOCKS ', Integer, multi(<<-eos)
352
+ c.option '--expiration_in NBLOCKS', Integer, multi(<<-eos)
353
353
  The expiration time of the invoice. "Times" are to be indicated in the number
354
354
  of blocks that this listing is available for. Omitting this field indicates
355
355
  no expiration. Specifying an expiration is useful for locking in an exchange
@@ -380,7 +380,7 @@ command 'review create' do |c|
380
380
 
381
381
  c.example 'Review a purchase:', multi(<<-eos) % [RANDOM_TXID]
382
382
  dropzone review create
383
- --description: 'Fair exchange"
383
+ --description: "Fair exchange"
384
384
  --delivery_quality 8,
385
385
  --product_quality 8
386
386
  --communications_quality 4
@@ -394,7 +394,7 @@ command 'review create' do |c|
394
394
  'The quality of the delivery itself. Between 0 (worst) to 8 (best)'
395
395
 
396
396
  c.option '--product_quality N', Integer,
397
- 'The quality of the product. Between 0 (worst) to 8 (best)'
397
+ 'The quality of the product. Between 0 (worst) to 8 (best)'
398
398
 
399
399
  c.option '--communications_quality N', Integer,
400
400
  "The seller's communications skill. Between 0 (worst) to 8 (best)"
@@ -443,7 +443,7 @@ command 'chat say' do |c|
443
443
 
444
444
  c.syntax, c.summary, c.description =
445
445
  'dropzone chat say <private_key> <tx_id> <message>',
446
- 'Communicate to another party in a private/encrypted conversation over testnet.',
446
+ 'Communicate to another party in a private/encrypted conversation over testnet',
447
447
  multi(<<-eos)
448
448
  Append to the conversation <tx_id> at your testnet address <private> key
449
449
  say the provided <message> to a receiving party.
@@ -108,10 +108,17 @@ class DropZoneCommand
108
108
 
109
109
  message = klass.new params
110
110
 
111
- txid = message.save! privkey.to_base58
111
+ if (message.valid?)
112
+ txid = message.save! privkey.to_base58
112
113
 
113
- puts_object '%s: %s' % [label, message.receiver_addr], 'Tx: %s' % txid, attributes,
114
- message
114
+ puts_object '%s: %s' % [label, message.receiver_addr],
115
+ 'Tx: %s' % txid, attributes, message
116
+ else
117
+ puts "Errors Found in %s:" % label
118
+ message.errors.each_pair do |attr, reasons|
119
+ puts ' * "%s": %s' % [attr, reasons.join(', ')]
120
+ end
121
+ end
115
122
  end
116
123
  end
117
124
 
@@ -115,7 +115,7 @@ module Dropzone
115
115
 
116
116
  def address_parts(addr, part)
117
117
  parts = HASH_160_PARTS.match(addr)
118
- (parts.length > 0) ? parts[part+1].tr('X','0').to_i : nil
118
+ (parts && parts.length > 0) ? parts[part+1].tr('X','0').to_i : nil
119
119
  end
120
120
 
121
121
  def latlon_to_integer(lat_or_lon, unsigned_offset = 90)
@@ -1,4 +1,4 @@
1
1
  module Dropzone
2
2
  # The library version string
3
- VERSION = "0.1.2"
3
+ VERSION = "0.1.3"
4
4
  end
@@ -9,8 +9,8 @@ describe Dropzone do
9
9
 
10
10
  before(:all) do
11
11
  Bitcoin.network = :testnet3
12
- TCPSocket::socks_server = "127.0.0.1"
13
- TCPSocket::socks_port = 9050
12
+ #TCPSocket::socks_server = "127.0.0.1"
13
+ #TCPSocket::socks_port = 9050
14
14
  # Socksify::debug = true
15
15
  #RestClient.log = Logger.new STDOUT
16
16
 
@@ -290,5 +290,45 @@ describe Dropzone::Item do
290
290
  end
291
291
  end
292
292
 
293
+ describe "problematic decodes" do
294
+ # @Junseth Issue #18:
295
+ # txid: 73cfb35e1e6bb31b3ddffb41322c46f155970bfae3c40385b171ba02f88985a0
296
+ it "Fails to decode invalid radius transaction" do
297
+ tx_id = '73cfb35e1e6bb31b3ddffb41322c46f155970bfae3c40385b171ba02f88985a0'
298
+ tx_hex = '01000000017ecf3bcdd734881a466b2fcb8ff9c602ff96190ecbda86fadd2'+
299
+ 'f907bfeb7f22a020000006b4830450221008b343292dbc140379bdcdad613fd8bd2b'+
300
+ 'e739147a10f57b5dd3f6c23afe818e402201edbe946b27a0183a3d98ce61f0f88872'+
301
+ '1330c8694f8b700448d8c902317db4c0121031bf0b235cb0cefcf8c9c299f3009257'+
302
+ '04d6da7e6b448bd185c80d28f1216ef44ffffffff0536150000000000001976a9141'+
303
+ 'f319c85b0cb2667e09fc4388dc209b0c4a240d388ac3615000000000000695121039'+
304
+ 'fb679314a062d887537ad75b6e056bd4020807e56d742cd0aa77bf890aea5e121027'+
305
+ 'fdb01ce03a72c67551b80e18a612a4789a6b3d168e4ca883dd7236d2c19b60f21031'+
306
+ 'bf0b235cb0cefcf8c9c299f300925704d6da7e6b448bd185c80d28f1216ef4453ae3'+
307
+ '615000000000000695121039fb679166a6b5f8f5951a77ef1a258a50368c22f5dd15'+
308
+ '9dc07a824a29dacaa0a21026bdb01e004a62f2f7b1cceecde622814d2fdb4d63ca5c'+
309
+ '8d1668e2d78263defb421031bf0b235cb0cefcf8c9c299f300925704d6da7e6b448b'+
310
+ 'd185c80d28f1216ef4453ae361500000000000069512103aeb679311f267c896372c'+
311
+ '86b8b823adc234ba05d34b631a868c61794bdcdc48221030ffb228a71c85c4a0f74e'+
312
+ 'e84aa16582efdd2d6bf488ba4a849bf464d4a6bd93021031bf0b235cb0cefcf8c9c2'+
313
+ '99f300925704d6da7e6b448bd185c80d28f1216ef4453ae2cf41100000000001976a'+
314
+ '9142bb8d14d65d316483e24da5512bfd2a977da85ea88ac00000000'
315
+
316
+ tx = Bitcoin::P::Tx.new [tx_hex].pack('H*')
317
+
318
+ record = Counterparty::TxDecode.new tx,
319
+ prefix: Dropzone::BitcoinConnection::PREFIX
320
+
321
+ item = Dropzone::Item.new(data: record.data,
322
+ receiver_addr: record.receiver_addr,
323
+ txid: tx_id, sender_addr: record.sender_addr)
293
324
 
325
+ expect(item.valid?).to eq(false)
326
+ expect(item.errors.count).to eq(3)
327
+ expect(item.errors.on(:latitude)).to eq(['is not a number'])
328
+ expect(item.errors.on(:longitude)).to eq(['is not a number'])
329
+ expect(item.errors.on(:radius)).to eq(['is not a number'])
330
+
331
+ end
332
+
333
+ end
294
334
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dropzone_ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Miracle Max
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-09-27 00:00:00.000000000 Z
11
+ date: 2015-12-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: counterparty_ruby