Sha256: 74e3ee4b19cc045644a5b058e198a1c70cbdfcc4f148435e503b4036633fe75e
Contents?: true
Size: 650 Bytes
Versions: 1
Compression:
Stored size: 650 Bytes
Contents
require 'httparty' module ShareProgress class Client include HTTParty base_uri 'run.shareprogress.org/api/v1' default_params key: ENV['SHARE_PROGRESS_API_KEY'] class << self def get(*args) format_response(super(*args)) end def post(*args) format_response(super(*args)) end private def format_response(http_response) formatted = http_response['response'].nil? ? [] : http_response['response'] errors = http_response['success'] ? {} : http_response['message'] formatted.each { |r| r['errors'] = errors } formatted end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
share_progress-0.1.0 | lib/share_progress/client.rb |