Sha256: 5c00d72487e81c7f3cc8895716b43e40816804cdabcd5d836d13f0f088f0515a
Contents?: true
Size: 1.51 KB
Versions: 3
Compression:
Stored size: 1.51 KB
Contents
require 'storyq_client/upload' require 'storyq_client/token' require 'storyq_client/resource' require 'storyq_client/box' require 'storyq_client/photo' def StoryQ(*params) Storyq::Base.new(*params) end module Storyq class Base include Token def initialize(config) config[:site] ||= "http://www.storyq.net" self.config = config end def slide_boxes CallProxy.new(SlideBox, self) end def photo_boxes CallProxy.new(PhotoBox, self) end def boxes CallProxy.new(Box, self) end def post url, body, headers={} headers["content-type"] ||= 'application/x-www-form-urlencoded' unless body.blank? access_token.request(:post, url, body, header(headers)).body end def put url, body, headers={} headers["content-type"] ||= 'application/x-www-form-urlencoded' unless body.blank? access_token.request(:put, url, body, header(headers)).body end def delete url, headers={} access_token.request(:delete, url, header(headers)).body end def get url, headers={} access_token.request(:get, url, header(headers)).body end def header headers default_header.merge(headers) end def default_header { "accept" => 'application/xml' } end end class CallProxy def initialize(callee, *params) @callee, @params = callee, params end def method_missing(method, *params, &block) @callee.send(method, *(params+@params), &block) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
aproxacs-storyq_client-0.0.1 | lib/storyq_client/base.rb |
aproxacs-storyq_client-0.0.2 | lib/storyq_client/base.rb |
aproxacs-storyq_client-0.0.3 | lib/storyq_client/base.rb |