Class: SML::GetList::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/ruby-sml/sml-getlist.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client_id, server_id, list_name, act_sensor_time, value_list, list_signature, act_gateway_time) ⇒ Response

Returns a new instance of Response.



44
45
46
47
48
49
50
51
52
# File 'lib/ruby-sml/sml-getlist.rb', line 44

def initialize(client_id, server_id, list_name, act_sensor_time, value_list, list_signature, act_gateway_time)
  @client_id = client_id
  @server_id = server_id
  @list_name = list_name
  @act_sensor_time = act_sensor_time
  @value_list = value_list
  @list_signature = list_signature
  @act_gateway_time = act_gateway_time
end

Instance Attribute Details

#act_gateway_timeObject

Returns the value of attribute act_gateway_time.



42
43
44
# File 'lib/ruby-sml/sml-getlist.rb', line 42

def act_gateway_time
  @act_gateway_time
end

#act_sensor_timeObject

Returns the value of attribute act_sensor_time.



42
43
44
# File 'lib/ruby-sml/sml-getlist.rb', line 42

def act_sensor_time
  @act_sensor_time
end

#client_idObject

Returns the value of attribute client_id.



42
43
44
# File 'lib/ruby-sml/sml-getlist.rb', line 42

def client_id
  @client_id
end

#list_nameObject

Returns the value of attribute list_name.



42
43
44
# File 'lib/ruby-sml/sml-getlist.rb', line 42

def list_name
  @list_name
end

#list_signatureObject

Returns the value of attribute list_signature.



42
43
44
# File 'lib/ruby-sml/sml-getlist.rb', line 42

def list_signature
  @list_signature
end

#server_idObject

Returns the value of attribute server_id.



42
43
44
# File 'lib/ruby-sml/sml-getlist.rb', line 42

def server_id
  @server_id
end

#value_listObject

Returns the value of attribute value_list.



42
43
44
# File 'lib/ruby-sml/sml-getlist.rb', line 42

def value_list
  @value_list
end

Class Method Details

.construct(array_rep) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
# File 'lib/ruby-sml/sml-getlist.rb', line 54

def self.construct(array_rep)
  return nil if array_rep.nil?
  client_id = array_rep.shift
  server_id = array_rep.shift
  list_name = array_rep.shift
  act_sensor_time = SML::Time.construct(array_rep.shift)
  value_list = []
  array_rep.shift.each do |entry_array_rep|
    entry = SML::ListEntry.construct(entry_array_rep)
    return nil if entry.nil?
    value_list << entry
  end
  list_signature = array_rep.shift
  act_gateway_time = SML::Time.construct(array_rep.shift)

  return SML::GetList::Response.new(client_id, server_id, list_name, act_sensor_time, value_list, list_signature, act_gateway_time)
end

.pconstruct(o = {}) ⇒ Object



72
73
74
# File 'lib/ruby-sml/sml-getlist.rb', line 72

def self.pconstruct(o={})
  return SML::GetList::Response.new(o[:client_id], o[:server_id], o[:list_name], o[:act_sensor_time], o[:value_list], o[:list_signature], o[:act_gateway_time])
end

Instance Method Details

#to_aObject



76
77
78
79
80
81
82
83
# File 'lib/ruby-sml/sml-getlist.rb', line 76

def to_a
  value_list_array = []
  value_list.each do |value|
    value_list_array << value.to_a
  end

  return [] << client_id << server_id << list_name << act_sensor_time.to_a << value_list_array << list_signature << act_gateway_time.to_a
end