Class: KaveRestApi::CountPostalCode
- Inherits:
-
RequestBase
- Object
- RequestBase
- KaveRestApi::CountPostalCode
- Includes:
- Validatable
- Defined in:
- lib/kavenegar-ruby/requests/countpostalcode.rb
Instance Attribute Summary collapse
-
#postalcode ⇒ Object
Returns the value of attribute postalcode.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(args = {}) ⇒ CountPostalCode
constructor
A new instance of CountPostalCode.
Constructor Details
#initialize(args = {}) ⇒ CountPostalCode
Returns a new instance of CountPostalCode.
12 13 14 15 16 17 18 19 |
# File 'lib/kavenegar-ruby/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 |
Instance Attribute Details
#postalcode ⇒ Object
Returns the value of attribute postalcode.
5 6 7 |
# File 'lib/kavenegar-ruby/requests/countpostalcode.rb', line 5 def postalcode @postalcode end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
6 7 8 |
# File 'lib/kavenegar-ruby/requests/countpostalcode.rb', line 6 def response @response end |
Instance Method Details
#call ⇒ Object
23 24 25 26 27 28 29 30 |
# File 'lib/kavenegar-ruby/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 |