lib/pmp/token.rb in pmp-0.5.0 vs lib/pmp/token.rb in pmp-0.5.1

- old
+ new

@@ -5,18 +5,22 @@ module PMP class Token include Configuration + attr_accessor :root + def initialize(options={}, &block) apply_configuration(options) + self.root = current_options.delete(:root) + yield(self) if block_given? end def token_url - root_document.auth['urn:collectiondoc:form:issuetoken'].url + root.auth['urn:collectiondoc:form:issuetoken'].url end def get_token oauth_options = { site: endpoint, @@ -48,10 +52,10 @@ # clean out any that don't belong options.select{|k,v| PMP::Connection::ALLOWED_CONNECTION_OPTIONS.include?(k.to_sym)} end - def root_document + def root @root ||= PMP::CollectionDocument.new(current_options.merge(href: endpoint)) end end end