Skip to content

trampos/mautic_api_library

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Autorizando

    require 'oauth2'

    client_id = ''
    client_secret = ''

    client = OAuth2::Client.new(client_id, client_secret, { 
        :site             => mautic_url,
        :authorize_url    => '/oauth/v2/authorize',
        :token_url        => '/oauth/v2/token' })

    client.auth_code.authorize_url(:redirect_uri => mautic_oauth_callback)

Callback, pegando a token

    code = params[:code]
    token = client.auth_code.get_token code, :redirect_uri => mautic_oauth_callback

    auth = MauticApi::Auth::OAuth2.new token

Usando a token

    context = MauticApi::Context.new
    api = context.new_api "contacts", auth, mautic_api_base_url

    # PATCH contato
    api.edit 1707484, { lastname: "Ueno" }

    # GET contato
    api.get 1707484

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published