class NightcrawlerSwift::Command

Public Instance Methods

connection() click to toggle source
# File lib/nightcrawler_swift/command.rb, line 4
def connection
  NightcrawlerSwift.connection.tap do |conn|
    conn.connect! unless conn.connected?
  end
end
execute() click to toggle source

:nocov:

# File lib/nightcrawler_swift/command.rb, line 15
def execute
  raise NotImplemented.new
end
options() click to toggle source
# File lib/nightcrawler_swift/command.rb, line 10
def options
  NightcrawlerSwift.options
end

Protected Instance Methods

put(url, args = {}) click to toggle source
# File lib/nightcrawler_swift/command.rb, line 36
def put url, args = {}
  prepare_args args
  Gateway.new(url).request {|r| r.put args[:body], headers_and_params(args)}
end

Private Instance Methods

headers_and_params(args) click to toggle source
# File lib/nightcrawler_swift/command.rb, line 48
def headers_and_params args
  args[:headers].merge(params: args[:params])
end
prepare_args(args) click to toggle source
# File lib/nightcrawler_swift/command.rb, line 42
def prepare_args args
  args[:headers] ||= {}
  args[:headers]["X-Storage-Token"] = connection.token_id
  args[:params] ||= {}
end