Module: Qiniu::RS::Pub

Extended by:
Utils
Defined in:
lib/qiniu/rs/pub.rb

Class Method Summary collapse

Methods included from Utils

crc32checksum, debug, encode_entry_uri, generate_qbox_signature, generate_query_string, http_request, is_response_ok?, response_error, safe_json_parse, send_request_with, upload_multipart_data, urlsafe_base64_decode, urlsafe_base64_encode

Class Method Details

.set_protected(bucket, protected_mode) ⇒ Object



9
10
11
12
# File 'lib/qiniu/rs/pub.rb', line 9

def set_protected(bucket, protected_mode)
  host = Config.settings[:pub_host]
  Auth.request %Q(#{host}/accessMode/#{bucket}/mode/#{protected_mode})
end

.set_separator(bucket, separator) ⇒ Object



14
15
16
17
18
# File 'lib/qiniu/rs/pub.rb', line 14

def set_separator(bucket, separator)
  host = Config.settings[:pub_host]
  encoded_separator = Utils.urlsafe_base64_encode(separator)
  Auth.request %Q(#{host}/separator/#{bucket}/sep/#{encoded_separator})
end

.set_style(bucket, name, style) ⇒ Object



20
21
22
23
24
25
# File 'lib/qiniu/rs/pub.rb', line 20

def set_style(bucket, name, style)
  host = Config.settings[:pub_host]
  encoded_name = Utils.urlsafe_base64_encode(name)
  encoded_style = Utils.urlsafe_base64_encode(style)
  Auth.request %Q(#{host}/style/#{bucket}/name/#{encoded_name}/style/#{encoded_style})
end

.unset_style(bucket, name) ⇒ Object



27
28
29
30
31
# File 'lib/qiniu/rs/pub.rb', line 27

def unset_style(bucket, name)
  host = Config.settings[:pub_host]
  encoded_name = Utils.urlsafe_base64_encode(name)
  Auth.request %Q(#{host}/unstyle/#{bucket}/name/#{encoded_name})
end