Class: BitGirder::Http::HttpRequest

Inherits:
BitGirderClass
  • Object
show all
Defined in:
lib/bitgirder/http.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.from_mingle_struct(ms) ⇒ Object



147
148
149
150
151
152
153
154
155
156
157
# File 'lib/bitgirder/http.rb', line 147

def self.from_mingle_struct( ms )
    
    mg_hdrs, mg_body = ms[ :headers ], ms[ :body ]

    self.new(
        :headers => 
            mg_hdrs ? HttpHeaders.from_mingle_struct( mg_hdrs ) : nil,
        :path => ms.fields.get_string( :path ),
        :body => mg_body ? mg_body.buf : nil
    )
end

Instance Method Details

#to_mingle_structObject



135
136
137
138
139
140
141
142
143
144
145
# File 'lib/bitgirder/http.rb', line 135

def to_mingle_struct
    
    MingleStruct.new(
        :type => :"bitgirder:http@v1/HttpRequest",
        :fields => {
            :headers => @headers ? @headers.to_mingle_struct : nil,
            :path => @path,
            :body => @body ? MingleBuffer.new( @body ) : nil
        }
    )
end