Method: NationBuilder::Client#initialize
- Defined in:
- lib/nationbuilder/client.rb
#initialize(nation_name, api_key, opts = {}) ⇒ Client
Returns a new instance of Client.
3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/nationbuilder/client.rb', line 3 def initialize(nation_name, api_key, opts = {}) @nation_name = nation_name @api_key = api_key @name_to_endpoint = {} @base_url = opts[:base_url] || 'https://:nation_name.nationbuilder.com' @retries = opts[:retries] || 8 @http_client = opts[:http_client] || HTTPClient.new if @retries < 0 raise 'Retries must be at least zero' end parsed_endpoints.each do |endpoint| @name_to_endpoint[endpoint.name] = endpoint end end |