Skip to content

Commit 375576a

Browse files
author
David Haley
committed
Subclass standard mashify instead of our own
This lets us hook into the on_complete, parsing, etc.
1 parent 7e6d912 commit 375576a

File tree

1 file changed

+8
-9
lines changed

1 file changed

+8
-9
lines changed

lib/restforce/middleware/mashify.rb

+8-9
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,17 @@
11
module Restforce
22
# Middleware the converts sobject records from JSON into Restforce::SObject objects
33
# and collections of records into Restforce::Collection objects.
4-
class Middleware::Mashify < Restforce::Middleware
4+
class Middleware::Mashify < Faraday::Response::Mashify
55

6-
def call(env)
7-
@env = env
8-
response = @app.call(env)
9-
env[:body] = Restforce::Mash.build(body, client)
10-
response
6+
def parse(body)
7+
Restforce::Mash.build(body, @client)
118
end
129

13-
def body
14-
@env[:body]
10+
def initialize(app = nil, client = nil, options = {})
11+
super(app)
12+
@client = client
13+
@options = options
1514
end
16-
15+
1716
end
1817
end

0 commit comments

Comments
 (0)