Sha256: 0c3ea6aba37449897d6d0c398a69ff02447ea7766026bc4a2c3486f180845eb4

Contents?: true

Size: 1.03 KB

Versions: 35

Compression:

Stored size: 1.03 KB

Contents

class OTRS::Change::State < OTRS::Change
  @@class = 'ITSM::ChangeManagement::Change::State'
  
  def self.set_accessor(key)
    attr_accessor key.to_sym
  end
  
  def persisted?
    false
  end
  
  def attributes
    attributes = {}
    self.instance_variables.each do |v|
      attributes[v.to_s.gsub('@','').to_sym] = self.instance_variable_get(v)
    end
    attributes
  end
  
  def initialize(attributes = {})
    attributes.each do |name, value|
      self.class.set_accessor(name.to_s.underscore)
      send("#{name.to_s.underscore.to_sym}=", value)
    end
  end
  
  def self.all
    data = { 'Class' => @@class, 'UserID' => 1 }
    params = { :object => 'StateMachineObject', :method => 'StateList', :data => data }
    a = connect(params).flatten
    b = self.superclass.superclass::Relation.new
    a.each do |c|
      tmp = {}
      c.each do |key,value|
        case key
        when "Key" then tmp[:id] = value
        when "Value" then tmp[:name] = value
        end
      end
      c = tmp
      b << new(c)
    end
    b
  end
    
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
otrs_connector-1.5.2 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.5.1 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.5.0 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.4.0 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.3.0 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.2.0 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.1.3 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.1.2 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.1.1 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.1.0 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.0.4 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.0.3 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.0.2 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.0.1 lib/otrs_connector/otrs/change/state.rb
otrs_connector-1.0.0 lib/otrs_connector/otrs/change/state.rb
otrs_connector-0.5.20 lib/otrs_connector/otrs/change/state.rb
otrs_connector-0.5.19 lib/otrs_connector/change/state.rb
otrs_connector-0.5.18 lib/otrs_connector/change/state.rb
otrs_connector-0.5.17 lib/otrs_connector/change/state.rb
otrs_connector-0.5.16 lib/otrs_connector/change/state.rb