Class: TreasureData::Database
Instance Attribute Summary collapse
-
#count ⇒ Object
readonly
Returns the value of attribute count.
-
#org_name ⇒ Object
readonly
Returns the value of attribute org_name.
Attributes inherited from Model
Instance Method Summary collapse
- #create_item_table(name) ⇒ Object
- #create_log_table(name) ⇒ Object
- #created_at ⇒ Object
- #delete ⇒ Object
-
#initialize(client, db_name, tables = nil, count = nil, created_at = nil, updated_at = nil, org_name = nil) ⇒ Database
constructor
A new instance of Database.
- #name ⇒ Object
- #query(q) ⇒ Object
- #table(table_name) ⇒ Object
- #tables ⇒ Object
- #update_tables! ⇒ Object
- #updated_at ⇒ Object
Constructor Details
#initialize(client, db_name, tables = nil, count = nil, created_at = nil, updated_at = nil, org_name = nil) ⇒ Database
Returns a new instance of Database.
44 45 46 47 48 49 50 51 |
# File 'lib/td/client/model.rb', line 44 def initialize(client, db_name, tables=nil, count=nil, created_at=nil, updated_at=nil, org_name=nil) super(client) @db_name = db_name @tables = tables @count = count @created_at = created_at @updated_at = updated_at end |
Instance Attribute Details
#count ⇒ Object (readonly)
Returns the value of attribute count.
84 85 86 |
# File 'lib/td/client/model.rb', line 84 def count @count end |
#org_name ⇒ Object (readonly)
Returns the value of attribute org_name.
53 54 55 |
# File 'lib/td/client/model.rb', line 53 def org_name @org_name end |
Instance Method Details
#create_item_table(name) ⇒ Object
68 69 70 |
# File 'lib/td/client/model.rb', line 68 def create_item_table(name) @client.create_item_table(@db_name, name) end |
#create_log_table(name) ⇒ Object
64 65 66 |
# File 'lib/td/client/model.rb', line 64 def create_log_table(name) @client.create_log_table(@db_name, name) end |
#created_at ⇒ Object
86 87 88 |
# File 'lib/td/client/model.rb', line 86 def created_at @created_at && !@created_at.empty? ? Time.parse(@created_at) : nil end |
#delete ⇒ Object
76 77 78 |
# File 'lib/td/client/model.rb', line 76 def delete @client.delete_database(@db_name) end |
#name ⇒ Object
55 56 57 |
# File 'lib/td/client/model.rb', line 55 def name @db_name end |
#query(q) ⇒ Object
80 81 82 |
# File 'lib/td/client/model.rb', line 80 def query(q) @client.query(@db_name, q) end |
#table(table_name) ⇒ Object
72 73 74 |
# File 'lib/td/client/model.rb', line 72 def table(table_name) @client.table(@db_name, table_name) end |
#tables ⇒ Object
59 60 61 62 |
# File 'lib/td/client/model.rb', line 59 def tables update_tables! unless @tables @tables end |
#update_tables! ⇒ Object
94 95 96 |
# File 'lib/td/client/model.rb', line 94 def update_tables! @tables = @client.tables(@db_name) end |
#updated_at ⇒ Object
90 91 92 |
# File 'lib/td/client/model.rb', line 90 def updated_at @updated_at && !@updated_at.empty? ? Time.parse(@updated_at) : nil end |