Method: Pipekit::Request#parse_body

Defined in:
lib/pipekit/request.rb

#parse_body(body) ⇒ Object

Replaces custom fields with their Pipedrive ID if the ID is defined in the configuration

So if the body looked like this with a custom field called middle_name:

{ middle_name: “Dave” }

And it has a Pipedrive ID (“123abc”), this will put in this custom ID

{ “123abc”: “Dave” }

meaning you don’t have to worry about the custom IDs



107
108
109
110
111
112
113
# File 'lib/pipekit/request.rb', line 107

def parse_body(body)
  body.reduce({}) do |result, (field, value)|
    value = Config.field_value_id(resource, field, value)
    field = Config.field_id(resource, field)
    result.tap { |result| result[field] = value }
  end
end