Class: MrMurano::Cors

Inherits:
SolutionBase show all
Defined in:
lib/MrMurano/commands/cors.rb

Instance Method Summary collapse

Methods inherited from SolutionBase

#docmp, #dodiff, #download, #endPoint, #localitems, #locallist, #removelocal, #status, #syncdown, #synckey, #syncup, #toRemoteItem, #tolocalname

Methods included from Verbose

#debug, #verbose

Methods included from Http

#curldebug, #delete, #get, #http, #http_reset, #json_opts, #post, #postf, #put, #set_def_headers, #showHttpError, #token, #tryToPrettyJSON, #workit

Constructor Details

#initializeCors

Returns a new instance of Cors.



4
5
6
7
8
# File 'lib/MrMurano/commands/cors.rb', line 4

def initialize
  super
  @uriparts << 'cors'
  @location = $cfg['location.cors']
end

Instance Method Details

#fetchObject



10
11
12
13
# File 'lib/MrMurano/commands/cors.rb', line 10

def fetch()
  ret = get()
  ret[:cors]
end

#tolocalpath(into, item) ⇒ Object



31
32
33
# File 'lib/MrMurano/commands/cors.rb', line 31

def tolocalpath(into, item)
  into
end

#upload(local, remote) ⇒ Object

Upload CORS :local path to file to push :remote hash of method and endpoint path (ignored for now)



21
22
23
24
25
26
27
28
29
# File 'lib/MrMurano/commands/cors.rb', line 21

def upload(local, remote)
  local = Pathname.new(local) unless local.kind_of? Pathname
  raise "no file" unless local.exist?

  local.open do |io|
    data = YAML.load(io)
    put('', data)
  end
end