Class: CyprusPostalCodes::Client

Inherits:
Object
  • Object
show all
Includes:
Addresses, Areas, Districts, GovernmentServices, OccupiedAreas, Paginator, Parcel24Locations, PostOfficeBoxes, Search
Defined in:
lib/cyprus_postal_codes/client.rb,
lib/cyprus_postal_codes/client/areas.rb,
lib/cyprus_postal_codes/client/search.rb,
lib/cyprus_postal_codes/client/addresses.rb,
lib/cyprus_postal_codes/client/districts.rb,
lib/cyprus_postal_codes/client/paginator.rb,
lib/cyprus_postal_codes/client/occupied_areas.rb,
lib/cyprus_postal_codes/client/post_office_boxes.rb,
lib/cyprus_postal_codes/client/parcel24_locations.rb,
lib/cyprus_postal_codes/client/government_services.rb

Defined Under Namespace

Modules: Addresses, Areas, Districts, GovernmentServices, OccupiedAreas, Paginator, Parcel24Locations, PostOfficeBoxes, Search

Instance Method Summary collapse

Methods included from Search

#search

Methods included from PostOfficeBoxes

#post_office_boxes

Methods included from Parcel24Locations

#parcel24_locations

Methods included from Paginator

#first_page, #last_page, #next_page, #previous_page, #total_count, #total_pages

Methods included from OccupiedAreas

#occupied_areas

Methods included from GovernmentServices

#government_services

Methods included from Districts

#districts

Methods included from Areas

#areas

Methods included from Addresses

#addresses

Constructor Details

#initialize(api_key:, lng: "el") ⇒ Client

Returns a new instance of Client.



21
22
23
24
# File 'lib/cyprus_postal_codes/client.rb', line 21

def initialize(api_key:, lng: "el")
  @api_key = api_key
  @lng = lng
end

Instance Method Details

#get(resource, options = {}) ⇒ Object



26
27
28
29
# File 'lib/cyprus_postal_codes/client.rb', line 26

def get(resource, options = {})
  @last_response = connection.get(resource, options.merge(default_params))
  @last_response.body["data"]
end

#last_responseObject



31
32
33
# File 'lib/cyprus_postal_codes/client.rb', line 31

def last_response
  @last_response if defined?(@last_response)
end