Sha256: 27238da6fe1bc9214c408595e334b7ad2d44fdeed60fa6f0c6b80cd291e4e94e

Contents?: true

Size: 697 Bytes

Versions: 7

Compression:

Stored size: 697 Bytes

Contents

require 'emaildirect'
require 'json'

module EmailDirect
  # Represents a database and associated functionality
  class Database
    class << self
      def all
        response = EmailDirect.get '/Databases'
        Hashie::Mash.new(response)
      end

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

    attr_reader :column_name

    def initialize(column_name)
      @column_name = column_name
    end

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

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
emaildirect-1.3.1 lib/emaildirect/database.rb
emaildirect-1.3.0 lib/emaildirect/database.rb
emaildirect-1.2.1 lib/emaildirect/database.rb
emaildirect-1.2.0 lib/emaildirect/database.rb
emaildirect-1.1.0 lib/emaildirect/database.rb
emaildirect-1.0.1 lib/emaildirect/database.rb
emaildirect-1.0.0 lib/emaildirect/database.rb