Sha256: 6fba96ec60c7a0d9189aae0c4906c2a208590dbd1404d5ddd2b4951c6afca786
Contents?: true
Size: 890 Bytes
Versions: 1
Compression:
Stored size: 890 Bytes
Contents
module Mashery class RestClient def build_url(query_params) Query.new(query_params).url end def call(activity_type, service_id, options) if activity_type == "developer_activity" query_options = {service_id: service_id, resource: "developer_activity"}.merge(options) query = Query.new(query_options) perform_query(query) elsif activity_type == "errorcodes" query_options = {service_id: service_id, resource: "errorcodes"}.merge(options) query = Query.new(query_options) perform_query(query) else raise "No such activity type!" end end def perform_query(query) response = ::RestClient.get(query.url) if query.format == "json" or 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 |
---|---|
mashery_rails-0.6.8 | lib/mashery/rest_client.rb |