Class: Orange::Radius
- Inherits:
-
Resource
show all
- Defined in:
- lib/orange-more/slices/resources/radius.rb
Overview
Radius resource is for exposing the Radius context and allowing parsing.
Instance Method Summary
collapse
Methods inherited from Resource
call_me, #do_view, #find_extras, #init, #initialize, #options, #orange, #orange_name, #routable, #set_orange, set_orange, #view, #view_opts
#cattr_accessor, #cattr_reader, #cattr_writer, eval_in_accessor_module, fetch_value, store_value
Instance Method Details
#afterLoad ⇒ Object
8
9
10
11
12
|
# File 'lib/orange-more/slices/resources/radius.rb', line 8
def afterLoad
@context = ::Radius::PacketContext.new
@defined_tags = []
orange.fire(:radius_loaded, self)
end
|
14
15
16
|
# File 'lib/orange-more/slices/resources/radius.rb', line 14
def context
@context
end
|
#define_tag(*args, &block) ⇒ Object
22
23
24
25
|
# File 'lib/orange-more/slices/resources/radius.rb', line 22
def define_tag(*args, &block)
@defined_tags << args.first unless @defined_tags.include? args.first
@context.define_tag(*args, &block)
end
|
18
19
20
|
# File 'lib/orange-more/slices/resources/radius.rb', line 18
def defined_tags
@defined_tags
end
|
#parse(packet) ⇒ Object
35
36
37
38
39
40
41
|
# File 'lib/orange-more/slices/resources/radius.rb', line 35
def parse(packet)
content = packet[:content, false]
unless content.blank?
parser = ::Radius::PacketParser.new(context, :tag_prefix => 'o')
packet[:content] = parser.parse(content, packet)
end
end
|
#parse_text(packet, text = false) ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/orange-more/slices/resources/radius.rb', line 27
def parse_text(packet, text = false)
content = text
unless content.blank?
parser = ::Radius::PacketParser.new(context, :tag_prefix => 'o')
parser.parse(content, packet)
end
end
|