Sha256: 3cb116162c1cb89dd3dc2fe9704252799cd25bf260766d292386259f5dccc9c5
Contents?: true
Size: 1.02 KB
Versions: 1
Compression:
Stored size: 1.02 KB
Contents
module NightcrawlerSwift class Command def connection NightcrawlerSwift.connection.tap do |conn| conn.connect! unless conn.connected? end end def options NightcrawlerSwift.options end def execute raise NotImplemented.new end protected def get url, params = {} prepare_params params resource = resource_for url resource.get(params[:headers]) end def put url, params = {} prepare_params params resource = resource_for url resource.put(params[:body], params[:headers]) end def delete url, params prepare_params params resource = resource_for url resource.delete(params[:headers]) end private def resource_for url RestClient::Resource.new( url, verify_ssl: options.verify_ssl, timeout: options.timeout ) end def prepare_params params params[:headers] ||= {} params[:headers]["X-Storage-Token"] = connection.token_id end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
nightcrawler_swift-0.4.0 | lib/nightcrawler_swift/command.rb |