lib/wcc/contentful/simple_client.rb in wcc-contentful-1.6.2 vs lib/wcc/contentful/simple_client.rb in wcc-contentful-1.7.0

- old
+ new

@@ -24,11 +24,11 @@ # # @api Client class SimpleClient include WCC::Contentful::Instrumentation - attr_reader :api_url, :space + attr_reader :api_url, :space, :environment # Creates a new SimpleClient with the given configuration. # # @param [String] api_url the base URL of the Contentful API to connect to # @param [String] space The Space ID to access @@ -52,12 +52,13 @@ @query_defaults = {} # default 1.5 so that we retry one time then fail if still rate limited # https://www.contentful.com/developers/docs/references/content-preview-api/#/introduction/api-rate-limits @rate_limit_wait_timeout = @options[:rate_limit_wait_timeout] || 1.5 - return unless options[:environment].present? + @environment = options[:environment] + return unless @environment.present? - @api_url = URI.join(@api_url, 'environments/', "#{options[:environment]}/") + @api_url = URI.join(@api_url, 'environments/', "#{@environment}/") end # performs an HTTP GET request to the specified path within the configured # space and environment. Query parameters are merged with the defaults and # appended to the request.