Method: Useless::Doc::Serialization::Load.request

Defined in:
lib/useless/doc/serialization/load.rb

.request(json) ⇒ Object

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



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
# File 'lib/useless/doc/serialization/load.rb', line 71

def self.request(json)
  hash = json_to_hash json

  parameters = (hash['parameters'] || []).map do |json|
    request_parameter json
  end

  headers = (hash['headers'] || []).map do |json|
    header json
  end

  if hash['body']
    body = body hash['body']
  end

  Useless::Doc::Request.new \
    parameters: parameters,
    headers:    headers,
    body:       body
end