class ThreeScaleToolbox::Entities::ProxyConfig
Attributes
environment[R]
remote[R]
service[R]
version[R]
Public Class Methods
find(service:, environment:, version:)
click to toggle source
# File lib/3scale_toolbox/entities/proxy_config.rb, line 5 def find(service:, environment:, version:) new(service: service, environment: environment, version: version).tap(&:attrs) rescue ThreeScale::API::HttpClient::NotFoundError nil end
find_latest(service:, environment:)
click to toggle source
# File lib/3scale_toolbox/entities/proxy_config.rb, line 11 def find_latest(service:, environment:) proxy_cfg = service.remote.proxy_config_latest(service.id, environment) if (errors = proxy_cfg['errors']) raise ThreeScaleToolbox::ThreeScaleApiError.new('ProxyConfig find_latest not read', errors) end new(service: service, environment: environment, version: proxy_cfg["version"], attrs: proxy_cfg) rescue ThreeScale::API::HttpClient::NotFoundError nil end
new(environment:, service:, version:, attrs: nil)
click to toggle source
# File lib/3scale_toolbox/entities/proxy_config.rb, line 24 def initialize(environment:, service:, version:, attrs: nil) @remote = service.remote @service = service @environment = environment @version = version @attrs = attrs end
Public Instance Methods
attrs()
click to toggle source
# File lib/3scale_toolbox/entities/proxy_config.rb, line 32 def attrs @attrs ||= proxy_config_attrs end
promote(to:)
click to toggle source
# File lib/3scale_toolbox/entities/proxy_config.rb, line 36 def promote(to:) res = remote.promote_proxy_config(service.id, environment, version, to) if (errors = res['errors']) raise ThreeScaleToolbox::ThreeScaleApiError.new('ProxyConfig not promoted', errors) end res end
Private Instance Methods
proxy_config_attrs()
click to toggle source
# File lib/3scale_toolbox/entities/proxy_config.rb, line 47 def proxy_config_attrs proxy_cfg = remote.show_proxy_config(service.id, environment, version) if (errors = proxy_cfg['errors']) raise ThreeScaleToolbox::ThreeScaleApiError.new('ProxyConfig not read', errors) end proxy_cfg end