Sha256: 3e1446759319ec6c1ed1b0568bc12e801fde00f960399329766078135d8f175e

Contents?: true

Size: 1.48 KB

Versions: 1

Compression:

Stored size: 1.48 KB

Contents

# frozen_string_literal: true

require 'seven_api/resource'

# This module exposes the methods for communicating with the API endpoint /lookup.
module SevenApi::Resources
  class Lookup < SevenApi::Resource
    @endpoint = SevenApi::Endpoint::LOOKUP
    @http_methods = {
      :cnam => :post,
      :format => :post,
      :hlr => :post,
      :mnp => :post,
    }

    # Perform a caller name lookup
    # read more: https://www.seven.io/en/docs/gateway/http-api/cnam-lookup/
    # @param params [Hash]
    # @return [Hash,Array]
    def cnam(params)
      request(params.merge({ :type => SevenApi::Lookup::Type::CNAM }))
    end

    # Retrieve phone number formats
    # read more: https://www.seven.io/en/docs/gateway/http-api/nummernformat-lookup/
    # @param params [Hash]
    # @return [String,Hash]
    def format(params)
      request(params.merge({ :type => SevenApi::Lookup::Type::FORMAT }))
    end

    # Perform a home location register lookup
    # read more: https://www.seven.io/en/docs/gateway/http-api/hlr-lookup/
    # @param params [Hash]
    # @return [Hash,Array]
    def hlr(params)
      request(params.merge({ :type => SevenApi::Lookup::Type::HLR }))
    end

    # Perform a mobile number portability lookup
    # read more: https://www.seven.io/en/docs/gateway/http-api/mnp-lookup/
    # @param params [Hash]
    # @return [Hash,Array]
    def mnp(params)
      request(params.merge({ :type => SevenApi::Lookup::Type::MNP }))
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
seven_api-0.5.0 lib/seven_api/resources/lookup.rb