Coder Social home page Coder Social logo

Comments (5)

jmburges avatar jmburges commented on May 24, 2024

same!

from active_campaign.

shenst1 avatar shenst1 commented on May 24, 2024

same

from active_campaign.

jasonfb avatar jasonfb commented on May 24, 2024

@lorenzsell @jmburges @shenst1 -- I think the problem here is that master branch is not consistent with what is pushed to Rubygems.

see last known published gem https://github.com/mhenrixon/active_campaign/tree/v0.1.16

sync_contact became contact_sync
add_contact became contact_add
etc

from active_campaign.

jasonfb avatar jasonfb commented on May 24, 2024

this seems like all developer confusion to me. I went down these same rabbit holes, explained here: #84

@lorenzsell @jmburges @shenst1

as well, you must take note that the comment in the setup has the critical piece of hidden information: /admin/api.php must be added to your active campaign subdomain for it to work (this is all working on the V1 API)

client = ::ActiveCampaign::Client.new(
api_endpoint: 'https://[YOUR ACTIVE CAMPAIGN DOMAIN]/admin/api.php', # e.g. 'https://yourendpoint.api-us1.com/admin/api.php'
api_key: '[YOUR-API-KEY]')

@mhenrixon -- as a point of feedback, your code has lots of comments with important hidden details, which other developers (like me and the ones above) won't read when we're moving quickly. I'd recommend making some of this stuff more explicit in the actual code so that our editors show it as a color we should pay attention to (and not grey, signaling irrelevance.) just to make it easier to grok for people new to the gem.

from active_campaign.

jasonfb avatar jasonfb commented on May 24, 2024

also to debug the actual API, I had to do a little low-level monkey patching. Since the published version of the gem is currently old and I see that master is refactored, I won't bother making a pull request. As well, I see that on the new gem code there are already begin/rescue to handle this.

however, when working on v0.1.16, you will get crashes on client.rb line 71 if the JSON fails to parse.

To debug it, I had to re-write the method like to see the actual responses from the API:

I would highly recommend patterns like this when making wrappers because you can't anticipate all of the things that can (will) go wrong with these responses and it's probably best just to leave the responses spit back to us the developer to figure out where went wrong.

 def request(method, api_method, data)
      req = create_request method, api_method, data
      response = HTTPI.send(method, req)
      begin
        response = JSON.parse(response.body)
      rescue StandardError => e
        puts "*********  There was an error parsing the response from ActiveCampaign: #{response.inspect}"
        raise(e)
      end

      normalize(response)
    end

from active_campaign.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.