Added support for Ruby v2 Specialization (#1101)

* Added support for Ruby v2 Specialization
* Added ruby v2 example with builder code
This commit is contained in:
Brendan Stennett
2019-03-13 22:55:26 +08:00
committed by Ta-Ching Chen
parent f104f0b46b
commit c717f182b6
12 changed files with 153 additions and 19 deletions
+7
View File
@@ -0,0 +1,7 @@
# frozen_string_literal: true
source "https://rubygems.org"
git_source(:github) {|repo_name| "https://github.com/#{repo_name}" }
gem "nokogiri"
+15
View File
@@ -0,0 +1,15 @@
GEM
remote: https://rubygems.org/
specs:
mini_portile2 (2.4.0)
nokogiri (1.10.1)
mini_portile2 (~> 2.4.0)
PLATFORMS
ruby
DEPENDENCIES
nokogiri
BUNDLED WITH
1.16.1
+13
View File
@@ -0,0 +1,13 @@
# frozen_string_literal: true
require 'nokogiri'
def handler(context)
context.logger.info("Received request")
doc = Nokogiri::XML(context.request.body.read)
ele = doc.at_xpath('//message')
msg = ele.nil? ? 'No Message' : ele.content
Rack::Response.new([msg, "\n"]).finish
end