Class: SFRest::Stage
- Inherits:
-
Object
- Object
- SFRest::Stage
- Defined in:
- lib/sfrest/stage.rb
Overview
Find Staging envs and stage a set of sites
Instance Method Summary collapse
-
#enhanced_stage(env: 'test', sites: nil, email_site_status: false, wipe_target_environment: false, synchronize_all_users: true, wipe_stacks: nil) ⇒ Integer
Stage a site using the new method rubocop:disable Metrics/ParameterLists.
-
#initialize(conn) ⇒ Stage
constructor
A new instance of Stage.
-
#list_staging_environments ⇒ Object
Query for available staging environments.
-
#stage(to_env = 'test', sites = nil, email_site_status = false, skip_gardener = false) ⇒ Integer
Stage a site rubocop: disable Style/OptionalBooleanParameter.
-
#staging_versions ⇒ Array
determine what version are available for staging.
Constructor Details
#initialize(conn) ⇒ Stage
Returns a new instance of Stage.
7 8 9 |
# File 'lib/sfrest/stage.rb', line 7 def initialize(conn) @conn = conn end |
Instance Method Details
#enhanced_stage(env: 'test', sites: nil, email_site_status: false, wipe_target_environment: false, synchronize_all_users: true, wipe_stacks: nil) ⇒ Integer
Stage a site using the new method rubocop:disable Metrics/ParameterLists
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/sfrest/stage.rb', line 39 def enhanced_stage(env: 'test', sites: nil, email_site_status: false, wipe_target_environment: false, synchronize_all_users: true, wipe_stacks: nil) raise InvalidApiVersion, staging_versions unless staging_versions.include? 2 payload = { 'to_env' => env, 'sites' => sites, 'detailed_status' => email_site_status, 'wipe_target_environment' => wipe_target_environment, 'synchronize_all_users' => synchronize_all_users, 'wipe_stacks' => wipe_stacks }.to_json @conn.post('/api/v2/stage', payload) end |
#list_staging_environments ⇒ Object
Query for available staging environments
59 60 61 62 |
# File 'lib/sfrest/stage.rb', line 59 def list_staging_environments current_path = "/api/v#{staging_versions.sample}/stage" @conn.get(current_path) end |
#stage(to_env = 'test', sites = nil, email_site_status = false, skip_gardener = false) ⇒ Integer
Stage a site rubocop: disable Style/OptionalBooleanParameter
19 20 21 22 23 24 25 26 |
# File 'lib/sfrest/stage.rb', line 19 def stage(to_env = 'test', sites = nil, email_site_status = false, skip_gardener = false) raise InvalidApiVersion, staging_versions unless staging_versions.include? 1 payload = { 'to_env' => to_env, 'sites' => sites, 'detailed_status' => email_site_status, 'skip_gardener' => skip_gardener }.to_json @conn.post('/api/v1/stage', payload) end |
#staging_versions ⇒ Array
determine what version are available for staging
66 67 68 69 70 71 72 73 74 75 76 |
# File 'lib/sfrest/stage.rb', line 66 def staging_versions possible_versions = [1, 2] @versions ||= [] possible_versions.each do |version| @conn.get "/api/v#{version}/stage" @versions.push version rescue SFRest::InvalidResponse nil end @versions end |