Methods
G
O
Class Public methods
get_map(entries)

Gets a map from an array of map entries. A map entry is any object that has a key and value field.

Args:

  • entries: list of map entries

Returns:

  • hash constructed from map entries
# File lib/adwords4r/utils.rb, line 37
    def self.get_map(entries)
      map = {}
      entries.each do |entry|
        map[entry.key] = entry.value
      end
      return map
    end
operation_index_for_error(error)

Returns the source operation index for an error

Args:

  • error: the error to be analyzed

Returns:

  • index for the source operation, nil if none
# File lib/adwords4r/utils.rb, line 53
    def self.operation_index_for_error(error)
      if error and error.respond_to? :fieldPath and error.fieldPath
        parts = error.fieldPath.split('.')
        if parts.length > 0
          match = parts.first.match(/operations\[(\d)\]/)
          return match ? match[1].to_i : nil
        end
      end
      return nil
    end