Sha256: 7b0cf2a8066ee573ca304e4e80080484cb230a5cedc795547e0a27edbdce016a

Contents?: true

Size: 745 Bytes

Versions: 19

Compression:

Stored size: 745 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://apikey:1234-us1@us1.api.mailchimp.com/3.0/lists/#{list_id}/members/#{member_id}")
      .with(body: MultiJson.dump(request_body))
      .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

19 entries across 19 versions & 1 rubygems

Version Path
gibbon-3.3.3 spec/gibbon/upsert_spec.rb
gibbon-3.3.2 spec/gibbon/upsert_spec.rb
gibbon-3.3.1 spec/gibbon/upsert_spec.rb
gibbon-3.3.0 spec/gibbon/upsert_spec.rb
gibbon-3.2.0 spec/gibbon/upsert_spec.rb
gibbon-3.1.1 spec/gibbon/upsert_spec.rb
gibbon-3.1.0 spec/gibbon/upsert_spec.rb
gibbon-3.0.2 spec/gibbon/upsert_spec.rb
gibbon-3.0.1 spec/gibbon/upsert_spec.rb
gibbon-2.2.5 spec/gibbon/upsert_spec.rb
gibbon-2.2.4 spec/gibbon/upsert_spec.rb
gibbon-2.2.3 spec/gibbon/upsert_spec.rb
gibbon-2.2.2 spec/gibbon/upsert_spec.rb
gibbon-2.2.1 spec/gibbon/upsert_spec.rb
gibbon-2.2.0 spec/gibbon/upsert_spec.rb
gibbon-2.1.3 spec/gibbon/upsert_spec.rb
gibbon-2.1.2 spec/gibbon/upsert_spec.rb
gibbon-2.1.1 spec/gibbon/upsert_spec.rb
gibbon-2.1.0 spec/gibbon/upsert_spec.rb