class Gophr::Jobs::Base
Attributes
options[RW]
Public Class Methods
new(options = {})
click to toggle source
# File lib/gophr/jobs/base.rb, line 6 def initialize(options = {}) @options = options end
Public Instance Methods
call()
click to toggle source
# File lib/gophr/jobs/base.rb, line 10 def call response = HTTParty.post(url, headers: headers, body: body) if response.code == 200 response = response.parsed_response if response['success'] == true response else Gophr::APIError.new(response) end else Gophr::HTTPError.new(response) end end
Protected Instance Methods
api_url()
click to toggle source
# File lib/gophr/jobs/base.rb, line 28 def api_url Gophr.api_url end
body()
click to toggle source
# File lib/gophr/jobs/base.rb, line 36 def body { api_key: Gophr.api_key }.merge!(options) end
headers()
click to toggle source
# File lib/gophr/jobs/base.rb, line 32 def headers { 'Content-Type' => 'application/x-www-form-urlencoded' } end