Class: Netstorage
- Inherits:
-
Object
- Object
- Netstorage
- Defined in:
- lib/akamai/netstorage.rb
Instance Attribute Summary collapse
-
#hostname ⇒ Object
Returns the value of attribute hostname.
-
#key ⇒ Object
Returns the value of attribute key.
-
#keyname ⇒ Object
Returns the value of attribute keyname.
Instance Method Summary collapse
- #delete(ns_path) ⇒ Object
- #dir(ns_path) ⇒ Object
- #download(ns_source, local_destination = '') ⇒ Object
- #du(ns_path) ⇒ Object
-
#initialize(hostname, keyname, key) ⇒ Netstorage
constructor
A new instance of Netstorage.
- #mkdir(ns_path) ⇒ Object
- #mtime(ns_path, mtime) ⇒ Object
- #quick_delete(ns_path) ⇒ Object
- #rename(ns_target, ns_destination) ⇒ Object
- #rmdir(ns_path) ⇒ Object
- #stat(ns_path) ⇒ Object
- #symlink(ns_target, ns_destination) ⇒ Object
- #upload(local_source, ns_destination) ⇒ Object
Constructor Details
#initialize(hostname, keyname, key) ⇒ Netstorage
Returns a new instance of Netstorage.
31 32 33 34 35 |
# File 'lib/akamai/netstorage.rb', line 31 def initialize(hostname, keyname, key) @hostname = hostname @keyname = keyname @key = key end |
Instance Attribute Details
#hostname ⇒ Object
Returns the value of attribute hostname.
29 30 31 |
# File 'lib/akamai/netstorage.rb', line 29 def hostname @hostname end |
#key ⇒ Object
Returns the value of attribute key.
29 30 31 |
# File 'lib/akamai/netstorage.rb', line 29 def key @key end |
#keyname ⇒ Object
Returns the value of attribute keyname.
29 30 31 |
# File 'lib/akamai/netstorage.rb', line 29 def keyname @keyname end |
Instance Method Details
#delete(ns_path) ⇒ Object
148 149 150 151 152 |
# File 'lib/akamai/netstorage.rb', line 148 def delete(ns_path) return _request(action: "delete", method: "POST", path: ns_path) end |
#dir(ns_path) ⇒ Object
105 106 107 108 109 |
# File 'lib/akamai/netstorage.rb', line 105 def dir(ns_path) return _request(action: "dir&format=xml", method: "GET", path: ns_path) end |
#download(ns_source, local_destination = '') ⇒ Object
111 112 113 114 115 116 |
# File 'lib/akamai/netstorage.rb', line 111 def download(ns_source, local_destination='') return _request(action: "download", method: "GET", path: ns_source, destination: local_destination) end |
#du(ns_path) ⇒ Object
118 119 120 121 122 |
# File 'lib/akamai/netstorage.rb', line 118 def du(ns_path) return _request(action: "du&format=xml", method: "GET", path: ns_path) end |
#mkdir(ns_path) ⇒ Object
130 131 132 133 134 |
# File 'lib/akamai/netstorage.rb', line 130 def mkdir(ns_path) return _request(action: "mkdir", method: "POST", path: ns_path) end |
#mtime(ns_path, mtime) ⇒ Object
142 143 144 145 146 |
# File 'lib/akamai/netstorage.rb', line 142 def mtime(ns_path, mtime) return _request(action: "mtime&format=xml&mtime=#{mtime}", method: "POST", path: ns_path) end |
#quick_delete(ns_path) ⇒ Object
154 155 156 157 158 |
# File 'lib/akamai/netstorage.rb', line 154 def quick_delete(ns_path) return _request(action: "quick-delete&quick-delete=imreallyreallysure", method: "POST", path: ns_path) end |
#rename(ns_target, ns_destination) ⇒ Object
160 161 162 163 164 |
# File 'lib/akamai/netstorage.rb', line 160 def rename(ns_target, ns_destination) return _request(action: "rename&destination=#{CGI::escape(ns_destination)}", method: "POST", path: ns_target) end |
#rmdir(ns_path) ⇒ Object
136 137 138 139 140 |
# File 'lib/akamai/netstorage.rb', line 136 def rmdir(ns_path) return _request(action: "rmdir", method: "POST", path: ns_path) end |
#stat(ns_path) ⇒ Object
124 125 126 127 128 |
# File 'lib/akamai/netstorage.rb', line 124 def stat(ns_path) return _request(action: "stat&format=xml", method: "GET", path: ns_path) end |
#symlink(ns_target, ns_destination) ⇒ Object
166 167 168 169 170 |
# File 'lib/akamai/netstorage.rb', line 166 def symlink(ns_target, ns_destination) return _request(action: "symlink&target=#{CGI::escape(ns_target)}", method: "POST", path: ns_destination) end |
#upload(local_source, ns_destination) ⇒ Object
172 173 174 175 176 177 178 179 180 |
# File 'lib/akamai/netstorage.rb', line 172 def upload(local_source, ns_destination) if File.file?(local_source) && ns_destination[-1] == "/" ns_destination = "#{ns_destination}#{File.basename(local_source)}" end return _request(action: "upload", method: "PUT", source: local_source, path: ns_destination) end |