Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

41 lines (32 sloc) 0.675 kb
class Service::Gemnasium < Service
string :user, :token
def receive_push
http.basic_auth(user, signature)
http_post(url, body, headers)
end
def http(*)
super.tap{|h| h.builder.delete(Faraday::Request::UrlEncoded) }
end
def user
data["user"].strip
rescue
raise_config_error "Invalid user value"
end
def signature
Digest::SHA2.hexdigest(token + body)
end
def token
data["token"].strip.downcase
rescue
raise_config_error "Invalid token value"
end
def body
payload.to_json
end
def url
"https://gemnasium.com/repositories/hook"
end
def headers
{:content_type => "application/json"}
end
end
Jump to Line
Something went wrong with that request. Please try again.