Current section

Files

Jump to
google_ads lib google_ads token.ex
Raw

lib/google_ads/token.ex

defmodule GoogleAds.Token do
@moduledoc """
The struct that represents the Google Ads Token.
"""
defstruct [:access_token, :expires_at, :expires_in, :refresh_token, :scope, :token_type]
@type t() :: %__MODULE__{
access_token: String.t(),
expires_at: String.t(),
expires_in: integer(),
refresh_token: String.t(),
scope: String.t(),
token_type: String.t()
}
@spec build(attributes :: map()) :: t()
def build(%{} = attributes) do
%__MODULE__{
access_token: attributes["access_token"],
expires_at: attributes["expires_at"],
expires_in: attributes["expires_in"],
refresh_token: attributes["refresh_token"],
scope: attributes["scope"],
token_type: attributes["token_type"]
}
end
end