Module: Lanmao::Form::DataHelper

Defined in:
lib/lanmao/form/form_helper.rb

Instance Method Summary collapse

Instance Method Details

#get_form_data(service, params) ⇒ Hash

跳转到新网 Form 类的 api,统一返回处理

Parameters:

  • service (String)

    新网的服务

  • params (Hash)

    参数

Returns:

  • (Hash)

    结果集

    • form_method

      • url

      • method

    • form_data

      • :data



18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/lanmao/form/form_helper.rb', line 18

def get_form_data(service, params)
  request = Http::Request.new(params, @config, service, :gateway)
  body, url = request.get_body

  {
    form_method: {
      :url => url,
      :method => :post,
    },
    form_data: body,
  }
end