tq 0.3.1 → 0.3.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: 6c715d2a759e261f57e2f4f3a745e8c641187e8e
4
- data.tar.gz: a996d693740eb9a6846bc510e178e6c935639b41
3
+ metadata.gz: a8f311dc681edb3e301cf550ef596796c666d98c
4
+ data.tar.gz: e0cb1f8fe6b90e45a7652e1624bb24488d563818
5
5
  SHA512:
6
- metadata.gz: 7c350e6cd8cf00d23926f4bb980af5f8221a6346ba2d3047480dd80ec0052fd81f3441fd0df7b83c26d12bdd6391bfaf8ce39e04a77094acb9c3e689856440c7
7
- data.tar.gz: 44cbccddca8ed63e62e06e629b70c81598e43078df946f507e796821246d547f34fd92d414c8135db76c840ffcf59550ab82a6e043f0d5e7b1e906027f4b0aa6
6
+ metadata.gz: 4015eee818de8172a13d5d5e2e120c59e84b8be0277571a7d99c8865a2b1ffb473b2c78f4a890e64157cc6777cb78128ecdc375ee9704fdfb8e2ee276787ebcd
7
+ data.tar.gz: ddc64156e773e339f31650d1607f3853cad70264bd1a926a0b077c9d43baafabd645966971770071fada8534a08b666896ce0dd55c2c46056a1ea57d3b530b3b
data/.gems CHANGED
File without changes
data/lib/tq.rb CHANGED
@@ -13,14 +13,6 @@ module TQ
13
13
 
14
14
  API_SCOPES = ['https://www.googleapis.com/auth/cloud-tasks' ]
15
15
 
16
- module Utils
17
-
18
- def options_including(keys, options)
19
- options.select { |k,_| keys.include?(k) }
20
- end
21
-
22
- end
23
-
24
16
  class App
25
17
 
26
18
  attr_reader :worker, :queue_in, :queue_out, :queue_err, :logger, :concurrency, :env
@@ -92,14 +84,16 @@ module TQ
92
84
  end
93
85
 
94
86
  class QueueSpec
95
- extend TQ::Utils
96
87
 
97
88
  def self.from_hash(data)
98
89
  return new(
99
90
  data['project'],
100
91
  data['location'],
101
92
  data['name'],
102
- **options_including(['lease_duration','max_tasks'], data)
93
+ **( { lease_duration: data['lease_duration'],
94
+ max_tasks: data['max_tasks']
95
+ }.reject {|k,v| v.nil?}
96
+ )
103
97
  )
104
98
  end
105
99
 
File without changes
@@ -1,4 +1,4 @@
1
1
 
2
2
  module TQ
3
- VERSION = '0.3.1'
3
+ VERSION = '0.3.2'
4
4
  end
File without changes
@@ -1,4 +1,4 @@
1
1
 
2
- %w[ test_auth test_run test_logger ].each do |rb|
2
+ %w[ test_queue_spec test_auth test_run test_logger ].each do |rb|
3
3
  require_relative rb
4
4
  end
File without changes
File without changes
@@ -0,0 +1,31 @@
1
+ require_relative './helper'
2
+ require_relative '../lib/tq'
3
+
4
+ def setup_test_logger!
5
+ TestUtils.setup_logger( File.basename(__FILE__,'.rb') )
6
+ end
7
+
8
+ class QueueSpecTests < Minitest::Spec
9
+
10
+ describe "QueueSpec.from_hash" do
11
+
12
+ it "QueueSpec.from_hash with string keys should work" do
13
+
14
+ q = TQ::QueueSpec.from_hash( {
15
+ 'project' => 'PROJECT',
16
+ 'location' => 'us-central1',
17
+ 'name' => 'QUEUE',
18
+ 'lease_duration' => '200s',
19
+ 'max_tasks' => 1
20
+ })
21
+
22
+ assert_equal '200s', q.lease_duration
23
+ assert_equal 1, q.max_tasks
24
+
25
+ end
26
+
27
+ end
28
+
29
+ end
30
+
31
+
@@ -204,7 +204,7 @@ class AppRunTests < Minitest::Spec
204
204
  ttl2 = task.lease_remaining
205
205
  $stderr.puts "ExtendWorker - ttl before extend: #{ttl}"
206
206
  $stderr.puts "ExtendWorker - ttl after extend: #{ttl2}"
207
- assert_in_delta( 2.5, ttl2, 0.07,
207
+ assert_in_delta( 2.5, ttl2, 0.1,
208
208
  "Expected to be approximately 2.5s"
209
209
  )
210
210
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tq
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Gjertsen
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-01-21 00:00:00.000000000 Z
11
+ date: 2018-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client
@@ -66,6 +66,7 @@ files:
66
66
  - test/suite.rb
67
67
  - test/test_auth.rb
68
68
  - test/test_logger.rb
69
+ - test/test_queue_spec.rb
69
70
  - test/test_run.rb
70
71
  homepage: https://github.com/ericgj/tq
71
72
  licenses:
@@ -87,7 +88,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
88
  version: '0'
88
89
  requirements: []
89
90
  rubyforge_project:
90
- rubygems_version: 2.6.13
91
+ rubygems_version: 2.4.5.1
91
92
  signing_key:
92
93
  specification_version: 4
93
94
  summary: Ruby client for Google Cloud Tasks (REST API v2beta2)