diff options
| author | Luc Donnet | 2015-03-23 21:12:56 +0100 | 
|---|---|---|
| committer | Luc Donnet | 2015-03-23 21:12:56 +0100 | 
| commit | fa7e745459aefd64086869882fcca73f948b46fa (patch) | |
| tree | a5df17d4498b4ca612f6398156a667d2593cc76e /lib/ievkit/client/jobs.rb | |
| parent | 0740decc6a2c5117d1dc89e3665774460626f86b (diff) | |
| download | chouette-core-fa7e745459aefd64086869882fcca73f948b46fa.tar.bz2 | |
Change ruby client for iev server
Diffstat (limited to 'lib/ievkit/client/jobs.rb')
| -rw-r--r-- | lib/ievkit/client/jobs.rb | 49 | 
1 files changed, 49 insertions, 0 deletions
diff --git a/lib/ievkit/client/jobs.rb b/lib/ievkit/client/jobs.rb new file mode 100644 index 000000000..a530b2527 --- /dev/null +++ b/lib/ievkit/client/jobs.rb @@ -0,0 +1,49 @@ +module Ievkit +  class Client +    module Jobs + +      # List jobs for a referential +      # +      # @param referential [String] Data referential name.  +      # @return [Array<Sawyer::Resource>] A list of jobs +      # @example Fetch all jobs for referential test +      #   client.jobs("test") +      def jobs(referential, options = {}) +        paginate "referentials/#{referential}/jobs", options +      end +       +      # Get scheduled job +      # +      # @param referential [String] Data referential name. +      # @param job_id [Integer] Id of the scheduled job. +      # @return [Sawyer::Resource] Hash representing scheduled job. +      # @example +      #   client.scheduled_job('test', 1451398) +      def scheduled_job(referential, job_id, options = {}) +        get "referentials/#{referential}/scheduled_jobs/#{job_id}", options +      end + +      # Get terminated job +      # +      # @param referential [String] Data referential name. +      # @param job_id [Integer] Id of the terminated job. +      # @return [Sawyer::Resource] Hash representing terminated job. +      # @example +      #   client.terminated_job('test', 1451399) +      def terminated_job(referential, job_id, options = {}) +        get "referentials/#{referential}/terminated_jobs/#{job_id}", options +      end + +      # Create job  +      # +      # @param referential [String] Data referential name. +      # @return [Sawyer::Resource] Hash representing the new job. +      # @example +      #   client.create_job("test",....) +      def create_job(referential, options = {}) +        post "jobs", options +      end +       +    end +  end +end  | 
