Module: Opushon Private

Defined in:
lib/opushon.rb,
lib/opushon/body.rb,
lib/opushon/option.rb,
lib/opushon/request.rb,
lib/opushon/response.rb,
lib/opushon/parameter.rb,
lib/opushon/restricted_value.rb

Overview

This module is part of a private API. You should avoid using this module if possible, as it may be removed or be changed in the future.

Namespace for the Opushon library. Representation of documentations for HTTP APIs.

Defined Under Namespace

Classes: Body, Option, Parameter, Request, Response, RestrictedValue

Class Method Summary collapse

Class Method Details

.dump(opushon) ⇒ String

Dump Ruby object to a Opushon string.

Parameters:

Returns:

  • (String)

    the Opushon data representation



32
33
34
# File 'lib/opushon.rb', line 32

def self.dump(opushon)
  opushon.to_h.to_json
end

.load(opushon_string) ⇒ Body

Load opushon in to the Ruby data structure.

Examples:

Load the option of a DELETE interface

load('{"DELETE":{"title":"Delete issues","description":"Remove every issues.","request":{"headers":{},"query_string":{},"body":{}},"response":{"headers":{},"query_string":{},"body":{}}}}')

Parameters:

  • opushon_string (String)

Returns:

  • (Body)

    the Ruby data structure



20
21
22
23
# File 'lib/opushon.rb', line 20

def self.load(opushon_string)
  opushon_hash = JSON.parse(opushon_string)
  Body.load(opushon_hash)
end