Class: Cadenya::Types::Config_HTTP

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request_method: nil, path: nil, query: nil, headers: nil, request_body_template: nil, request_body_content_type: nil) ⇒ Config_HTTP

Returns a new instance of Config_HTTP.



1274
1275
1276
1277
1278
1279
1280
1281
# File 'lib/cadenya/types.rb', line 1274

def initialize(request_method: nil, path: nil, query: nil, headers: nil, request_body_template: nil, request_body_content_type: nil)
  @request_method = request_method
  @path = path
  @query = query
  @headers = headers
  @request_body_template = request_body_template
  @request_body_content_type = request_body_content_type
end

Instance Attribute Details

#headersObject (readonly)

Returns the value of attribute headers.



1272
1273
1274
# File 'lib/cadenya/types.rb', line 1272

def headers
  @headers
end

#pathObject (readonly)

Returns the value of attribute path.



1272
1273
1274
# File 'lib/cadenya/types.rb', line 1272

def path
  @path
end

#queryObject (readonly)

Returns the value of attribute query.



1272
1273
1274
# File 'lib/cadenya/types.rb', line 1272

def query
  @query
end

#request_body_content_typeObject (readonly)

Returns the value of attribute request_body_content_type.



1272
1273
1274
# File 'lib/cadenya/types.rb', line 1272

def request_body_content_type
  @request_body_content_type
end

#request_body_templateObject (readonly)

Returns the value of attribute request_body_template.



1272
1273
1274
# File 'lib/cadenya/types.rb', line 1272

def request_body_template
  @request_body_template
end

#request_methodObject (readonly)

Returns the value of attribute request_method.



1272
1273
1274
# File 'lib/cadenya/types.rb', line 1272

def request_method
  @request_method
end

Class Method Details

.from_json(data) ⇒ Object



1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
# File 'lib/cadenya/types.rb', line 1283

def self.from_json(data)
  new(
    request_method: data["requestMethod"],
    path: data["path"],
    query: data["query"],
    headers: data["headers"],
    request_body_template: data["requestBodyTemplate"],
    request_body_content_type: data["requestBodyContentType"],
  )
end

Instance Method Details

#to_hObject



1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
# File 'lib/cadenya/types.rb', line 1294

def to_h
  {
    request_method: Util.plain(@request_method),
    path: Util.plain(@path),
    query: Util.plain(@query),
    headers: Util.plain(@headers),
    request_body_template: Util.plain(@request_body_template),
    request_body_content_type: Util.plain(@request_body_content_type),
  }.reject { |_k, v| v.nil? }
end