Class: TicketEvolution::AddressCheck

Inherits:
Endpoint show all
Defined in:
lib/ticket_evolution/address_check.rb

Constant Summary

Constants included from Endpoint::RequestHandler

Endpoint::RequestHandler::CODES

Instance Method Summary collapse

Methods inherited from Endpoint

#base_path, #connection, #endpoint_name, #has_connection?, #id, #initialize, #method_missing

Methods included from SingularClass

#singular_class

Methods included from Endpoint::RequestHandler

#build_request, #collection_handler, #naturalize_response, #raw_handler, #request, #upload_history_handler

Methods inherited from Base

#method_missing

Constructor Details

This class inherits a constructor from TicketEvolution::Endpoint

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class TicketEvolution::Endpoint

Instance Method Details

#check_fields(params = nil, &handler) ⇒ Object



3
4
5
6
7
# File 'lib/ticket_evolution/address_check.rb', line 3

def check_fields(params=nil, &handler)
  handler ||= method(:check_fields_handler)
  params = { endpoint_name.to_sym => [params] } if params.present?
  request(:POST, nil, params, &handler)
end

#check_fields_handler(response) ⇒ Object



9
10
11
12
13
14
15
# File 'lib/ticket_evolution/address_check.rb', line 9

def check_fields_handler(response)
  response.body.merge({
    :status_code => response.response_code,
    :server_message => response.server_message,
    :connection => response.body[:connection]
  })
end