Completed
Pull Request — master (#367)
by
unknown
03:47
created

OrganizationsOrganization.id()   A

Complexity

Conditions 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
c 1
b 0
f 1
dl 0
loc 3
rs 10
1
module Awspec::Type
2
  class OrganizationsOrganization < ResourceBase
3
    def resource_via_client
4
      @resource_via_client ||= find_organization
5
    end
6
7
    def id
8
      @id ||= resource_via_client.id if resource_via_client
9
    end
10
11
    STATUSES = %w(
12
      ENABLED PENDING_ENABLE PENDING_DISABLE
13
    )
14
    STATUSES.each do |status|
15
      define_method "service_control_policy_#{status.downcase}?" do
16
        return false if resource_via_client.available_policy_types.size != 1
17
        policy = resource_via_client.available_policy_types.first
18
        policy.status == status
19
      end
20
    end
21
  end
22
end
23