Class: Services

Inherits:
Object
  • Object
show all
Defined in:
lib/jirarest2/services.rb

Overview

Trying to keep the services together in one class so I don’t have to write so much

Direct Known Subclasses

Comment, IssueLink, IssueLinkType, Watcher

Instance Method Summary collapse

Constructor Details

#initialize(connection) ⇒ Services

Returns a new instance of Services.

Parameters:

  • connection (Connection)

    A connection Object



24
25
26
27
28
# File 'lib/jirarest2/services.rb', line 24

def initialize(connection)
  @connection = connection
# to be set in each subclass;
#    @uritail = ""
end

Instance Method Details

#delete(data = "") ⇒ Result

Send the DELETE request

Parameters:

  • data (Hash) (defaults to: "")

    to be sent to Connection.execute

Returns:

  • (Result)

    The result as constructed by Connection.execute



48
49
50
# File 'lib/jirarest2/services.rb', line 48

def delete(data = "")
  return @connection.execute("Delete",@uritail,data)
end

#get(data = "") ⇒ Hash

Send the GET request

Parameters:

  • data (Hash, String) (defaults to: "")

    to be sent to Connection.execute

Returns:

  • (Hash)

    The result as constructed by Connection.execute transformed from a json hash



33
34
35
# File 'lib/jirarest2/services.rb', line 33

def get(data = "")
  return @connection.execute("Get",@uritail,data).result
end

#post(data = "") ⇒ Result

Send the POST request

Parameters:

  • data (Hash) (defaults to: "")

    to be sent to Connection.execute

Returns:

  • (Result)

    The result as constructed by Connection.execute



41
42
43
# File 'lib/jirarest2/services.rb', line 41

def post(data = "")
  return @connection.execute("Post",@uritail,data)
end

#put(data = "") ⇒ Hash

Send the PUT request

Parameters:

  • data (HASH) (defaults to: "")

    to be sent to Connection.execute

Returns:

  • (Hash)

    The result as constructed by Connection.execute transformed from a json hash



55
56
57
# File 'lib/jirarest2/services.rb', line 55

def put(data = "")
  return @connection.execute("Put",@uritail,data).result
end