Module: Upyun::Utils

Included in:
Form, Rest
Defined in:
lib/upyun/utils.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.included(receiver) ⇒ Object



9
10
11
12
13
14
15
16
17
# File 'lib/upyun/utils.rb', line 9

def self.included(receiver)
  receiver.send(:define_method, :endpoint) { @endpoint }
  receiver.send(:define_method, :endpoint=) do |ep|
    unless Upyun::ED_LIST.member?(ep)
      raise ArgumentError, "Valid endpoints are: #{Upyun::ED_LIST}"
    end
    @endpoint = ep
  end
end

Instance Method Details

#md5(str) ⇒ Object



5
6
7
# File 'lib/upyun/utils.rb', line 5

def md5(str)
  Digest::MD5.hexdigest(str)
end