Class: VexorCiService

Inherits:
Service
  • Object
show all
Defined in:
lib/vx/gitlab_status_service/vexor_ci_service.rb

Overview

Schema Information

Table name: services

id          :integer          not null, primary key
type        :string(255)
title       :string(255)
token       :string(255)
project_id  :integer          not null
created_at  :datetime         not null
updated_at  :datetime         not null
active      :boolean          default(FALSE), not null
project_url :string(255)
subdomain   :string(255)
room        :string(255)
api_key     :string(255)

Instance Method Summary collapse

Instance Method Details

#build_page(sha) ⇒ Object



39
40
41
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 39

def build_page(sha)
  project_url + "/builds/sha/#{sha}"
end

#builds_pathObject



43
44
45
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 43

def builds_path
  ""
end

#commit_status(sha) ⇒ Object



29
30
31
32
33
34
35
36
37
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 29

def commit_status(sha)
  response = HTTParty.get(commit_status_path(sha), verify: false)

  if response.code == 200 && response["status"]
    response["status"]
  else
    :error
  end
end

#commit_status_path(sha) ⇒ Object



25
26
27
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 25

def commit_status_path(sha)
  project_url + "/api/builds/sha/#{sha}.json?token=#{token}"
end

#descriptionObject



56
57
58
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 56

def description
  "Continuous integration server from Vexor"
end

#execute(push_data) ⇒ Object



71
72
73
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 71

def execute(push_data)
  # NOOP
end

#fieldsObject



64
65
66
67
68
69
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 64

def fields
  [
    { type: "text", name: "token", placeholder: "Vexor CI project specific token" },
    { type: "text", name: "project_url", placeholder: "http://ci.vexor.io/projects/3"}
  ]
end

#status_img_pathObject



47
48
49
50
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 47

def status_img_path
  # project_url + "/status.png?ref=" + project.default_branch
  ""
end

#titleObject



52
53
54
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 52

def title
  "Vexor CI"
end

#to_paramObject



60
61
62
# File 'lib/vx/gitlab_status_service/vexor_ci_service.rb', line 60

def to_param
  "vexor_ci"
end