Sha256: 7278a98b21bfc40a62689cfc8e37d3d88e7e434c03e46d92d5a045c00fcd72be

Contents?: true

Size: 871 Bytes

Versions: 1

Compression:

Stored size: 871 Bytes

Contents

module TextMagic

  class API

    def initialize(username, password)
      @username = username
      @password = password
    end

    def account
      response = Executor.execute('account', @username, @password)
      response['balance'] = response['balance'].to_f
      response
    end

    def send(text, *args)
      options = args.last.is_a?(Hash) ? args.pop : {}
      phones = args.flatten.join(',')
      Executor.execute('send', @username, @password, options.merge(:text => text, :phone => phones))
    end

    def message_status(*ids)
      Executor.execute('message_status', @username, @password, :ids => ids.flatten.join(','))
    end

    def receive
      Executor.execute('receive', @username, @password)
    end

    def delete_reply(*ids)
      Executor.execute('delete_reply', @username, @password, :ids => ids.flatten.join(','))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bobes-textmagic-0.1.0 lib/api.rb