Sha256: 8c0a6ee5fbd9b2e7edc171c4919514ccd0aac019ebfc500f329f63f59bfb1dd4

Contents?: true

Size: 765 Bytes

Versions: 6

Compression:

Stored size: 765 Bytes

Contents

require 'spec_helper'
require 'webmock/rspec'
require 'digest/md5'

describe Gibbon do
  let(:api_key) { '1234-us1' }
  let(:list_id) { 'testlist' }
  let(:email) { 'john.doe@example.com' }
  let(:member_id) { Digest::MD5.hexdigest(email) }

  let(:request_body) do
    {
      email_address: email,
      status: 'subscribed',
      merge_fields: {FNAME: 'John', LNAME: 'Doe'}
    }
  end

  it 'supports upsert request' do
    stub_request(:put, "https://us1.api.mailchimp.com/3.0/lists/#{list_id}/members/#{member_id}")
      .with(body: MultiJson.dump(request_body), basic_auth: ['apikey', '1234-us1'])
      .to_return(status: 200)

    Gibbon::Request.new(api_key: api_key)
      .lists(list_id).members(member_id)
      .upsert(body: request_body)
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gibbon-3.5.0 spec/gibbon/upsert_spec.rb
gibbon-3.4.4 spec/gibbon/upsert_spec.rb
gibbon-3.4.3 spec/gibbon/upsert_spec.rb
gibbon-3.4.2 spec/gibbon/upsert_spec.rb
gibbon-3.4.0 spec/gibbon/upsert_spec.rb
gibbon-3.3.4 spec/gibbon/upsert_spec.rb