module Trigga module AdminApiClient module Proxies module Api def self.included(base) base.send("extend",self) end private def common_params [:page, :per_page, :max_tags, :site_key, :api_key] end def make_api_call(endpoint, opts = {}) require_one_of( opts, :site_key, :site_id ) Trigga::AdminApiClient.make_call("api", endpoint, opts.reject{|k,v| !common_params.include?(k.to_sym) } ) end public def get_channels(opts) make_api_call("channels", opts ) end def get_channel_items( opts ) require_param( opts, :channel_id ) make_api_call("channels/#{opts[:channel_id]}", opts ) end def get_sources( opts ) make_api_call('sources', opts) end def get_item_tags( opts ) make_api_call('item_tags', opts) end def get_latest_items( opts ) make_api_call('items', opts) end def get_item_details( opts ) require_param( opts, :item_id ) make_api_call("items/#{opts[:item_id]}", opts) end end end end end