Sha256: fc46e0a3ff04635d5e71e85fcd8fecf496f71c7fb727dfad3eafd4a01ca8cda1

Contents?: true

Size: 1.53 KB

Versions: 5

Compression:

Stored size: 1.53 KB

Contents

require 'eloqua/api'

module Eloqua

  class Api
    class Action

      cattr_reader :type_methods
      @@type_methods = [:list_external_action_steps_by_type, :get_member_count_in_step_by_status, :list_members_in_step_by_status, :set_member_status]

      class << self

        delegate :builder, :remote_type, :to => Eloqua::Api

        def get_member_count_in_step_by_status(stepId, status)
          xml_query = builder do |xml|
            xml.tag!(:stepId, stepId)
            xml.tag!(:status, status)
          end
          results = request(:get_member_count_in_step_by_status, xml_query)
          results = results.to_i
        end

        #still seems finicky, returns a funky hash table if there are no members in that step
        def list_members_in_step_by_status(stepId, status, pageNumber, pageSize)
          xml_query = builder do |xml|
            xml.tag!(:stepId, stepId)
            xml.tag!(:status, status)
            xml.tag!(:pageNumber, pageNumber)
            xml.tag!(:pageSize, pageSize)
          end
          results = request(:list_members_in_step_by_status, xml_query)
        end

        def set_member_status(arrayOfMember, status)
          xml_query = builder do |xml|
            xml.tag!("members") do
              xml.template!(:member_array, arrayOfMember)
            end
            xml.tag!(:status, status)
          end
          results = request(:set_member_status, xml_query)
        end

        def request(*args)
          Eloqua::Api.request(:action, *args)
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
eloqua-1.2.4 lib/eloqua/api/action.rb
eloqua-1.2.3 lib/eloqua/api/action.rb
eloqua-1.2.2 lib/eloqua/api/action.rb
eloqua-1.2.1 lib/eloqua/api/action.rb
eloqua-1.2.0 lib/eloqua/api/action.rb