Class: Inkfilepicker::Policy

Inherits:
Object
  • Object
show all
Defined in:
lib/inkfilepicker/policy.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Policy

Returns a new instance of Policy.



8
9
10
11
12
# File 'lib/inkfilepicker/policy.rb', line 8

def initialize(options = {})
  [:expiry, :call, :handle, :maxsize, :minsize, :path].each do |input|
    send("#{input}=", options[input]) unless options[input].nil?
  end
end

Instance Attribute Details

#callObject

Returns the value of attribute call.



6
7
8
# File 'lib/inkfilepicker/policy.rb', line 6

def call
  @call
end

#expiryObject

Returns the value of attribute expiry.



6
7
8
# File 'lib/inkfilepicker/policy.rb', line 6

def expiry
  @expiry
end

#handleObject

Returns the value of attribute handle.



6
7
8
# File 'lib/inkfilepicker/policy.rb', line 6

def handle
  @handle
end

#maxsizeObject

Returns the value of attribute maxsize.



6
7
8
# File 'lib/inkfilepicker/policy.rb', line 6

def maxsize
  @maxsize
end

#minsizeObject

Returns the value of attribute minsize.



6
7
8
# File 'lib/inkfilepicker/policy.rb', line 6

def minsize
  @minsize
end

#pathObject

Returns the value of attribute path.



6
7
8
# File 'lib/inkfilepicker/policy.rb', line 6

def path
  @path
end

Instance Method Details

#policyObject



14
15
16
# File 'lib/inkfilepicker/policy.rb', line 14

def policy
  Base64.urlsafe_encode64(json_policy)
end

#signatureObject



18
19
20
# File 'lib/inkfilepicker/policy.rb', line 18

def signature
  OpenSSL::HMAC.hexdigest('sha256', Inkfilepicker.secret_key, policy)
end