Sha256: f53c1b5995676f25208e408e11fcfdfb9a1f90ba0043d210fa278b08e5ea5b6a

Contents?: true

Size: 978 Bytes

Versions: 2

Compression:

Stored size: 978 Bytes

Contents

module Paddle
  class Simulation < Object
    class << self
      def list(**params)
        response = Client.get_request("simulations", params: params)
        Collection.from_response(response, type: Simulation)
      end

      def create(setting_id:, name:, type:, **params)
        attrs = { notification_setting_id: setting_id, name: name, type: type }
        response = Client.post_request("simulations", body: attrs.merge(params))
        Simulation.new(response.body["data"])
      end

      def retrieve(id:)
        response = Client.get_request("simulations/#{id}")
        Simulation.new(response.body["data"])
      end

      def update(id:, **params)
        response = Client.patch_request("simulations/#{id}", body: params)
        Simulation.new(response.body["data"])
      end

      def runs(id:)
        response = Client.get_request("simulations/#{id}/runs")
        Collection.from_response(response, type: SimulationRun)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
paddle-2.7.0 lib/paddle/models/simulation.rb
paddle-2.6.0 lib/paddle/models/simulation.rb