I was very happy when I saw Jason to improved 30% the Json speed, but I didn’t find good document of Jason.
for example , my code was written with poison
def upload_drive_less_five(file, token) do
code = "Bearer #{token}"
HTTPoison.post!(
"https://www.googleapis.com/upload/drive/v3/files?uploadType=media", # url
{:file, file}, # body
[{"Authorization", code}], # headers
[timeout: 50_000, recv_timeout: 50_000] # options
).body
|> IO.inspect
end
OR
def refresh_token (email) do
refresh_token = HTTPoison.post!(
"https://www.googleapis.com/oauth2/v4/token", # url
{:form, # body
[
{"client_id", "#{System.get_env("GOOGLE_CLIENT_ID")}"} ,
{"client_secret", "#{System.get_env("GOOGLE_CLIENT_SECRET")}"} ,
{"refresh_token", "#{get_pass_refresh_token(email)}"},
{"grant_type", "refresh_token"}
]
},
[{"Content-Type", "application/x-www-form-urlencoded"}] # headers
).body
|> Poison.decode
{:ok, %{"access_token" => a_token}} = refresh_token
update_token_after_refresh_token(email, a_token)
end
Now, What am I supposed to do in Jason?