README.md in cistern-2.2.7 vs README.md in cistern-2.3.0

- old
+ new

@@ -9,11 +9,11 @@ ## Usage ### Custom Architecture -By default a service's `Request`, `Collection`, and `Model` are all classes. In Cistern ~> 3.0, the default will be modules. +By default a service's `Request`, `Collection`, and `Model` are all classes. In cistern `~> 3.0`, the default will be modules. You can modify your client's architecture to be forwards compatible by using `Cistern::Client.with` ```ruby class Foo::Client @@ -56,11 +56,11 @@ while living on a `Prayer` ```ruby class Foo::GetBar < Foo::Prayer def real - service.request.get("/wing") + cistern.request.get("/wing") end end ``` @@ -107,11 +107,11 @@ ### Requests Requests are defined by subclassing `#{service}::Request`. -* `service` represents the associated `Foo::Client` instance. +* `cistern` represents the associated `Foo::Client` instance. ```ruby class Foo::Client::GetBar < Foo::Client::Request def real(params) # make a real request @@ -125,15 +125,15 @@ end Foo::Client.new.get_bar # "i'm real" ``` -The `#service_method` function allows you to specify the name of the generated method. +The `#cistern_method` function allows you to specify the name of the generated method. ```ruby class Foo::Client::GetBars < Foo::Client::Request - service_method :get_all_the_bars + cistern_method :get_all_the_bars def real(params) "all the bars" end end @@ -148,11 +148,11 @@ Foo::Client.requests # => [Foo::Client::GetBars, Foo::Client::GetBar] ``` ### Models -* `service` represents the associated `Foo::Client` instance. +* `cistern` represents the associated `Foo::Client` instance. * `collection` represents the related collection (if applicable) * `new_record?` checks if `identity` is present * `requires(*requirements)` throws `ArgumentError` if an attribute matching a requirement isn't set * `merge_attributes(attributes)` sets attributes for the current model instance @@ -180,11 +180,11 @@ def destroy params = { "id" => self.identity } - self.service.destroy_bar(params).body["request"] + self.cistern.destroy_bar(params).body["request"] end def save requires :keypair_id @@ -194,24 +194,24 @@ "flavor" => self.flavor, }, } if new_record? - merge_attributes(service.create_bar(params).body["bar"]) + merge_attributes(cistern.create_bar(params).body["bar"]) else requires :identity - merge_attributes(service.update_bar(params).body["bar"]) + merge_attributes(cistern.update_bar(params).body["bar"]) end end end ``` ### Collection * `model` tells Cistern which class is contained within the collection. -* `service` is the associated `Foo::Client` instance +* `cistern` is the associated `Foo::Client` instance * `attribute` specifications on collections are allowed. use `merge_attributes` * `load` consumes an Array of data and constructs matching `model` instances ```ruby class Foo::Client::Bars < Foo::Client::Collection @@ -219,11 +219,11 @@ attribute :count, type: :integer model Foo::Client::Bar def all(params = {}) - response = service.get_bars(params) + response = cistern.get_bars(params) data = response.body self.load(data["bars"]) # store bar records in collection self.merge_attributes(data) # store any other attributes of the response on the collection @@ -233,14 +233,14 @@ params = { "provisioned_id" => provisioned_id, } params.merge!("location" => options[:location]) if options.key?(:location) - service.requests.new(service.discover_bar(params).body["request"]) + cistern.requests.new(cistern.discover_bar(params).body["request"]) end def get(id) - if data = service.get_bar("id" => id).body["bar"] + if data = cistern.get_bar("id" => id).body["bar"] new(data) else nil end end