Sha256: 8346aa1a69c5a5011db5582d3df478f490e6e3f6554e0016866ef542676eb46f

Contents?: true

Size: 1.01 KB

Versions: 3

Compression:

Stored size: 1.01 KB

Contents

class Ey::Core::Client
  class Real
    def destroy_firewall_rule(params={})
      id  = params["id"]
      url = params.delete("url")

      request(
        :path   => "/firewall-rules/#{id}",
        :url    => url,
        :method => :delete,
      )
    end
  end

  class Mock
    def destroy_firewall_rule(params={})
      extract_url_params!(params)
      request_id = self.uuid

      firewall_rule_id = params["id"] || params["firewall_rule"]

      firewall_rule = self.find(:firewall_rules, firewall_rule_id)

      request = {
        "type"        => "deprovision_firewall_rule",
        "started_at"  => Time.now,
        "finished_at" => nil,
        "successful"  => "true",
        "id"          => request_id,
      }

      self.data[:requests][request_id] = request.merge(
        "resource" => [:firewall_rules, firewall_rule_id, firewall_rule.merge("deleted_at" => Time.now)],
      )

      response(
        :body => {"request" => request},
      )
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
ey-core-3.6.6 lib/ey-core/requests/destroy_firewall_rule.rb
ey-core-3.4.5 lib/ey-core/requests/destroy_firewall_rule.rb
ey-core-3.6.5 lib/ey-core/requests/destroy_firewall_rule.rb