Class: Elastictastic::Thrift::RestRequest

Inherits:
Object
  • Object
show all
Includes:
Thrift::Struct, Thrift::Struct_Union
Defined in:
lib/elastictastic/thrift/types.rb

Constant Summary collapse

METHOD =
1
URI =
2
PARAMETERS =
3
HEADERS =
4
BODY =
5
FIELDS =
{
  METHOD => {:type => ::Thrift::Types::I32, :name => 'method', :enum_class => Elastictastic::Thrift::Method},
  URI => {:type => ::Thrift::Types::STRING, :name => 'uri'},
  PARAMETERS => {:type => ::Thrift::Types::MAP, :name => 'parameters', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
  HEADERS => {:type => ::Thrift::Types::MAP, :name => 'headers', :key => {:type => ::Thrift::Types::STRING}, :value => {:type => ::Thrift::Types::STRING}, :optional => true},
  BODY => {:type => ::Thrift::Types::STRING, :name => 'body', :binary => true, :optional => true}
}

Instance Method Summary collapse

Instance Method Details

#struct_fieldsObject



86
# File 'lib/elastictastic/thrift/types.rb', line 86

def struct_fields; FIELDS; end

#validateObject

Raises:

  • (::Thrift::ProtocolException)


88
89
90
91
92
93
94
# File 'lib/elastictastic/thrift/types.rb', line 88

def validate
  raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field method is unset!') unless @method
  raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Required field uri is unset!') unless @uri
  unless @method.nil? || Elastictastic::Thrift::Method::VALID_VALUES.include?(@method)
    raise ::Thrift::ProtocolException.new(::Thrift::ProtocolException::UNKNOWN, 'Invalid value of field method!')
  end
end