Module: MarketoChef

Extended by:
Forwardable
Defined in:
lib/marketo_chef.rb,
lib/marketo_chef/client.rb,
lib/marketo_chef/version.rb,
lib/marketo_chef/configuration.rb

Overview

Copyright 2018 Chef Software Inc.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Defined Under Namespace

Classes: Client, Configuration

Constant Summary collapse

RESPONSE_ERROR_CODES =

developers.marketo.com/rest-api/error-codes/#response_level_errors 607: Daily API Request Limit Reached 611: System Error (generic unhandled exception)

%w[607 611].freeze
MAYBE_OUR_FAULT_CODES =

developers.marketo.com/rest-api/error-codes/#record_level_errors 1001: Invalid value ‘%s’. Required of type ‘%s’ 1002: Missing value for required parameter ‘%s’ 1003: Invalid data 1006: Field ‘%s’ not found 1007: Multiple leads match the lookup criteria …these are the only ones we might need to care about currently

%w[1003 1006].freeze
MAYBE_THEIR_FAULT_CODES =
%w[1001 1002].freeze
VERSION =
'1.1.0'

Class Method Summary collapse

Class Method Details

.add_lead(lead) ⇒ Object



56
57
58
59
60
61
62
63
64
# File 'lib/marketo_chef.rb', line 56

def add_lead(lead)
  result = sync(lead)

  return unless result

  handle_skipped(lead, result['reasons']) if result['status'] == 'skipped'

  trigger_campaign(campaign_id, result['id']) if result.key?('id')
end

.configurationObject



46
47
48
# File 'lib/marketo_chef.rb', line 46

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



50
51
52
53
54
# File 'lib/marketo_chef.rb', line 50

def configure
  yield(configuration)

  configuration.validate
end