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

- old
+ new

@@ -7,23 +7,39 @@ DEFAULT_API_NAMESPACE = "wp" DEFAULT_API_VERSION = 2 class << self - #accessor to set whether we're in privew mode - attr_accessor :preview, :debug_requests, :debug_responses + extend Gem::Deprecate + #accessor to set whether we need to debug responses + attr_accessor :debug_requests, :debug_responses + # accessor to set whether to include drafts + attr_accessor :include_drafts + #access the configuration class as Rooftop.configuration attr_accessor :configuration #block for configuration. def configure self.configuration ||= Configuration.new yield(configuration) self.configuration.configure_connection end + ################## + # We're deprecating Rooftop.preview, because Rooftop previews are done per instance. + def preview=(preview) + @include_drafts = preview + end + + def preview + @include_drafts + end + deprecate :preview=, :include_drafts=, 2016, 07 + deprecate :preview, :include_drafts, 2016, 07 + ################## end class Configuration attr_accessor :api_token, :url, :site_name, :perform_caching, :cache_store, :cache_logger, :ssl_options, :proxy, :post_type_mapping, :logger attr_reader :connection, @@ -61,9 +77,11 @@ end def user_agent=(agent) @user_agent = agent || @user_agent end + + # Return the Configuration object as a hash, with symbols as keys. # @return [Hash] def to_hash Hash[instance_variables.map { |name| [name.to_s.gsub("@","").to_sym, instance_variable_get(name)] } ]