Class: CircuitApi::Resource
- Inherits:
-
Object
- Object
- CircuitApi::Resource
- Defined in:
- lib/circuit_api/resource.rb
Instance Attribute Summary collapse
-
#circuit_resource_type ⇒ Object
readonly
Returns the value of attribute circuit_resource_type.
Instance Method Summary collapse
-
#initialize(circuit_resource_type, attributes) ⇒ Resource
constructor
A new instance of Resource.
- #to_json(options = {}) ⇒ Object
Constructor Details
#initialize(circuit_resource_type, attributes) ⇒ Resource
Returns a new instance of Resource.
5 6 7 8 9 10 11 |
# File 'lib/circuit_api/resource.rb', line 5 def initialize(circuit_resource_type, attributes) @circuit_resource_type = circuit_resource_type attributes.each do |name, value| define_accessors(name) send("#{name}=".to_sym, value) end end |
Instance Attribute Details
#circuit_resource_type ⇒ Object (readonly)
Returns the value of attribute circuit_resource_type.
3 4 5 |
# File 'lib/circuit_api/resource.rb', line 3 def circuit_resource_type @circuit_resource_type end |
Instance Method Details
#to_json(options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/circuit_api/resource.rb', line 13 def to_json( = {}) instance_variables.each_with_object({}) do |variable, result| result[variable.to_s.delete('@')] = instance_variable_get(variable) end end |