Module: OAuth::Signature — Documentation by YARD 0.9.44

# Module: OAuth::Signature

Defined in:
  lib/oauth/signature.rb,
  lib/oauth/signature/base.rb,
  lib/oauth/signature/rsa/sha1.rb,
  lib/oauth/signature/hmac/sha1.rb,
  lib/oauth/signature/plaintext.rb,
  lib/oauth/signature/hmac/sha256.rb

## Defined Under Namespace

Modules: HMAC, RSA Classes: Base, PLAINTEXT, UnknownSignatureMethod

## Constant Summary collapse

AVAILABLE_METHODS =

      {}

## Class Method Summary collapse

- .available_methods ⇒ Object

  Returns a list of available signature methods.

- .body_hash(request, options = {}, &block) ⇒ Object

  Create the body hash for a request.

- .build(request, options = {}, &block) ⇒ Object

  Build a signature from a +request+.

- .sign(request, options = {}, &block) ⇒ Object

  Sign a +request+.

- .signature_base_string(request, options = {}, &block) ⇒ Object

  Create the signature base string for +request+.

- .verify(request, options = {}, &block) ⇒ Object

  Verify the signature of +request+.

## Class Method Details

### .available_methods ⇒ `Object`

Returns a list of available signature methods

    9
    10
    11
    # File 'lib/oauth/signature.rb', line 9

    def available_methods
      AVAILABLE_METHODS
    end

### .body_hash(request, options = {}, &block) ⇒ `Object`

Create the body hash for a request

    45
    46
    47
    # File 'lib/oauth/signature.rb', line 45

    def body_hash(request, options = {}, &block)
      build(request, options, &block).body_hash
    end

### .build(request, options = {}, &block) ⇒ `Object`

Build a signature from a +request+.

Raises UnknownSignatureMethod exception if the signature method is unknown.

Raises:

- (`UnknownSignatureMethod`)

    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    # File 'lib/oauth/signature.rb', line 16

    def build(request, options = {}, &block)
      request = OAuth::RequestProxy.proxy(request, options)
      klass = available_methods[
        (request.signature_method ||
        ((c = request.options[:consumer]) && c.options[:signature_method]) ||
        "").downcase]
      raise UnknownSignatureMethod, request.signature_method unless klass

      klass.new(request, options, &block)
    end

### .sign(request, options = {}, &block) ⇒ `Object`

Sign a +request+

    28
    29
    30
    # File 'lib/oauth/signature.rb', line 28

    def sign(request, options = {}, &block)
      build(request, options, &block).signature
    end

### .signature_base_string(request, options = {}, &block) ⇒ `Object`

Create the signature base string for +request+. This string is the normalized parameter information.

See Also: core spec version 1.0, section 9.1.1[http://oauth.net/core/1.0#rfc.section.9.1.1]

    40
    41
    42
    # File 'lib/oauth/signature.rb', line 40

    def signature_base_string(request, options = {}, &block)
      build(request, options, &block).signature_base_string
    end

### .verify(request, options = {}, &block) ⇒ `Object`

Verify the signature of +request+

    33
    34
    35
    # File 'lib/oauth/signature.rb', line 33

    def verify(request, options = {}, &block)
      build(request, options, &block).verify
    end