Class: ET::CUDSupportRest

Inherits:
GetSupportRest show all
Defined in:
lib/exact-target-api/cud_support_rest.rb

Direct Known Subclasses

Campaign, ET::Campaign::Asset

Instance Attribute Summary

Attributes inherited from GetSupportRest

#lastPageNumber, #urlProps, #urlPropsRequired

Attributes inherited from BaseObject

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

Instance Method Summary collapse

Methods inherited from GetSupportRest

#get, #getMoreResults

Methods inherited from BaseObject

#stringify_keys!, #symbolize_keys!

Constructor Details

#initializeCUDSupportRest

Returns a new instance of CUDSupportRest.



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

def initialize
  super
end

Instance Method Details

#deleteObject



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/exact-target-api/cud_support_rest.rb', line 52

def delete
  completeURL = @endpoint
  # All URL Props are required when doing Patch
  @urlProps.each do |value|
    if !@props || !@props.has_key?(value) then
      raise "Unable to process request due to missing required prop: #{value}"
    end
  end

  if @props and @props.is_a? Hash then
    @props.each do |k,v|
      if @urlProps.include?(k) then
        completeURL.sub!("{#{k}}", v)
      end
    end
  end

  ET::DeleteRest.new(@authStub, completeURL)
end

#patchObject



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# File 'lib/exact-target-api/cud_support_rest.rb', line 32

def patch
  completeURL = @endpoint
  # All URL Props are required when doing Patch
  @urlProps.each do |value|
    if !@props || !@props.has_key?(value) then
      raise "Unable to process request due to missing required prop: #{value}"
    end
  end

  if @props and @props.is_a? Hash then
    @props.each do |k,v|
      if @urlProps.include?(k) then
        completeURL.sub!("{#{k}}", v)
      end
    end
  end

  ET::PatchRest.new(@authStub, completeURL, @props)
end

#postObject



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/exact-target-api/cud_support_rest.rb', line 7

def post
  completeURL = @endpoint

  if @props and @props.is_a? Hash then
    @props.each do |k,v|
      if @urlProps.include?(k) then
        completeURL.sub!("{#{k}}", v)
      end
    end
  end

  @urlPropsRequired.each do |value|
    if !@props || !@props.has_key?(value) then
      raise "Unable to process request due to missing required prop: #{value}"
    end
  end

  # Clean Optional Parameters from Endpoint URL first
  @urlProps.each do |value|
    completeURL.sub!("/{#{value}}", "")
  end

  ET::PostRest.new(@authStub, completeURL, @props)
end