Class: Ronan::Base
- Inherits:
-
Object
- Object
- Ronan::Base
- Defined in:
- lib/ronan/base.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(**attributes) ⇒ Base
constructor
A new instance of Base.
- #method_missing(method, *args) ⇒ Object
Constructor Details
#initialize(**attributes) ⇒ Base
Returns a new instance of Base.
14 15 16 |
# File 'lib/ronan/base.rb', line 14 def initialize(**attributes) self.attributes = attributes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args) ⇒ Object
18 19 20 21 |
# File 'lib/ronan/base.rb', line 18 def method_missing(method, *args) method = method.to_sym unless method.is_a?(Symbol) return attributes[method] || super end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
5 6 7 |
# File 'lib/ronan/base.rb', line 5 def attributes @attributes end |
Class Method Details
.get(path, symbolize: true, **params, &block) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/ronan/base.rb', line 7 def self.get(path, symbolize: true, **params, &block) uri = build_uri(path, params) res = Net::HTTP.get_response(uri) raise HttpError.new(res) unless res.is_a?(Net::HTTPSuccess) deserialize(res.body, symbolize: symbolize, &block) end |