Sha256: 9b0cd6e40f9ac4506b90227d3ca1989600cab5a00119984f316e4fb180194d76

Contents?: true

Size: 574 Bytes

Versions: 10

Compression:

Stored size: 574 Bytes

Contents

module Rooftop
  module Client
    def self.included(base)
      if Rooftop.configuration.url.nil?
        raise ArgumentError, "You need to configure Rooftop before instantiating a class with a Rooftop mixin"
      end

      Her::API.setup url: Rooftop.configuration.url do |c|
        #Headers
        c.use Rooftop::Headers

        # Request
        c.use Faraday::Request::UrlEncoded

        # Response
        c.use Her::Middleware::DefaultParseJSON

        # Adapter
        c.use Faraday::Adapter::NetHttp
      end
      base.include Her::Model
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
rooftop-0.1.4.1 lib/rooftop/client.rb
rooftop-0.1.4 lib/rooftop/client.rb
rooftop-0.1.3 lib/rooftop/client.rb
rooftop-0.1.2 lib/rooftop/client.rb
rooftop-0.1.1 lib/rooftop/client.rb
rooftop-0.0.7.4 lib/rooftop/client.rb
rooftop-0.0.6 lib/rooftop/client.rb
rooftop-0.0.5 lib/rooftop/client.rb
rooftop-0.0.3 lib/rooftop/client.rb
rooftop-0.0.1 lib/rooftop_client/client.rb