Class: Stargate::Request::RowRequest
- Inherits:
-
BasicRequest
- Object
- BasicRequest
- Stargate::Request::RowRequest
- Defined in:
- lib/stargate/request/row_request.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#table_name ⇒ Object
readonly
Returns the value of attribute table_name.
-
#timestamp ⇒ Object
readonly
Returns the value of attribute timestamp.
Attributes inherited from BasicRequest
Instance Method Summary collapse
- #create(columns = nil) ⇒ Object
- #delete(columns = nil) ⇒ Object
-
#initialize(table_name, name, timestamp = nil) ⇒ RowRequest
constructor
A new instance of RowRequest.
- #show(columns = nil, options = { }) ⇒ Object
Constructor Details
#initialize(table_name, name, timestamp = nil) ⇒ RowRequest
Returns a new instance of RowRequest.
8 9 10 11 12 |
# File 'lib/stargate/request/row_request.rb', line 8 def initialize(table_name, name, =nil) @table_name, @name, @timestamp = CGI.escape(table_name), CGI.escape(name), path = "/#{@table_name}/#{@name}" super(path) end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/stargate/request/row_request.rb', line 5 def name @name end |
#table_name ⇒ Object (readonly)
Returns the value of attribute table_name.
4 5 6 |
# File 'lib/stargate/request/row_request.rb', line 4 def table_name @table_name end |
#timestamp ⇒ Object (readonly)
Returns the value of attribute timestamp.
6 7 8 |
# File 'lib/stargate/request/row_request.rb', line 6 def @timestamp end |
Instance Method Details
#create(columns = nil) ⇒ Object
21 22 23 24 25 |
# File 'lib/stargate/request/row_request.rb', line 21 def create(columns = nil) @path << (columns ? "/#{pack_params(columns)}" : "/") @path << "/#{@timestamp}" if @timestamp @path end |
#delete(columns = nil) ⇒ Object
27 28 29 30 31 |
# File 'lib/stargate/request/row_request.rb', line 27 def delete(columns = nil) @path << (columns ? "/#{pack_params(columns)}" : "/") @path << "/#{@timestamp}" if @timestamp @path end |
#show(columns = nil, options = { }) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/stargate/request/row_request.rb', line 14 def show(columns = nil, = { }) @path << (columns ? "/#{pack_params(columns)}" : "/") @path << "/#{@timestamp}" if @timestamp @path << "?v=#{[:version]}" if [:version] @path end |