pyper_rb 1.2.0 → 1.3.0

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: 646bae638d6adae8b2456c3b6cfc07a7d0f0968f
4
- data.tar.gz: 44c1fc2cc772dd12205a052f3e974ecec835d553
3
+ metadata.gz: bbe0e9d75ef82ad036192095dc82f409999427a6
4
+ data.tar.gz: a819f5c7d2278890f9ce052fd2e8b7857f761a36
5
5
  SHA512:
6
- metadata.gz: 29e850650ad4223b4e34920b7fb2d0d87ebc7434e09867bf7d6232f19f1dd43fae76c9fcf7e44c4d83508a838b78854575b3b497790f4b2bc933e128eaddda90
7
- data.tar.gz: 7f741d99c2d945128b6b8c454cfd84d6709d18955b5f0cc29c35dda57b4ca78a448797d68705f5cb352017491f02806387d1e3acbc334b17bdc5f3cc50e81531
6
+ metadata.gz: 82df8f313cf6585c615e4411e13f260233d83e0d1303ff450d325e4ac98ee5941d5170dca7e659a2d64559205e086aaf22afc0fd8cac5180dc2d90c8249d4f55
7
+ data.tar.gz: 577d3a953d375cb8e50f028d00627e6fdf66ce5d64e57f7d505df43574ecdf2916f5fc44b0ccf10d7da5e5054599a944610886a0fd339f27d7f5f726a481c963
@@ -9,6 +9,8 @@ module Pyper::Pipes::Cassandra
9
9
  # @option arguments [Array] :order A pair [clustering_column, :desc|:asc] determining how to order the results.
10
10
  # @option arguments [Object] :paging_state
11
11
  # @option arguments [Integer] :page_size
12
+ # @option arguments [Symbol] :consistency The consistency for the request. Must be
13
+ # one of Cassandra::CONSISTENCIES.
12
14
  # @param status [Hash] The mutable status field
13
15
  # @return [Enumerator::Lazy<Hash>] enumerator of items
14
16
  def pipe(arguments, status = {})
@@ -17,8 +19,12 @@ module Pyper::Pipes::Cassandra
17
19
  paging_state = arguments.delete(:paging_state)
18
20
  order = arguments.delete(:order)
19
21
  columns = arguments.delete(:columns)
22
+ consistency = arguments.delete(:consistency)
20
23
 
21
- opts = (options || {}).merge({ page_size: page_size, paging_state: paging_state})
24
+ opts = options.nil? ? {} : options.dup
25
+ opts[:page_size] = page_size if page_size
26
+ opts[:paging_state] = paging_state if paging_state
27
+ opts[:consistency] = consistency if consistency
22
28
 
23
29
  query = client.select(table, columns).where(arguments)
24
30
  query = query.limit(limit) if limit
data/lib/pyper/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Pyper
2
- VERSION = "1.2.0"
2
+ VERSION = "1.3.0"
3
3
  end
data/test/test_helper.rb CHANGED
@@ -2,6 +2,7 @@ require 'rubygems'
2
2
  require 'pry'
3
3
  require 'minitest/autorun'
4
4
  require 'minitest/should'
5
+ require 'mocha/api'
5
6
 
6
7
  class Minitest::Should::TestCase
7
8
  def self.xshould(*args)
@@ -62,6 +62,17 @@ module Pyper::Pipes::Cassandra
62
62
  assert_equal false, status[:last_page]
63
63
  end
64
64
 
65
+ should "allow custom consistency to be passed for a single request" do
66
+ original_opts = @pipe.client.session.instance_variable_get(:@options)
67
+ refute_equal original_opts.consistency, :all
68
+
69
+ expected_opts_with_all = original_opts.override(:consistency => :all, :arguments => ["id"])
70
+ original_opts.expects(:override).with { |opts| opts[:consistency] == :all }.returns(expected_opts_with_all)
71
+
72
+ out = @pipe.pipe({id: 'id', :consistency => :all}, {})
73
+ assert_equal 2, out.count
74
+ end
75
+
65
76
  context "columns selecting" do
66
77
  should "only select given columns from columns argument" do
67
78
  out = @pipe.pipe({id: 'id', :columns => [:a]}).to_a
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: pyper_rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Arron Norwell
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-02-03 00:00:00.000000000 Z
11
+ date: 2016-02-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -120,7 +120,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
120
120
  version: '0'
121
121
  requirements: []
122
122
  rubyforge_project:
123
- rubygems_version: 2.4.8
123
+ rubygems_version: 2.2.2
124
124
  signing_key:
125
125
  specification_version: 4
126
126
  summary: Create pipelines for storing data.
@@ -145,3 +145,4 @@ test_files:
145
145
  - test/unit/pyper/pipes/model/virtus_deserializer_test.rb
146
146
  - test/unit/pyper/pipes/no_op_test.rb
147
147
  - test/unit/pyper/pipes/remove_fields_test.rb
148
+ has_rdoc: