Class: EmailDirect::Database

Inherits:
Object
  • Object
show all
Defined in:
lib/emaildirect/database.rb

Overview

Represents a database and associated functionality

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(column_name) ⇒ Database

Returns a new instance of Database.



22
23
24
# File 'lib/emaildirect/database.rb', line 22

def initialize(column_name)
  @column_name = column_name
end

Instance Attribute Details

#column_nameObject (readonly)

Returns the value of attribute column_name.



20
21
22
# File 'lib/emaildirect/database.rb', line 20

def column_name
  @column_name
end

Class Method Details

.allObject



8
9
10
11
# File 'lib/emaildirect/database.rb', line 8

def all
  response = EmailDirect.get '/Database'
  Hashie::Mash.new(response)
end

.create(name, options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/emaildirect/database.rb', line 13

def create(name, options = {})
  options.merge! :ColumnName => name
  response = EmailDirect.post '/Database', :body => options.to_json
  Hashie::Mash.new(response)
end

Instance Method Details

#detailsObject



26
27
28
29
# File 'lib/emaildirect/database.rb', line 26

def details
  response = EmailDirect.get "/Database/#{column_name}"
  Hashie::Mash.new(response)
end