Skip to content
This repository
Browse code

Smarter API method names

  • Loading branch information...
commit 80ee0ee4d7f7c955aab31eaabbc94b6d4ff7b3bc 1 parent 4227de0
Mark Wunsch authored June 30, 2009

Showing 1 changed file with 10 additions and 5 deletions. Show diff stats Hide diff stats

  1. 15  lib/weary.rb
15  lib/weary.rb
@@ -52,9 +52,10 @@ def on_domain(domain)
52 52
   
53 53
   # Sets a default format to make your Requests in.
54 54
   # Defaults to JSON.
55  
-  def as_format(format) 
  55
+  def format(format) 
56 56
     @default_format = format
57 57
   end
  58
+  alias as_format format
58 59
   
59 60
   # Construct a URL pattern for your resources to follow.
60 61
   # You can use flags like
@@ -62,24 +63,28 @@ def as_format(format)
62 63
   # * <format>
63 64
   # * <resource>
64 65
   # To aid your construction. Defaults to "<domain><resource>.<format>"
65  
-  def construct_url(pattern)
  66
+  def url(pattern)
66 67
     @url_pattern = pattern.to_s
67 68
   end
  69
+  alias construct_url url
68 70
 
69  
-  def authenticates_with(username,password)
  71
+  def authenticates(username,password)
70 72
     @username = username
71 73
     @password = password
72 74
     return nil
73 75
   end
  76
+  alias authenticates_with authenticates
74 77
   
75  
-  def always_with(params)
  78
+  def with(params)
76 79
     @always_with = params
77 80
   end
  81
+  alias always_with with
78 82
   
79 83
   # Set custom Headers for your Request
80  
-  def set_headers(headers)
  84
+  def headers(headers)
81 85
     @headers = headers
82 86
   end
  87
+  alias set_headers headers
83 88
 
84 89
   # Declare a resource. Use it with a block to setup the resource
85 90
   #

0 notes on commit 80ee0ee

Please sign in to comment.
Something went wrong with that request. Please try again.