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

OrganizationsOrganization   A

Complexity

Total Complexity 3

Size/Duplication

Total Lines 20
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 20
rs 10
wmc 3

2 Methods

Rating   Name   Duplication   Size   Complexity  
A id() 0 3 2
A resource_via_client() 0 3 1
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