Class: Swrve::Api::Resources
- Inherits:
-
Object
- Object
- Swrve::Api::Resources
- Extended by:
- Forwardable
- Defined in:
- lib/swrve/api/resources.rb
Instance Method Summary collapse
-
#initialize ⇒ Resources
constructor
A new instance of Resources.
- #resource(uuid, test_name, timestamp = nil) ⇒ Object
- #resources(uuid, timestamp = nil) ⇒ Object
- #resources_diff(uuid, timestamp = nil) ⇒ Object
Constructor Details
#initialize ⇒ Resources
Returns a new instance of Resources.
13 14 15 |
# File 'lib/swrve/api/resources.rb', line 13 def initialize @resources_endpoint = Middleware::Http.new(Swrve.config.ab_test_url + "/api/#{Swrve.config.api_version}") end |
Instance Method Details
#resource(uuid, test_name, timestamp = nil) ⇒ Object
17 18 19 |
# File 'lib/swrve/api/resources.rb', line 17 def resource(uuid, test_name, = nil) convert_to_bools(resources(uuid, ).detect{ |exists| exists['uid'] == test_name } || {}) end |
#resources(uuid, timestamp = nil) ⇒ Object
21 22 23 24 |
# File 'lib/swrve/api/resources.rb', line 21 def resources(uuid, = nil) return local_resources if Swrve.config.load_local_resources remote_resources(uuid, true, ) end |
#resources_diff(uuid, timestamp = nil) ⇒ Object
26 27 28 29 |
# File 'lib/swrve/api/resources.rb', line 26 def resources_diff(uuid, = nil) return local_resources if Swrve.config.load_local_resources remote_resources(uuid, false, ) end |