-
-
Save daviddavis/6476530 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
args << generate_payload(options) if [:post, :put].include?(method) | |
def generate_payload(options) | |
if options[:payload].is_a?(String) | |
return options[:payload] | |
elsif options[:payload].is_a?(Hash) | |
return format_payload(options[:payload]) | |
end | |
end | |
def format_payload(payload) | |
if !payload.nil? | |
if payload[:optional] | |
if payload[:required] | |
payload = payload[:required].merge(payload[:optional]) | |
else | |
payload = payload[:optional] | |
end | |
elsif options[:payload][:delta] | |
payload = payload | |
else | |
payload = payload[:required] | |
end | |
else | |
payload = {} | |
end | |
return payload.to_json | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
The method
upload_bits
would thus call: