Sha256: 95ace8a686d1f430d74e190a8b8908b1834d22f7191616053c0b86a332096b4d

Contents?: true

Size: 885 Bytes

Versions: 1

Compression:

Stored size: 885 Bytes

Contents

# frozen_string_literal: true

# Performs insight operation
require_relative "termii"
require_relative "client"

module TermiiRuby
  class Insight < TermiiRuby::Termii
    QUERY = "phone_number"

    def initialize(api_key)
      super()
      @client = TermiiRuby::Client.new(api_key)
    end

    def verify; end

    def balance
      @client.make_get_request(GET_BALANCE)
    end

    def search(phone_number, query = {})
      if query.empty?
        query = {
          phone_number: phone_number
        }
      end

      @client.make_get_request(SEARCH, query)
    end

    def status(phone_number, query = {})
      if query.empty?
        query = {
          phone_number: phone_number,
          country_code: @country_code
        }
      end
      @client.make_get_request(STATUS, query)
    end

    def history
      @client.make_get_request(HISTORY)
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
termii_ruby-0.1.0 lib/termii_ruby/insight.rb