Sha256: 9950e5e495ac5e7b96d1eda42b32d6d10cc7ba98ccc83b8e5a75ada6322447d1
Contents?: true
Size: 988 Bytes
Versions: 1
Compression:
Stored size: 988 Bytes
Contents
module TeamcityRuby module Resource def client TeamcityRuby end def locator(options) raise(ArgumentError, "the Locator must be a Hash") unless options.is_a? Hash options.map { |key, value| "#{key}:#{URI.escape(value.to_s)}" }.join end def url_path(url_path) @url_path = url_path end def resource_name(resource_name) @resource_name = resource_name end def all client.get(@url_path)[@resource_name].map do |b| new(b) end end def find(options = {}) response = client.get("#{@url_path}/#{locator(options)}") return nil if ( response.body =~ /NotFoundException/ ) new(response) end module InstanceMethods def client self.class.client end def ==(other) self.class == other.class && self.teamcity_id == other.teamcity_id end end def self.extended(base) base.send(:include, InstanceMethods) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
teamcity_ruby-0.0.6 | lib/teamcity_ruby/resource.rb |