Sha256: 0f6070d5a8facacf81eb60e8b6d5bfa7885ecc26e370667fcd538fd075c9fc5e

Contents?: true

Size: 1.74 KB

Versions: 3

Compression:

Stored size: 1.74 KB

Contents

module Phaxio
  module Resources
    module Public
      class Country < Resource
        SUPPORTED_COUNTRIES_PATH = 'public/countries'.freeze
        private_constant :SUPPORTED_COUNTRIES_PATH

        # @return [String] the name of the country.
        # @!attribute name

        # @return [String] the alpha2 representation of the country.
        # @!attribute alpha2

        # @return [Integer] the E.164 country code for the country.
        # @!attribute country_code

        # @return [Integer] the price per page for the country, in cents.
        # @!attribute price_per_page

        # @return [String] the level of send support provided for this country.
        # @!attribute send_support

        # @return [String] the level of receive support provided for this country.
        # @!attribute receive_support

        has_normal_attributes %w[
          name alpha2 country_code price_per_page send_support receive_support
        ]

        class << self
          # @macro paging
          # Get a list of supported countries for sending faxes.
          # @param params [Hash]
          #   A hash of parameters to send to Phaxio. This action has no unique
          #   parameters.
          # @return [Phaxio::Resource::Collection<Phaxio::Resources::Country>]
          #   A collection of supported countries.
          # @raise Phaxio::Error::PhaxioError
          # @see https://www.phaxio.com/docs/api/v2.1/public/list_countries
          def list params = {}
            response = Client.request :get, supported_countries_endpoint, params
            Country.response_collection response
          end

          private

          def supported_countries_endpoint
            SUPPORTED_COUNTRIES_PATH
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
phaxio-2.1.2 lib/phaxio/resources/public/country.rb
phaxio-2.1.1 lib/phaxio/resources/public/country.rb
phaxio-2.1.0 lib/phaxio/resources/public/country.rb