Module: Avmtrf1::Red::Helper

Included in:
Client, Profile
Defined in:
lib/avmtrf1/red/helper.rb

Instance Method Summary collapse

Instance Method Details

#post(url, *post_args) ⇒ Object



15
16
17
18
19
# File 'lib/avmtrf1/red/helper.rb', line 15

def post(url, *post_args)
  infom "Requesting \"#{url}\""
  ::EacEnvs::Http::Request.new.url(url.to_s).verb(:post).body_data(post_args.first).response
    .body_str_or_raise
end

#post_xml(url_suffix, xml_body) ⇒ Object



21
22
23
24
# File 'lib/avmtrf1/red/helper.rb', line 21

def post_xml(url_suffix, xml_body)
  url = server.resource_url(url_suffix)
  ::Nokogiri::XML(post(url, xml_body))
end

#xml_content(name) ⇒ Object



26
27
28
# File 'lib/avmtrf1/red/helper.rb', line 26

def xml_content(name)
  ::ERB.new(::File.read(xml_path(name))).result(binding)
end

#xml_path(name) ⇒ Object



30
31
32
# File 'lib/avmtrf1/red/helper.rb', line 30

def xml_path(name)
  ::File.join(__dir__, self.class.name.demodulize.underscore, "#{name}.xml.erb")
end