class KaveRestApi::CountPostalCode

Attributes

postalcode[RW]
response[R]

Public Class Methods

new(args = {}) click to toggle source
Calls superclass method KaveRestApi::RequestBase::new
# File lib/kave_rest_api/requests/countpostalcode.rb, line 12
def initialize(args = {})
  super
  @ACTION_NAME    = [:countpostalcode,@FORMAT].join('.').freeze
  @postalcode     = args.fetch(:postalcode)
  @postalcode     = @postalcode.ctsd
  
  @response       = ResponseCountPostalCode.new
end

Public Instance Methods

call() click to toggle source
# File lib/kave_rest_api/requests/countpostalcode.rb, line 23
def call
    connection = Faraday.new(url: "#{API_URL}/sms/") do |faraday|
      faraday.adapter Faraday.default_adapter
      faraday.response FORMAT.to_sym
    end
     response = connection.get(ACTION_NAME,countpostalcode: @countpostalcode)
     @response.validate(response.body)
end