Module: Smslist::Request

Included in:
Client
Defined in:
lib/smslist/request.rb

Instance Method Summary collapse

Instance Method Details

#build_xml_body(&block) ⇒ Object



9
10
11
12
13
14
15
16
17
18
# File 'lib/smslist/request.rb', line 9

def build_xml_body(&block)
  Nokogiri::XML::Builder.new(encoding: 'utf-8') do |xml|
    xml.request {
      xml.security {
        authentication.each { |k, v| xml.send(k, value: v) }
      }
      xml.instance_eval(&block) if block_given?
    }
  end
end

#post(xml, method = nil) ⇒ Object



5
6
7
# File 'lib/smslist/request.rb', line 5

def post(xml, method = nil)
  HTTParty.post request_uri(method), body: xml, headers: headers
end