Class: Akamai::Netstorage
- Inherits:
-
Object
- Object
- Akamai::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.
-
#request ⇒ Object
readonly
Returns the value of attribute request.
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.
32 33 34 35 36 37 |
# File 'lib/akamai/netstorage.rb', line 32 def initialize(hostname, keyname, key) @hostname = hostname @keyname = keyname @key = key @request = nil 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 |
#request ⇒ Object (readonly)
Returns the value of attribute request.
30 31 32 |
# File 'lib/akamai/netstorage.rb', line 30 def request @request end |
Instance Method Details
#delete(ns_path) ⇒ Object
150 151 152 153 154 |
# File 'lib/akamai/netstorage.rb', line 150 def delete(ns_path) return _request(action: "delete", method: "POST", path: ns_path) end |
#dir(ns_path) ⇒ Object
107 108 109 110 111 |
# File 'lib/akamai/netstorage.rb', line 107 def dir(ns_path) return _request(action: "dir&format=xml", method: "GET", path: ns_path) end |
#download(ns_source, local_destination = '') ⇒ Object
113 114 115 116 117 118 |
# File 'lib/akamai/netstorage.rb', line 113 def download(ns_source, local_destination='') return _request(action: "download", method: "GET", path: ns_source, destination: local_destination) end |
#du(ns_path) ⇒ Object
120 121 122 123 124 |
# File 'lib/akamai/netstorage.rb', line 120 def du(ns_path) return _request(action: "du&format=xml", method: "GET", path: ns_path) end |
#mkdir(ns_path) ⇒ Object
132 133 134 135 136 |
# File 'lib/akamai/netstorage.rb', line 132 def mkdir(ns_path) return _request(action: "mkdir", method: "POST", path: ns_path) end |
#mtime(ns_path, mtime) ⇒ Object
144 145 146 147 148 |
# File 'lib/akamai/netstorage.rb', line 144 def mtime(ns_path, mtime) return _request(action: "mtime&format=xml&mtime=#{mtime}", method: "POST", path: ns_path) end |
#quick_delete(ns_path) ⇒ Object
156 157 158 159 160 |
# File 'lib/akamai/netstorage.rb', line 156 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
162 163 164 165 166 |
# File 'lib/akamai/netstorage.rb', line 162 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
138 139 140 141 142 |
# File 'lib/akamai/netstorage.rb', line 138 def rmdir(ns_path) return _request(action: "rmdir", method: "POST", path: ns_path) end |
#stat(ns_path) ⇒ Object
126 127 128 129 130 |
# File 'lib/akamai/netstorage.rb', line 126 def stat(ns_path) return _request(action: "stat&format=xml", method: "GET", path: ns_path) end |
#symlink(ns_target, ns_destination) ⇒ Object
168 169 170 171 172 |
# File 'lib/akamai/netstorage.rb', line 168 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
174 175 176 177 178 179 180 181 182 |
# File 'lib/akamai/netstorage.rb', line 174 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 |