Class: ET::List

Inherits:
CUDSupport show all
Defined in:
lib/exact-target-api/list.rb,
lib/exact-target-api/list_subscriber.rb

Defined Under Namespace

Classes: Subscriber

Instance Attribute Summary collapse

Attributes inherited from GetSupport

#filter

Attributes inherited from BaseObject

#client, #endpoint, #lastRequestID, #obj, #props

Instance Method Summary collapse

Methods inherited from CUDSupport

#delete, #patch, #post

Methods inherited from GetSupport

#get, #get_more_results, #info

Methods inherited from BaseObject

#stringify_keys!, #symbolize_keys!

Constructor Details

#initialize(client) ⇒ List

Returns a new instance of List.



5
6
7
8
9
# File 'lib/exact-target-api/list.rb', line 5

def initialize(client)
  super()
  @obj = 'List'
  @client = client
end

Instance Attribute Details

#codeObject (readonly)

Returns the value of attribute code.



3
4
5
# File 'lib/exact-target-api/list.rb', line 3

def code
  @code
end

#list_idObject (readonly)

Returns the value of attribute list_id.



3
4
5
# File 'lib/exact-target-api/list.rb', line 3

def list_id
  @list_id
end

#messageObject (readonly)

Returns the value of attribute message.



3
4
5
# File 'lib/exact-target-api/list.rb', line 3

def message
  @message
end

#statusObject (readonly)

Returns the value of attribute status.



3
4
5
# File 'lib/exact-target-api/list.rb', line 3

def status
  @status
end

Instance Method Details

#create(params) ⇒ Object

Example: “NewListName”, Description: “This list was created with the RubySDK”, Type: “Private”



17
18
19
20
21
22
23
24
25
# File 'lib/exact-target-api/list.rb', line 17

def create(params)
  stringify_keys!(params)
  if (folder_id = params.delete('folder_id'))
    params['CategoryID'] = folder_id
  end
  res = post(params)
  assign_values(res)
  self
end

#destroy(id) ⇒ Object



50
51
52
# File 'lib/exact-target-api/list.rb', line 50

def destroy(id)
  delete('ID' => id.to_s)
end

#find(id) ⇒ Object



40
41
42
43
44
45
46
47
48
# File 'lib/exact-target-api/list.rb', line 40

def find(id)
  props = ["ID", "PartnerKey", "CreatedDate", "ModifiedDate", "Client.ID", "Client.PartnerClientKey", "ListName", "Description", "Category", "Type", "CustomerKey", "ListClassification", "AutomatedEmail.ID"]
  filter = {'Property' => 'ID', 'SimpleOperator' => 'equals', 'Value' => id.to_s}
  res = get(props, filter)

  assign_values(res)

  self
end

#idObject



11
12
13
# File 'lib/exact-target-api/list.rb', line 11

def id
  @list_id
end

#subscriberObject



54
55
56
# File 'lib/exact-target-api/list.rb', line 54

def subscriber
  ET::Subscriber.new(@client, @list_id)
end

#update(params) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
# File 'lib/exact-target-api/list.rb', line 27

def update(params)
  stringify_keys!(params)
  data = params.merge('ID' => @list_id)

  res = patch(data)

  puts "[DEBUG] List update: #{res.inspect}"

  raise('implement me')

  self
end