Sha256: 51cc81c5af8ab5f41b94337f91cdc62e57929f5e54870dba8d3daea2c65120b6

Contents?: true

Size: 796 Bytes

Versions: 18

Compression:

Stored size: 796 Bytes

Contents

# -*- coding: utf-8 -*-
module Mushikago
  module Auth
    # MushikagoのリクエストにMix-inして利用する
    module Signature
      # リクエストの情報から以下のような署名用文字列を作成する
      #   GET
      #   localhost
      #   /1/info.json
      #   api_key=api_key&timestamp=2011-09-01T00%3A00%3A00Z
      # @return [String] 署名用の文字列
      def string_to_sign
        [
          http_method,
          host,
          path,
          url_encoded_params,
        ].join("\n")
      end

      # リクエストに署名を追加する
      # @param signer [Mushikago::Auth::Signer] 署名を作成するオブジェクト
      def add_signature! signer
        self['signature'] = signer.sign(string_to_sign)
      end
    end
  end
end

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
mushikago-sdk-2.4.3 lib//mushikago/auth/signature.rb
mushikago-sdk-2.4.2 lib//mushikago/auth/signature.rb
mushikago-sdk-2.4.1 lib/mushikago/auth/signature.rb
mushikago-sdk-2.4 lib/mushikago/auth/signature.rb
mushikago-sdk-2.2 lib//mushikago/auth/signature.rb
mushikago-sdk-2.1.1 lib/mushikago/auth/signature.rb
mushikago-sdk-2.1.0 lib/mushikago/auth/signature.rb
mushikago-sdk-2.0.0 lib/mushikago/auth/signature.rb
mushikago-sdk-0.4.3 lib/mushikago/auth/signature.rb
mushikago-sdk-0.4.2 lib/mushikago/auth/signature.rb
mushikago-sdk-0.4.1 lib/mushikago/auth/signature.rb
mushikago-sdk-0.4.0 lib/mushikago/auth/signature.rb
mushikago-sdk-0.3.7 lib/mushikago/auth/signature.rb
mushikago-sdk-0.3.6 lib/mushikago/auth/signature.rb
mushikago-sdk-0.3.5 lib/mushikago/auth/signature.rb
mushikago-sdk-0.3.4 lib/mushikago/auth/signature.rb
mushikago-sdk-0.3.2 lib/mushikago/auth/signature.rb
mushikago-sdk-0.3.1 lib/mushikago/auth/signature.rb