Class: RouteNGNClient::Model
- Inherits:
-
Object
- Object
- RouteNGNClient::Model
- Extended by:
- ClassMethods
- Includes:
- Logging
- Defined in:
- lib/routengn_client/model.rb
Direct Known Subclasses
AllowList, Contact, EndPoint, RemoteModel, Route, RouteContainer, URIMatcher
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#request_account_id ⇒ Object
Returns the value of attribute request_account_id.
Attributes included from ClassMethods
#children, #only_children, #parents
Instance Method Summary collapse
-
#initialize(attributes = {}) ⇒ Model
constructor
A new instance of Model.
- #to_hash ⇒ Object
- #to_json(pretty = false) ⇒ Object
- #to_log(options = {}) ⇒ Object
Methods included from ClassMethods
belongs_to, from_hash, from_json, has_many, has_one
Methods included from Logging
Constructor Details
#initialize(attributes = {}) ⇒ Model
Returns a new instance of Model.
7 8 9 10 11 12 13 |
# File 'lib/routengn_client/model.rb', line 7 def initialize(attributes = {}) @attributes = OpenStruct.new(attributes) @request_account_id = nil self.create_parent_accessors self.create_child_accessors self.create_only_child_accessors end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/routengn_client/model.rb', line 5 def attributes @attributes end |
#request_account_id ⇒ Object
Returns the value of attribute request_account_id.
5 6 7 |
# File 'lib/routengn_client/model.rb', line 5 def request_account_id @request_account_id end |
Instance Method Details
#to_hash ⇒ Object
15 16 17 |
# File 'lib/routengn_client/model.rb', line 15 def to_hash @attributes.marshal_dump end |
#to_json(pretty = false) ⇒ Object
19 20 21 |
# File 'lib/routengn_client/model.rb', line 19 def to_json(pretty = false) MultiJson.dump(self.to_hash, :pretty => pretty) end |
#to_log(options = {}) ⇒ Object
23 24 25 |
# File 'lib/routengn_client/model.rb', line 23 def to_log( = {}) self.to_json(true) end |