Sha256: 6c2724a8c29bc8e9f334d841882954bab690a232ad533dea84b102c823934f6d

Contents?: true

Size: 694 Bytes

Versions: 4

Compression:

Stored size: 694 Bytes

Contents

require 'emaildirect'
require 'json'

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

      def create(name, options = {})
        options.merge! :ColumnName => name
        response = EmailDirect.post '/Database', :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 "/Database/#{column_name}"
      Hashie::Mash.new(response)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
emaildirect-2.0.0 lib/emaildirect/database.rb
emaildirect-1.3.4 lib/emaildirect/database.rb
emaildirect-1.3.3 lib/emaildirect/database.rb
emaildirect-1.3.2 lib/emaildirect/database.rb