Weary DSL brainstorming
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# DSL method ideas (for Weary) | |
class Twitter < Weary::Base | |
on_domain 'http://twitter.com/' | |
as_format :json | |
declare_resource 'statuses/user_timeline', | |
:via => :get, | |
:with => [:id], | |
:forms_url => "#{domain}#{resource}.#{format}?#{query}" | |
declare_resource 'statuses' do | |
get :show, | |
:with => [:id], | |
:requires => [:id], | |
:forms_url => "#{domain}#{resource}.#{format}?#{query}" | |
post :update, | |
:with => [:status, :in_reply_to_status_id], | |
:requires => [:status], | |
:authenticate => true | |
end | |
end | |
# Need to setup some way to declare a default 'forms_url'. | |
# Maybe this will be a method that exists outside of the declare_resource method. | |
# constructs_url or something like that | |
# If within the declare_resource block GET and POST share the same method (see Github API) | |
# we should set up getters and setters e.g. | |
# get :show | |
# post :show | |
# will create methods show and show= | |
# twitter.statuses.show({query}) will perform the GET | |
# twitter.statuses.show = {some hash that represents the request.body} performs the POST |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment