Class: Envirobly::Target

Inherits:
Object
  • Object
show all
Defined in:
lib/envirobly/target.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(default_account_id: nil, default_project_id: nil, default_region: nil, default_project_name: nil, default_environ_name: nil, account_id: nil, project_id: nil, region: nil, project_name: nil, environ_name: nil) ⇒ Target

Returns a new instance of Target.



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
# File 'lib/envirobly/target.rb', line 7

def initialize(
    default_account_id: nil,
    default_project_id: nil,
    default_region: nil,
    default_project_name: nil,
    default_environ_name: nil,
    account_id: nil,
    project_id: nil,
    region: nil,
    project_name: nil,
    environ_name: nil
  )
  @default_account_id = 
  @default_project_id = default_project_id
  @default_region = default_region
  @default_project_name = default_project_name
  @default_environ_name = default_environ_name
  @account_id = 
  @project_id = project_id
  @region = region
  @project_name = project_name
  @environ_name = environ_name
end

Instance Attribute Details

#account_idObject

Returns the value of attribute account_id.



5
6
7
# File 'lib/envirobly/target.rb', line 5

def 
  @account_id
end

#project_idObject

Returns the value of attribute project_id.



5
6
7
# File 'lib/envirobly/target.rb', line 5

def project_id
  @project_id
end

#regionObject

Returns the value of attribute region.



5
6
7
# File 'lib/envirobly/target.rb', line 5

def region
  @region
end

Instance Method Details

#environ_nameObject



61
62
63
# File 'lib/envirobly/target.rb', line 61

def environ_name
  @environ_name.presence || @default_environ_name
end

#ignored_paramsObject



71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/envirobly/target.rb', line 71

def ignored_params
  [].tap do |result|
    if @account_id && @project_id
      result << :account_id
    end

    if @project_id && @region
      result << :region
    end

    if @project_id && @project_name.present?
      result << :project_name
    end
  end
end

#missing_paramsObject



31
32
33
34
35
36
37
38
39
40
41
# File 'lib/envirobly/target.rb', line 31

def missing_params
  [].tap do |result|
    if project_id.blank? && .blank?
      result << :account_id
    end

    if project_id.blank? && region.blank?
      result << :region
    end
  end
end

#project_nameObject



55
56
57
58
59
# File 'lib/envirobly/target.rb', line 55

def project_name
  return if @project_id

  @project_name.presence || @default_project_name
end