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.
-
#ssl ⇒ Object
Returns the value of attribute ssl.
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, ssl = false) ⇒ 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, ssl = false) ⇒ Netstorage
32 33 34 35 36 37 38 39 |
# File 'lib/akamai/netstorage.rb', line 32 def initialize(hostname, keyname, key, ssl=false) @hostname = hostname @keyname = keyname @key = key @ssl = ssl ? 's' : '' @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 |
#ssl ⇒ Object
Returns the value of attribute ssl.
29 30 31 |
# File 'lib/akamai/netstorage.rb', line 29 def ssl @ssl end |
Instance Method Details
#delete(ns_path) ⇒ Object
155 156 157 158 159 |
# File 'lib/akamai/netstorage.rb', line 155 def delete(ns_path) return _request(action: "delete", method: "POST", path: ns_path) end |
#dir(ns_path) ⇒ Object
112 113 114 115 116 |
# File 'lib/akamai/netstorage.rb', line 112 def dir(ns_path) return _request(action: "dir&format=xml", method: "GET", path: ns_path) end |
#download(ns_source, local_destination = '') ⇒ Object
118 119 120 121 122 123 |
# File 'lib/akamai/netstorage.rb', line 118 def download(ns_source, local_destination='') return _request(action: "download", method: "GET", path: ns_source, destination: local_destination) end |
#du(ns_path) ⇒ Object
125 126 127 128 129 |
# File 'lib/akamai/netstorage.rb', line 125 def du(ns_path) return _request(action: "du&format=xml", method: "GET", path: ns_path) end |
#mkdir(ns_path) ⇒ Object
137 138 139 140 141 |
# File 'lib/akamai/netstorage.rb', line 137 def mkdir(ns_path) return _request(action: "mkdir", method: "POST", path: ns_path) end |
#mtime(ns_path, mtime) ⇒ Object
149 150 151 152 153 |
# File 'lib/akamai/netstorage.rb', line 149 def mtime(ns_path, mtime) return _request(action: "mtime&format=xml&mtime=#{mtime}", method: "POST", path: ns_path) end |
#quick_delete(ns_path) ⇒ Object
161 162 163 164 165 |
# File 'lib/akamai/netstorage.rb', line 161 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
167 168 169 170 171 |
# File 'lib/akamai/netstorage.rb', line 167 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
143 144 145 146 147 |
# File 'lib/akamai/netstorage.rb', line 143 def rmdir(ns_path) return _request(action: "rmdir", method: "POST", path: ns_path) end |
#stat(ns_path) ⇒ Object
131 132 133 134 135 |
# File 'lib/akamai/netstorage.rb', line 131 def stat(ns_path) return _request(action: "stat&format=xml", method: "GET", path: ns_path) end |
#symlink(ns_target, ns_destination) ⇒ Object
173 174 175 176 177 |
# File 'lib/akamai/netstorage.rb', line 173 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
179 180 181 182 183 184 185 186 187 |
# File 'lib/akamai/netstorage.rb', line 179 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 |