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: [], email_site_status: false, wipe_target_environment: false, synchronize_all_users: true, wipe_stacks: [], skip_site_files: false, skip_site_files_overwrite: [], force_psu_hook: false) ⇒ 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, Metrics/ParameterLists.
-
#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: [], email_site_status: false, wipe_target_environment: false, synchronize_all_users: true, wipe_stacks: [], skip_site_files: false, skip_site_files_overwrite: [], force_psu_hook: false) ⇒ Integer
Stage a site using the new method rubocop:disable Metrics/ParameterLists
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/sfrest/stage.rb', line 42 def enhanced_stage(env: 'test', sites: [], email_site_status: false, wipe_target_environment: false, synchronize_all_users: true, wipe_stacks: [], skip_site_files: false, skip_site_files_overwrite: [], force_psu_hook: false) 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, 'skip_site_files' => skip_site_files, 'skip_site_files_overwrite' => skip_site_files_overwrite, 'force_psu_hook' => force_psu_hook }.to_json @conn.post('/api/v2/stage', payload) end |
#list_staging_environments ⇒ Object
Query for available staging environments
68 69 70 71 |
# File 'lib/sfrest/stage.rb', line 68 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, Metrics/ParameterLists
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
75 76 77 78 79 80 81 82 83 84 85 |
# File 'lib/sfrest/stage.rb', line 75 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 |