module Masheri class RestClient def build_url(query_params) Query.new(query_params).url end def activity(activity_type, service_id, options) if activity_type == "developer_activity" developer_activity(service_id, options) else raise "No such activity type!" end end def developer_activity_query(service_id, options) query_options = {service_id: service_id, resource: "developer_activity"}.merge(options) Query.new(query_options) end def developer_activity(service_id, options) query = developer_activity_query(service_id, options) response = ::RestClient.get(query.url) if query.format == "json" response elsif query.format == "csv" response else raise UnknownFormat.new(query.format) end end end end