~singpolyma/jmp-pay

ref: 265bb3ef7771f250671025c843284ac931295189 jmp-pay/lib/to_form.rb -rw-r--r-- 274 bytes
265bb3efStephen Paul Weber Query sgx-jmp for every expired user 1 year, 20 days ago
                                                                                
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
# frozen_string_literal: true

require "blather"

module ToForm
	refine ::Hash do
		def to_fields
			map { |k, v| { var: k.to_s, value: v.to_s } }
		end

		def to_form(type)
			Blather::Stanza::Iq::X.new(type).tap do |form|
				form.fields = to_fields
			end
		end
	end
end