Module: Address::Io::ApiOperations::Retrieve

Included in:
Address::Io::Addresses
Defined in:
lib/address/io/api_operations/retrieve.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(base) ⇒ Object



11
12
13
# File 'lib/address/io/api_operations/retrieve.rb', line 11

def self.included(base)
  base.extend(Retrieve)
end

Instance Method Details

#retrieve(postal_code = nil) ⇒ Object



5
6
7
8
9
# File 'lib/address/io/api_operations/retrieve.rb', line 5

def retrieve(postal_code=nil)
  return nil unless postal_code
  postal_code = "?postal_code=#{postal_code}" if postal_code.include? '@'
  api_request("#{url}/#{postal_code}", :get)
end