<commit_before>require 'fog/core/model'

module Fog
  module HP
    class Network

      class Network < Fog::Model
        identity :id

        attribute :name
        attribute :tenant_id
        attribute :status
        attribute :subnets
        attribute :shared
        attribute :admin_state_up
        attribute :router_external,    :aliases => 'router:external'

        def destroy
          requires :id
          service.delete_network(id)
          true
        end

        def save
          identity ? update : create
        end

        private

        def create
          merge_attributes(service.create_network(attributes).body['network'])
          true
        end

        def update
          requires :id
          merge_attributes(service.update_network(id, attributes).body['network'])
          true
        end

      end
    end
  end
end<commit_msg>[hp|network] Add a ready? method to the network model.<commit_after>require 'fog/core/model'

module Fog
  module HP
    class Network

      class Network < Fog::Model
        identity :id

        attribute :name
        attribute :tenant_id
        attribute :status
        attribute :subnets
        attribute :shared
        attribute :admin_state_up
        attribute :router_external,    :aliases => 'router:external'

        def destroy
          requires :id
          service.delete_network(id)
          true
        end

        def ready?
          self.status == 'ACTIVE'
        end

        def save
          identity ? update : create
        end

        private

        def create
          merge_attributes(service.create_network(attributes).body['network'])
          true
        end

        def update
          requires :id
          merge_attributes(service.update_network(id, attributes).body['network'])
          true
        end

      end
    end
  end
end
{'fraction_non_alphanumeric': 0.0624, 'fraction_numerical': 0.0, 'mean_word_length': 1.6497175141242937, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6870806', 'n_tokens_mistral': 480, 'n_tokens_neox': 462, 'n_words': 132}