lib/rooftop.rb in rooftop-0.0.6 vs lib/rooftop.rb in rooftop-0.0.7.4

- old
+ new

@@ -7,12 +7,12 @@ DEFAULT_API_NAMESPACE = "wp" DEFAULT_API_VERSION = 2 class << self - #accessor to set the preview API for use instead of the production one - attr_accessor :use_preview_api + #accessor to set whether we're in privew mode + attr_accessor :preview, :debug_requests, :debug_responses #access the configuration class as Rooftop.configuration attr_accessor :configuration #block for configuration. @@ -23,11 +23,11 @@ end end class Configuration - attr_accessor :api_token, :url, :site_name, :perform_caching, :cache_store, :cache_logger, :ssl_options, :proxy, :post_type_mapping + attr_accessor :api_token, :url, :site_name, :perform_caching, :cache_store, :cache_logger, :ssl_options, :proxy, :post_type_mapping, :logger attr_reader :connection, :connection_path, :api_path, #actually writeable with custom setter :extra_headers, #actually writeable with custom setter :advanced_options, #actually writeable with custom setter @@ -43,20 +43,17 @@ @cache_store = ActiveSupport::Cache.lookup_store(:memory_store) @cache_logger = nil @ssl_options = {} @proxy = nil @post_type_mapping = {} + @logger = nil end def api_path=(path) @api_path = path || @api_path end - def user_agent=(agent) - @user_agent = agent || @user_agent - end - def extra_headers=(headers) @extra_headers = headers || @extra_headers end def advanced_options=(opts) @@ -78,10 +75,19 @@ raise ArgumentError, "You need to configure Rooftop before instantiating a class with a Rooftop mixin" end @connection_path = "#{@url}#{@api_path}" - @connection.setup url: @connection_path, ssl: @ssl_options, proxy: @proxy do |c| + @connection.setup url: @connection_path, ssl: @ssl_options, proxy: @proxy, send_only_modified_attributes: true do |c| + c.use Rooftop::EmbedMiddleware + + c.use Rooftop::PaginationMiddleware + + if @logger + c.use Rooftop::DebugMiddleware + end + + #Headers c.use Rooftop::Headers # Caching if @perform_caching