Code Monkey home page Code Monkey logo

mailchimp_api_v3's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

mailchimp_api_v3's Issues

How to update interests?

Hi,
I've managed to create new member and add interest group, also update mail/name etc. via API, but I have no clue how to update interest group.
I've tried
student.interests["b945c0efaa"=>true]
also I've tried to create new hash and update like
student.interests.update(new_hash) yet no success.
Thank you

Petr R.

Bug: NoMethodError (undefined method `casecmp' for {...}:Hash)

I have realised this is a separate issue. I get a fatal error if I use first_or_create in an 'each' block where the member already exists and has the status 'pending' in the MailChimp list.

NoMethodError (undefined method `casecmp' for {"e6037a062c"=>true, "a25411f7a5"=>false}:Hash):
  
app/services/mailchimp_members_service.rb:63:in `block in refer_members'
.
.
.

An exception should really be thrown, such as...

Mailchimp::Exception::Duplicate ([email protected] is already a list member. Use PUT to insert or update list members.):
.
.
.

Taking into account that...

@emails = ["[email protected]"]
ENV['MAILCHIMP_INTEREST_1ST'] = 'e6037a062c'
ENV['MAILCHIMP_INTEREST_2ND'] = 'a25411f7a5'

This is my code...

def refer_members

  @emails.each do |email|
    attributes = {
      "email_address": email,
      "status": "pending",
      "interests": {
        ENV['MAILCHIMP_INTEREST_1ST'] => true,
        ENV['MAILCHIMP_INTEREST_2ND'] => false
      }
    }

    MAILCHIMP.lists(ENV['MAILCHIMP_LIST_ID']).members.first_or_create(attributes)
  end

end

Again, I have used a similar process as mentioned in the comment in issue #13 to check if the member already exists.

I have notice it for another block of code I have, where I create a member. I seems to relate to the inner hash of the attributes... I think. I want to check with you first if this is because of this gem, or if I need to report it to MailChimp themselves.

๐Ÿฆ‘

Dependency Dashboard

This issue lists Renovate updates and detected dependencies. Read the Dependency Dashboard docs to learn more.

This repository currently has no open or pending branches.

Detected dependencies

bundler
Gemfile

  • Check this box to trigger a request for Renovate to run again on this repository

Mailchimp::Exception handling

I know it is not an issue, but I hope you might have the time to help me. I am trying to catch the exception that the gem creates when something goes wrong. This is what I have in my controller...

class MembersController < ApplicationController

  rescue_from Mailchimp::Exception, with: :error

  def error

    render json: {
      :status => 'error',
      :success => false,
      :message => error.message,
      :params => params.as_json
    }, status: 500

  end

end

Problem is, the JSON is not being rendered.


Rails: ~> 5.0.1 | Ruby: 2.3.3 :octocat:

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.