Qiniu.PutPolicy

PutPolicy struct for uploading. And you have to specify right scope and deadline to let uploading work.

See http://developer.qiniu.com/docs/v6/api/reference/security/put-policy.html

Summary

encoded_json(policy)

Change put_policy to json string and encode it with url safe

to_json(policy)

Change put_policy to json string expect the nil values

Types

t :: %Qiniu.PutPolicy{scope: String.t, deadline: integer, insert_only: integer | nil, save_key: String.t | nil, end_user: String.t | nil, return_url: String.t | nil, return_body: String.t | nil, callback_url: String.t | nil, callback_host: String.t | nil, callback_body: String.t | nil, callback_body_type: String.t | nil, callback_fetch_key: integer | nil, persistent_ops: String.t | nil, persistent_notify_url: String.t | nil, persistent_pipeline: String.t | nil, fsize_limit: integer | nil, detect_mime: integer | nil, mime_limit: String.t | nil, checksum: String.t | nil}

Functions

encoded_json(policy)

Specs:

Change put_policy to json string and encode it with url safe

Examples

iex> policy = %Qiniu.PutPolicy{scope: "scope"}
iex> Qiniu.PutPolicy.encoded_json(policy)
"eyJzY29wZSI6InNjb3BlIn0="
to_json(policy)

Specs:

Change put_policy to json string expect the nil values.

Examples

iex> policy = %Qiniu.PutPolicy{scope: "scope", deadline: 1427990400}
iex> Qiniu.PutPolicy.to_json(policy)
~s({"scope":"scope","deadline":1427990400})