Class: GoodDataMarketo::Campaigns

Inherits:
Object
  • Object
show all
Defined in:
lib/gooddata_marketo/models/campaigns.rb

Overview

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config = {}) ⇒ Campaigns

Returns a new instance of Campaigns.



8
9
10
11
12
# File 'lib/gooddata_marketo/models/campaigns.rb', line 8

def initialize config = {}

  @client = config[:client]

end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



6
7
8
# File 'lib/gooddata_marketo/models/campaigns.rb', line 6

def client
  @client
end

Instance Method Details

#get_campaign(config = {}) ⇒ Object Also known as: request_campaign



14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/gooddata_marketo/models/campaigns.rb', line 14

def get_campaign config = {}

  request = {
      :source => config[:source] || "MKTOWS",
      :campaign_id => config[:id],
      :lead_list => {
          :lead_key => {
              :key_type => config[:type] || "EMAIL",
              :key_value => config[:lead] || config[:email] || config[:id] || config[:value]
          }
      }
  }

  client.call(:request_campaign, request)
end

#get_campaigns_for_source(config = {}) ⇒ Object



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/gooddata_marketo/models/campaigns.rb', line 32

def get_campaigns_for_source config = {} # http://developers.marketo.com/documentation/soap/getcampaignsforsource/

  # Ensure exact_name key is added to request if name key.
  if config.has_key? :name
      config[:exact_name] = "false" unless config.has_key? :exact_name
  end

  default = {
      :source => "MKTOWS"
      #:name => "Trigger", <-- Optional
      #:exact_name => "false" <-- Optional
  }

  request = default.merge(config)

  client.call(:get_campaigns_for_source, request)

end