lib/ridley/resources/data_bag.rb in ridley-0.3.2 vs lib/ridley/resources/data_bag.rb in ridley-0.4.0
- old
+ new
@@ -1,9 +1,9 @@
module Ridley
- # @api private
# @author Jamie Winsor <jamie@vialstudios.com>
- class DBIContext
+ # @api private
+ class DBIChainLink
attr_reader :data_bag
attr_reader :connection
# @param [Ridley::DataBag] data_bag
def initialize(data_bag, connection)
@@ -42,34 +42,34 @@
# if a resource with the given chef_id is not found
#
# @return [Ridley::DataBag]
def find!(connection, object)
chef_id = object.respond_to?(:chef_id) ? object.chef_id : object
- name, uri = connection.get("#{self.resource_path}/#{chef_id}").body.first
- new(connection, name: name)
+ connection.get("#{self.resource_path}/#{chef_id}")
+ new(connection, name: chef_id)
end
end
set_chef_id "name"
set_resource_path "data"
attribute :name
validates_presence_of :name
def item
- @dbi_context ||= DBIContext.new(self, connection)
+ @dbi_link ||= DBIChainLink.new(self, connection)
end
end
module DSL
# Coerces instance functions into class functions on Ridley::DataBag. This coercion
# sends an instance of the including class along to the class function.
#
- # @see Ridley::Context
+ # @see Ridley::ChainLink
#
- # @return [Ridley::Context]
+ # @return [Ridley::ChainLink]
# a context object to delegate instance functions to class functions on Ridley::DataBag
def data_bag
- Context.new(Ridley::DataBag, self)
+ ChainLink.new(self, Ridley::DataBag)
end
end
end