Class: Ravendb::Api::Client
- Inherits:
-
Object
- Object
- Ravendb::Api::Client
- Defined in:
- lib/ravendb/api/client.rb
Instance Attribute Summary collapse
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Instance Method Summary collapse
-
#create_database(name:, options: {}) ⇒ Object
$body = @{ Settings = @{ “Raven/DataDir” = “~Databases$RavenDatabaseName” “Raven/ActiveBundles” = “PeriodicBackup;DocumentExpiration;SqlReplication” } Disabled = $false }.
- #database_exists?(name:) ⇒ Boolean
- #databases ⇒ Object
-
#delete_database(name:) ⇒ Object
Invoke-RestMethod -Uri $($HostName):$($Port)/admin/databases/$RavenDatabaseName`?hard-delete=true -Method Delete.
- #get_database(name:) ⇒ Object
-
#initialize(url:) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(url:) ⇒ Client
Returns a new instance of Client.
13 14 15 |
# File 'lib/ravendb/api/client.rb', line 13 def initialize(url:) @url = URI(url) end |
Instance Attribute Details
#url ⇒ Object (readonly)
Returns the value of attribute url.
11 12 13 |
# File 'lib/ravendb/api/client.rb', line 11 def url @url end |
Instance Method Details
#create_database(name:, options: {}) ⇒ Object
$body = @{
Settings = @{
"Raven/DataDir" = "~\Databases\$RavenDatabaseName"
“Raven/ActiveBundles” = “PeriodicBackup;DocumentExpiration;SqlReplication” } Disabled = $false }
Invoke-RestMethod -Uri $($HostName):$($Port)/admin/databases/$RavenDatabaseName -Method PUT -Body (ConvertTo-Json $body) test(options: { Settings: ‘test’}) test(options: { :Settings => ‘test’})
40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/ravendb/api/client.rb', line 40 def create_database(name:, options: {}) = { Settings: { 'Raven/ActiveBundles': '', 'Raven/DataDir': "~/#{name}" }, Disabled: false } = .merge() put(url: @url + create_delete_database_endpoint() + name, json_hash: ) end |
#database_exists?(name:) ⇒ Boolean
25 26 27 |
# File 'lib/ravendb/api/client.rb', line 25 def database_exists?(name:) databases.include?(name) end |
#databases ⇒ Object
17 18 19 |
# File 'lib/ravendb/api/client.rb', line 17 def databases get(url: @url + get_databases_endpoint()) end |
#delete_database(name:) ⇒ Object
Invoke-RestMethod -Uri $($HostName):$($Port)/admin/databases/$RavenDatabaseName`?hard-delete=true -Method Delete
53 54 55 |
# File 'lib/ravendb/api/client.rb', line 53 def delete_database(name:) delete(url: @url + create_delete_database_endpoint() + name) end |
#get_database(name:) ⇒ Object
21 22 23 |
# File 'lib/ravendb/api/client.rb', line 21 def get_database(name:) get(url: @url + create_delete_database_endpoint() + name) end |