Sha256: 134cab84bc7c9963762b69c8d4109ee44a250da878f2d4e5b1bfa4aa3e6baf11

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
masheri-0.6.1 lib/masheri/rest_client.rb