lib/pupper/backend.rb in pupper-0.1.1 vs lib/pupper/backend.rb in pupper-0.1.2
- old
+ new
@@ -1,16 +1,21 @@
require 'pupper/parse_json'
module Pupper
+ # Provides an interface to build an API Client, that can be used by [Model]
class Backend
class BaseUrlNotDefined < StandardError; end
attr_reader :client, :model
delegate :base_url, to: :class
class << self
+ # Sets the base URL the API client will call
+ # @return [String] the URL (plus - optionally - a path)
attr_writer :base_url
+
+ protected
def base_url
if @base_url.nil?
raise BaseUrlNotDefined, <<-ERR
Add the following to #{name} to make it work: