class Codeship::Projects
Public Class Methods
new(api_key = nil)
click to toggle source
# File lib/codeship/projects.rb, line 10 def initialize api_key = nil @api_key = api_key end
Public Instance Methods
list()
click to toggle source
# File lib/codeship/projects.rb, line 14 def list raise ArgumentError, 'You need to set API key' if !@api_key resp = http_request.request_get projects_url handle(resp)['projects'] end
project(id)
click to toggle source
# File lib/codeship/projects.rb, line 20 def project id raise ArgumentError, 'You need to set API key' if !@api_key @project_id = id resp = http_request.request_get projects_url handle(resp) end
Private Instance Methods
projects_url()
click to toggle source
# File lib/codeship/projects.rb, line 29 def projects_url url = "/api/v1/projects.json" url = "/api/v1/projects/#{@project_id}.json" if @project_id url << "?api_key=#{@api_key}" url end