Sha256: e29221f3a411d933f6b213e9676d8c2a04def7e9fc3d8b2e70ed6967b0d74fab

Contents?: true

Size: 1.18 KB

Versions: 1

Compression:

Stored size: 1.18 KB

Contents

# To change this template, choose Tools | Templates
# and open the template in the editor.
module Jiralicious
  class Issue
    class Watchers < Jiralicious::Base

      attr_accessor :jira_key

      def initialize(decoded_json = nil, default = nil, &blk)
        if (decoded_json != nil)
          properties_from_hash(decoded_json)
          super(decoded_json)
          parse!(decoded_json)
        end
      end

      class << self
        def find_by_key(key)
          response = fetch({:parent => parent_name, :parent_key => key})
          a = new(response)
          a.jira_key = key
          return a
        end

        def add(name, key)
          fetch({:method => :post, :body => name, :body_override => true, :parent => parent_name, :parent_key => key})
        end

        def remove(name, key)
          fetch({:method => :delete, :body_to_params => true, :body => {:username => name}, :parent => parent_name, :parent_key => key})
        end
      end

      def find
        self.class.find_by_key(@jira_key)
      end

      def add(name)
        self.class.add(name, @jira_key)
      end

      def remove(name)
        self.class.remove(name, @jira_key)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
jiralicious-0.2.0 lib/jiralicious/issue/watchers.rb