sishen-hbase-ruby 0.2 → 0.2.1

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.
data/README.txt CHANGED
@@ -25,6 +25,14 @@ row2 = client.create_row('users', 'sishen', Time.now.to_i, {:name => 'habbit:foo
25
25
  client.delete_row('users', 'sishen', nil, 'habbit:football') # delete the row 'sishen' of table 'users' with the optional column 'habbit:football'
26
26
  }}}
27
27
 
28
+ 3. rails config
29
+
30
+ For those who wants to use hbase in their rails application, can add this line to the environment.rb
31
+
32
+ {{{
33
+ config.gem 'sishen-hbase-ruby', :lib => "hbase", :source => "http://gems.github.com"
34
+ }}}
35
+
28
36
 
29
37
  == INSTALLTION
30
38
  build the gem:
data/hbase-ruby.gemspec CHANGED
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = %q{hbase-ruby}
3
- s.version = "0.2"
3
+ s.version = "0.2.1"
4
4
 
5
5
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
6
6
  s.authors = ["Ye Dingding"]
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
13
13
  s.homepage = %q{http://sishen.lifegoo.com}
14
14
  s.rdoc_options = ["--main", "README.txt"]
15
15
  s.require_paths = ["lib"]
16
- s.rubyforge_project = %q{hbase-ruby}
17
16
  s.rubygems_version = %q{1.2.0}
18
17
  s.summary = %q{a pure ruby client for hbase using REST interface}
19
18
 
@@ -14,15 +14,23 @@ module HBase
14
14
  row
15
15
  end
16
16
 
17
- def create_row(table_name, name, timestamp = nil, data = { })
17
+ def create_row(table_name, name, timestamp = nil, *args)
18
18
  request = Request::RowRequest.new(table_name, name, timestamp)
19
- xml_data =<<EOF
20
- <?xml version='1.0' encoding='UTF-8'?>
21
- <column>
22
- <name>#{data[:name]}</name>
23
- <value>#{[data[:value]].pack("m")}</value>
24
- </column>
25
- EOF
19
+ data = []
20
+ if args.instance_of? Array
21
+ data = args
22
+ elsif args.instance_of? Hash
23
+ data = [args]
24
+ else
25
+ raise StandardError, "Only Array or Hash data accepted"
26
+ end
27
+ xml_data ="<?xml version='1.0' encoding='UTF-8'?><columns>"
28
+ data.each do |d|
29
+ xml_data << "<column><name>#{d[:name]}</name>"
30
+ xml_data << "<value>#{[d[:value]].pack("m") rescue ''}</value></column>"
31
+ end
32
+ xml_data << "</columns>"
33
+
26
34
  Response::RowResponse.new(post(request.create, xml_data))
27
35
  end
28
36
 
@@ -18,7 +18,8 @@ module HBase
18
18
  columns = [columns]
19
19
  elsif columns.is_a? Array
20
20
  end
21
- @path << "?column=#{columns.join(';')}"
21
+ params = columns.collect { |column| "column=#{column}" }.join('&')
22
+ @path << "?#{params}"
22
23
  end
23
24
  @path
24
25
  end
@@ -33,7 +34,8 @@ module HBase
33
34
  columns = [columns]
34
35
  elsif columns.is_a? Array
35
36
  end
36
- @path << "?column=#{columns.join(';')}"
37
+ params = columns.collect { |column| "column=#{column}" }.join('&')
38
+ @path << "?#{params}"
37
39
  end
38
40
  @path
39
41
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sishen-hbase-ruby
3
3
  version: !ruby/object:Gem::Version
4
- version: "0.2"
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ye Dingding
@@ -84,7 +84,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
84
84
  version:
85
85
  requirements: []
86
86
 
87
- rubyforge_project: hbase-ruby
87
+ rubyforge_project:
88
88
  rubygems_version: 1.2.0
89
89
  signing_key:
90
90
  specification_version: 2