Class: Kintone::Client::Middleware::Form
- Inherits:
-
Faraday::Response::Middleware
- Object
- Faraday::Response::Middleware
- Kintone::Client::Middleware::Form
- Defined in:
- lib/kintone/client/middleware/form.rb
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(app, options = nil) ⇒ Form
constructor
A new instance of Form.
Constructor Details
#initialize(app, options = nil) ⇒ Form
Returns a new instance of Form.
3 4 5 |
# File 'lib/kintone/client/middleware/form.rb', line 3 def initialize(app, = nil) super(app) end |
Instance Method Details
#call(env) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/kintone/client/middleware/form.rb', line 7 def call(env) @app.call(env).on_complete do |env| if record = env[:body]['record'] env[:body]['record'] = parse_form(record) elsif records = env[:body]['records'] env[:body]['records'] = records.map {|r| parse_form(r) } end if totalCount = env[:body]['totalCount'] env[:body]['totalCount'] = totalCount.to_i end end end |