Class: LHS::Proxy
- Inherits:
-
Object
- Object
- LHS::Proxy
- Defined in:
- lib/lhs/proxy.rb,
lib/lhs/concerns/proxy/link.rb,
lib/lhs/concerns/proxy/create.rb
Overview
require File.dirname(__FILE__) + ‘/../../proxy’
Direct Known Subclasses
Defined Under Namespace
Instance Attribute Summary collapse
-
#_data ⇒ Object
prevent clashing with attributes of underlying data.
-
#_loaded ⇒ Object
prevent clashing with attributes of underlying data.
Instance Method Summary collapse
-
#initialize(data) ⇒ Proxy
constructor
A new instance of Proxy.
- #load!(options = nil) ⇒ Object
- #reload!(options = nil) ⇒ Object
Methods included from Create
Constructor Details
#initialize(data) ⇒ Proxy
Returns a new instance of Proxy.
13 14 15 16 |
# File 'lib/lhs/proxy.rb', line 13 def initialize(data) self._data = data self._loaded = false end |
Instance Attribute Details
#_data ⇒ Object
prevent clashing with attributes of underlying data
11 12 13 |
# File 'lib/lhs/proxy.rb', line 11 def _data @_data end |
#_loaded ⇒ Object
prevent clashing with attributes of underlying data
11 12 13 |
# File 'lib/lhs/proxy.rb', line 11 def _loaded @_loaded end |
Instance Method Details
#load!(options = nil) ⇒ Object
18 19 20 21 |
# File 'lib/lhs/proxy.rb', line 18 def load!( = nil) return self if _loaded reload!() end |
#reload!(options = nil) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/lhs/proxy.rb', line 23 def reload!( = nil) raise 'No href found' unless _data.href = {} if .blank? data = _data.class.request(.merge(url: _data.href, method: :get)) _data.merge_raw!(data) self._loaded = true self end |