Class: EmailCenterApi::Nodes::TemplateNode
- Inherits:
-
Object
- Object
- EmailCenterApi::Nodes::TemplateNode
- Defined in:
- lib/email_center_api/nodes/template_node.rb
Constant Summary collapse
- TREE_ROOT =
'email_template'
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#node_id ⇒ Object
readonly
Returns the value of attribute node_id.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, node_id) ⇒ TemplateNode
constructor
A new instance of TemplateNode.
Constructor Details
#initialize(name, node_id) ⇒ TemplateNode
Returns a new instance of TemplateNode.
7 8 9 10 |
# File 'lib/email_center_api/nodes/template_node.rb', line 7 def initialize(name, node_id) @name = name @node_id = node_id.to_i end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
5 6 7 |
# File 'lib/email_center_api/nodes/template_node.rb', line 5 def name @name end |
#node_id ⇒ Object (readonly)
Returns the value of attribute node_id.
5 6 7 |
# File 'lib/email_center_api/nodes/template_node.rb', line 5 def node_id @node_id end |
Class Method Details
.all ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/email_center_api/nodes/template_node.rb', line 12 def self.all response = EmailCenterApi::Query.new(TREE_ROOT).root response.first['children'].map do |template| self.new( template['text'], template['nodeId'] ) end end |