simplemapper 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +1 -1
- data/README +16 -0
- data/Rakefile +1 -1
- data/doc/classes/Array.html +24 -5
- data/doc/classes/{Inflector.src/M000017.html → Array.src/M000005.html} +4 -8
- data/doc/classes/Array.src/{M000001.html → M000006.html} +1 -1
- data/doc/classes/Callbacks.html +15 -15
- data/doc/classes/Callbacks.src/{M000037.html → M000040.html} +0 -0
- data/doc/classes/Callbacks.src/{M000038.html → M000041.html} +0 -0
- data/doc/classes/Callbacks.src/{M000039.html → M000042.html} +0 -0
- data/doc/classes/Enumerable.html +5 -5
- data/doc/classes/Enumerable.src/{M000040.html → M000043.html} +1 -1
- data/doc/classes/Hash.html +23 -4
- data/doc/classes/Hash.src/M000002.html +6 -4
- data/doc/classes/Hash.src/M000003.html +4 -20
- data/doc/classes/Hash.src/M000004.html +34 -0
- data/doc/classes/Inflector/Inflections.html +40 -40
- data/doc/classes/Inflector/Inflections.src/M000034.html +4 -5
- data/doc/classes/Inflector/Inflections.src/M000035.html +4 -4
- data/doc/classes/Inflector/Inflections.src/M000036.html +4 -9
- data/doc/classes/Inflector/Inflections.src/M000037.html +19 -0
- data/doc/classes/Inflector/Inflections.src/{M000031.html → M000038.html} +4 -4
- data/doc/classes/Inflector/Inflections.src/M000039.html +23 -0
- data/doc/classes/Inflector.html +82 -82
- data/doc/classes/Inflector.src/M000020.html +6 -6
- data/doc/classes/Inflector.src/M000021.html +11 -4
- data/doc/classes/Inflector.src/M000022.html +11 -8
- data/doc/classes/Inflector.src/M000023.html +8 -4
- data/doc/classes/Inflector.src/M000024.html +4 -4
- data/doc/classes/Inflector.src/M000025.html +8 -4
- data/doc/classes/Inflector.src/M000026.html +4 -4
- data/doc/classes/Inflector.src/M000027.html +4 -5
- data/doc/classes/Inflector.src/M000028.html +4 -4
- data/doc/classes/Inflector.src/M000029.html +4 -8
- data/doc/classes/Inflector.src/M000030.html +5 -13
- data/doc/classes/Inflector.src/M000031.html +18 -0
- data/doc/classes/Inflector.src/M000032.html +22 -0
- data/doc/classes/Inflector.src/M000033.html +27 -0
- data/doc/classes/Merb/Request.html +5 -5
- data/doc/classes/Merb/Request.src/{M000041.html → M000044.html} +1 -1
- data/doc/classes/OAuth/RequestProxy/Base.html +5 -5
- data/doc/classes/OAuth/RequestProxy/Base.src/{M000012.html → M000015.html} +1 -1
- data/doc/classes/OAuth/Signature/Base.html +5 -5
- data/doc/classes/OAuth/Signature/Base.src/{M000011.html → M000014.html} +1 -1
- data/doc/classes/OAuthController.html +25 -25
- data/doc/classes/OAuthController.src/M000008.html +8 -11
- data/doc/classes/OAuthController.src/M000009.html +4 -5
- data/doc/classes/OAuthController.src/{M000007.html → M000010.html} +1 -1
- data/doc/classes/OAuthController.src/M000011.html +25 -0
- data/doc/classes/OAuthController.src/M000012.html +19 -0
- data/doc/classes/Object.html +18 -6
- data/doc/classes/Object.src/{M000010.html → M000013.html} +2 -2
- data/doc/classes/Proc.html +5 -5
- data/doc/classes/Proc.src/{M000004.html → M000007.html} +0 -0
- data/doc/classes/Serialize.html +20 -20
- data/doc/classes/Serialize.src/M000016.html +7 -32
- data/doc/classes/Serialize.src/{M000014.html → M000017.html} +1 -1
- data/doc/classes/Serialize.src/{M000015.html → M000018.html} +1 -1
- data/doc/classes/Serialize.src/M000019.html +18 -0
- data/doc/classes/SimpleMapper/Base.html +149 -124
- data/doc/classes/SimpleMapper/Base.src/M000067.html +3 -8
- data/doc/classes/SimpleMapper/Base.src/M000068.html +3 -13
- data/doc/classes/SimpleMapper/Base.src/M000069.html +4 -4
- data/doc/classes/SimpleMapper/Base.src/M000070.html +15 -4
- data/doc/classes/SimpleMapper/Base.src/M000071.html +7 -4
- data/doc/classes/SimpleMapper/Base.src/M000072.html +4 -5
- data/doc/classes/SimpleMapper/Base.src/M000073.html +12 -9
- data/doc/classes/SimpleMapper/Base.src/M000074.html +8 -5
- data/doc/classes/SimpleMapper/Base.src/M000075.html +5 -7
- data/doc/classes/SimpleMapper/Base.src/M000076.html +5 -5
- data/doc/classes/SimpleMapper/Base.src/M000077.html +6 -5
- data/doc/classes/SimpleMapper/Base.src/M000078.html +10 -6
- data/doc/classes/SimpleMapper/Base.src/M000079.html +4 -4
- data/doc/classes/SimpleMapper/Base.src/M000080.html +6 -4
- data/doc/classes/SimpleMapper/Base.src/M000081.html +4 -5
- data/doc/classes/SimpleMapper/Base.src/M000082.html +4 -6
- data/doc/classes/SimpleMapper/Base.src/M000083.html +5 -10
- data/doc/classes/SimpleMapper/Base.src/M000084.html +4 -4
- data/doc/classes/SimpleMapper/{HttpAdapter.src/M000057.html → Base.src/M000085.html} +4 -4
- data/doc/classes/SimpleMapper/Base.src/M000086.html +19 -0
- data/doc/classes/SimpleMapper/Base.src/M000087.html +20 -0
- data/doc/classes/SimpleMapper/Base.src/M000088.html +24 -0
- data/doc/classes/SimpleMapper/Base.src/M000089.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.html +40 -40
- data/doc/classes/SimpleMapper/HttpAdapter.src/{M000056.html → M000059.html} +1 -1
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000060.html +4 -4
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000061.html +5 -4
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000063.html +5 -4
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000064.html +18 -0
- data/doc/classes/SimpleMapper/HttpAdapter.src/{M000062.html → M000065.html} +1 -1
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000066.html +18 -0
- data/doc/classes/SimpleMapper/HttpOAuthExtension.html +22 -22
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000051.html +27 -4
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/{M000049.html → M000052.html} +1 -3
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/{M000050.html → M000053.html} +1 -1
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000054.html +24 -0
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.html +10 -10
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/{M000046.html → M000049.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel/ClassMethods.src/{M000047.html → M000050.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel.html +20 -20
- data/doc/classes/SimpleMapper/SimpleModel.src/M000045.html +4 -10
- data/doc/classes/SimpleMapper/SimpleModel.src/{M000043.html → M000046.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/{M000044.html → M000047.html} +0 -0
- data/doc/classes/SimpleMapper/SimpleModel.src/M000048.html +24 -0
- data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.html +5 -5
- data/doc/classes/SimpleMapper/XmlFormat/ClassMethods.src/{M000055.html → M000058.html} +5 -3
- data/doc/classes/SimpleMapper/XmlFormat.html +15 -15
- data/doc/classes/SimpleMapper/XmlFormat.src/{M000052.html → M000055.html} +1 -1
- data/doc/classes/SimpleMapper/XmlFormat.src/{M000053.html → M000056.html} +1 -1
- data/doc/classes/SimpleMapper/XmlFormat.src/{M000054.html → M000057.html} +4 -2
- data/doc/classes/Time.html +139 -0
- data/doc/classes/{OAuthController.src/M000006.html → Time.src/M000001.html} +4 -4
- data/doc/created.rid +1 -1
- data/doc/files/lib/simple_mapper/adapters/http_adapter_rb.html +2 -1
- data/doc/files/lib/simple_mapper/base_rb.html +1 -1
- data/doc/files/lib/simple_mapper/default_plugins/callbacks_rb.html +1 -1
- data/doc/files/lib/simple_mapper/default_plugins/oauth_rb.html +1 -7
- data/doc/files/lib/simple_mapper/default_plugins/options_to_query_rb.html +116 -0
- data/doc/files/lib/simple_mapper/default_plugins/simple_model_rb.html +1 -1
- data/doc/files/lib/simple_mapper/formats/xml_format_rb.html +3 -1
- data/doc/files/lib/simple_mapper/support/bliss_serializer_rb.html +2 -1
- data/doc/files/lib/simple_mapper/support/core_ext_rb.html +1 -1
- data/doc/files/lib/simple_mapper/support/inflections_rb.html +1 -1
- data/doc/files/lib/simple_mapper/support/inflector_rb.html +1 -1
- data/doc/files/lib/simple_mapper/support_rb.html +1 -1
- data/doc/files/lib/simple_mapper_rb.html +1 -1
- data/doc/fr_class_index.html +1 -0
- data/doc/fr_file_index.html +1 -0
- data/doc/fr_method_index.html +89 -84
- data/lib/simple_mapper/adapters/http_adapter.rb +4 -2
- data/lib/simple_mapper/base.rb +46 -23
- data/lib/simple_mapper/default_plugins/oauth.rb +3 -6
- data/lib/simple_mapper/default_plugins/options_to_query.rb +31 -0
- data/lib/simple_mapper/formats/xml_format.rb +10 -3
- data/lib/simple_mapper/support/bliss_serializer.rb +3 -113
- data/lib/simple_mapper/support/core_ext.rb +6 -2
- data/lib/simple_mapper/support/inflections.rb +1 -1
- metadata +52 -43
- data/doc/classes/Inflector/Inflections.src/M000032.html +0 -18
- data/doc/classes/Inflector/Inflections.src/M000033.html +0 -18
- data/doc/classes/Inflector.src/M000018.html +0 -25
- data/doc/classes/Inflector.src/M000019.html +0 -25
- data/doc/classes/OAuthController.src/M000005.html +0 -22
- data/doc/classes/Serialize.src/M000013.html +0 -21
- data/doc/classes/SimpleMapper/Base.src/M000064.html +0 -16
- data/doc/classes/SimpleMapper/Base.src/M000065.html +0 -16
- data/doc/classes/SimpleMapper/Base.src/M000066.html +0 -22
- data/doc/classes/SimpleMapper/HttpAdapter.src/M000058.html +0 -19
- data/doc/classes/SimpleMapper/HttpOAuthExtension.src/M000048.html +0 -49
- data/doc/classes/SimpleMapper/SimpleModel.src/M000042.html +0 -18
@@ -0,0 +1,116 @@
|
|
1
|
+
<?xml version="1.0" encoding="iso-8859-1"?>
|
2
|
+
<!DOCTYPE html
|
3
|
+
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
4
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
5
|
+
|
6
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
7
|
+
<head>
|
8
|
+
<title>File: options_to_query.rb</title>
|
9
|
+
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
|
10
|
+
<meta http-equiv="Content-Script-Type" content="text/javascript" />
|
11
|
+
<link rel="stylesheet" href="../../../.././rdoc-style.css" type="text/css" media="screen" />
|
12
|
+
<script type="text/javascript">
|
13
|
+
// <![CDATA[
|
14
|
+
|
15
|
+
function popupCode( url ) {
|
16
|
+
window.open(url, "Code", "resizable=yes,scrollbars=yes,toolbar=no,status=no,height=150,width=400")
|
17
|
+
}
|
18
|
+
|
19
|
+
function toggleCode( id ) {
|
20
|
+
if ( document.getElementById )
|
21
|
+
elem = document.getElementById( id );
|
22
|
+
else if ( document.all )
|
23
|
+
elem = eval( "document.all." + id );
|
24
|
+
else
|
25
|
+
return false;
|
26
|
+
|
27
|
+
elemStyle = elem.style;
|
28
|
+
|
29
|
+
if ( elemStyle.display != "block" ) {
|
30
|
+
elemStyle.display = "block"
|
31
|
+
} else {
|
32
|
+
elemStyle.display = "none"
|
33
|
+
}
|
34
|
+
|
35
|
+
return true;
|
36
|
+
}
|
37
|
+
|
38
|
+
// Make codeblocks hidden by default
|
39
|
+
document.writeln( "<style type=\"text/css\">div.method-source-code { display: none }</style>" )
|
40
|
+
|
41
|
+
// ]]>
|
42
|
+
</script>
|
43
|
+
|
44
|
+
</head>
|
45
|
+
<body>
|
46
|
+
|
47
|
+
|
48
|
+
|
49
|
+
<div id="fileHeader">
|
50
|
+
<h1>options_to_query.rb</h1>
|
51
|
+
<table class="header-table">
|
52
|
+
<tr class="top-aligned-row">
|
53
|
+
<td><strong>Path:</strong></td>
|
54
|
+
<td>lib/simple_mapper/default_plugins/options_to_query.rb
|
55
|
+
</td>
|
56
|
+
</tr>
|
57
|
+
<tr class="top-aligned-row">
|
58
|
+
<td><strong>Last Update:</strong></td>
|
59
|
+
<td>Mon Mar 17 16:12:08 -0400 2008</td>
|
60
|
+
</tr>
|
61
|
+
</table>
|
62
|
+
</div>
|
63
|
+
<!-- banner header -->
|
64
|
+
|
65
|
+
<div id="bodyContent">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
<div id="contextContent">
|
70
|
+
|
71
|
+
<div id="description">
|
72
|
+
<p>
|
73
|
+
This simply defines some extensions to various objects to enable smartly
|
74
|
+
converting values to a standard query string understandable by Rails and <a
|
75
|
+
href="../../../../classes/Merb.html">Merb</a>. First the structural base:
|
76
|
+
</p>
|
77
|
+
|
78
|
+
</div>
|
79
|
+
|
80
|
+
<div id="requires-list">
|
81
|
+
<h3 class="section-bar">Required files</h3>
|
82
|
+
|
83
|
+
<div class="name-list">
|
84
|
+
time
|
85
|
+
</div>
|
86
|
+
</div>
|
87
|
+
|
88
|
+
</div>
|
89
|
+
|
90
|
+
|
91
|
+
</div>
|
92
|
+
|
93
|
+
|
94
|
+
<!-- if includes -->
|
95
|
+
|
96
|
+
<div id="section">
|
97
|
+
|
98
|
+
|
99
|
+
|
100
|
+
|
101
|
+
|
102
|
+
|
103
|
+
|
104
|
+
|
105
|
+
<!-- if method_list -->
|
106
|
+
|
107
|
+
|
108
|
+
</div>
|
109
|
+
|
110
|
+
|
111
|
+
<div id="validator-badges">
|
112
|
+
<p><small><a href="http://validator.w3.org/check/referer">[Validate]</a></small></p>
|
113
|
+
</div>
|
114
|
+
|
115
|
+
</body>
|
116
|
+
</html>
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Mon Mar 17 16:13:55 -0400 2008</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -74,6 +74,8 @@
|
|
74
74
|
|
75
75
|
<div class="name-list">
|
76
76
|
simple_mapper/support/bliss_serializer
|
77
|
+
rubygems
|
78
|
+
formatted_string
|
77
79
|
</div>
|
78
80
|
</div>
|
79
81
|
|
@@ -56,7 +56,7 @@
|
|
56
56
|
</tr>
|
57
57
|
<tr class="top-aligned-row">
|
58
58
|
<td><strong>Last Update:</strong></td>
|
59
|
-
<td>
|
59
|
+
<td>Mon Mar 17 16:19:39 -0400 2008</td>
|
60
60
|
</tr>
|
61
61
|
</table>
|
62
62
|
</div>
|
@@ -75,6 +75,7 @@
|
|
75
75
|
<div class="name-list">
|
76
76
|
rexml/light/node
|
77
77
|
rexml/document
|
78
|
+
formatted_string
|
78
79
|
</div>
|
79
80
|
</div>
|
80
81
|
|
data/doc/fr_class_index.html
CHANGED
@@ -46,6 +46,7 @@
|
|
46
46
|
<a href="classes/SimpleMapper/XmlFormat.html">SimpleMapper::XmlFormat</a><br />
|
47
47
|
<a href="classes/SimpleMapper/XmlFormat/ClassMethods.html">SimpleMapper::XmlFormat::ClassMethods</a><br />
|
48
48
|
<a href="classes/String.html">String</a><br />
|
49
|
+
<a href="classes/Time.html">Time</a><br />
|
49
50
|
</div>
|
50
51
|
</div>
|
51
52
|
</body>
|
data/doc/fr_file_index.html
CHANGED
@@ -25,6 +25,7 @@
|
|
25
25
|
<a href="files/lib/simple_mapper/base_rb.html">lib/simple_mapper/base.rb</a><br />
|
26
26
|
<a href="files/lib/simple_mapper/default_plugins/callbacks_rb.html">lib/simple_mapper/default_plugins/callbacks.rb</a><br />
|
27
27
|
<a href="files/lib/simple_mapper/default_plugins/oauth_rb.html">lib/simple_mapper/default_plugins/oauth.rb</a><br />
|
28
|
+
<a href="files/lib/simple_mapper/default_plugins/options_to_query_rb.html">lib/simple_mapper/default_plugins/options_to_query.rb</a><br />
|
28
29
|
<a href="files/lib/simple_mapper/default_plugins/simple_model_rb.html">lib/simple_mapper/default_plugins/simple_model.rb</a><br />
|
29
30
|
<a href="files/lib/simple_mapper/formats/xml_format_rb.html">lib/simple_mapper/formats/xml_format.rb</a><br />
|
30
31
|
<a href="files/lib/simple_mapper/support_rb.html">lib/simple_mapper/support.rb</a><br />
|
data/doc/fr_method_index.html
CHANGED
@@ -20,90 +20,95 @@
|
|
20
20
|
<div id="index">
|
21
21
|
<h1 class="section-bar">Methods</h1>
|
22
22
|
<div id="index-entries">
|
23
|
-
<a href="classes/Callbacks.html#
|
24
|
-
<a href="classes/
|
25
|
-
<a href="classes/OAuthController.html#
|
26
|
-
<a href="classes/
|
27
|
-
<a href="classes/
|
28
|
-
<a href="classes/
|
29
|
-
<a href="classes/Inflector.html#
|
30
|
-
<a href="classes/Inflector
|
31
|
-
<a href="classes/
|
32
|
-
<a href="classes/SimpleMapper/Base.html#
|
33
|
-
<a href="classes/
|
34
|
-
<a href="classes/
|
35
|
-
<a href="classes/
|
36
|
-
<a href="classes/
|
37
|
-
<a href="classes/
|
38
|
-
<a href="classes/SimpleMapper/Base.html#
|
39
|
-
<a href="classes/
|
40
|
-
<a href="classes/SimpleMapper/Base.html#
|
41
|
-
<a href="classes/SimpleMapper/Base.html#
|
42
|
-
<a href="classes/SimpleMapper/
|
43
|
-
<a href="classes/SimpleMapper/Base.html#
|
44
|
-
<a href="classes/
|
45
|
-
<a href="classes/
|
46
|
-
<a href="classes/
|
47
|
-
<a href="classes/
|
48
|
-
<a href="classes/
|
49
|
-
<a href="classes/SimpleMapper/Base.html#
|
50
|
-
<a href="classes/SimpleMapper/Base.html#
|
51
|
-
<a href="classes/
|
52
|
-
<a href="classes/SimpleMapper/
|
53
|
-
<a href="classes/SimpleMapper/Base.html#
|
54
|
-
<a href="classes/
|
55
|
-
<a href="classes/
|
56
|
-
<a href="classes/SimpleMapper/HttpAdapter.html#
|
57
|
-
<a href="classes/
|
58
|
-
<a href="classes/
|
59
|
-
<a href="classes/SimpleMapper/
|
60
|
-
<a href="classes/SimpleMapper/
|
61
|
-
<a href="classes/
|
62
|
-
<a href="classes/SimpleMapper/SimpleModel.html#
|
63
|
-
<a href="classes/SimpleMapper/
|
64
|
-
<a href="classes/
|
65
|
-
<a href="classes/
|
66
|
-
<a href="classes/SimpleMapper/
|
67
|
-
<a href="classes/Inflector
|
68
|
-
<a href="classes/
|
69
|
-
<a href="classes/SimpleMapper/
|
70
|
-
<a href="classes/Inflector/Inflections.html#
|
71
|
-
<a href="classes/SimpleMapper/
|
72
|
-
<a href="classes/
|
73
|
-
<a href="classes/
|
74
|
-
<a href="classes/
|
75
|
-
<a href="classes/
|
76
|
-
<a href="classes/
|
77
|
-
<a href="classes/SimpleMapper/
|
78
|
-
<a href="classes/
|
79
|
-
<a href="classes/
|
80
|
-
<a href="classes/
|
81
|
-
<a href="classes/
|
82
|
-
<a href="classes/SimpleMapper/
|
83
|
-
<a href="classes/
|
84
|
-
<a href="classes/
|
85
|
-
<a href="classes/SimpleMapper/
|
86
|
-
<a href="classes/SimpleMapper/
|
87
|
-
<a href="classes/
|
88
|
-
<a href="classes/SimpleMapper/
|
89
|
-
<a href="classes/
|
90
|
-
<a href="classes/
|
91
|
-
<a href="classes/
|
92
|
-
<a href="classes/
|
93
|
-
<a href="classes/SimpleMapper/
|
94
|
-
<a href="classes/
|
95
|
-
<a href="classes/
|
96
|
-
<a href="classes/
|
97
|
-
<a href="classes/Inflector.html#
|
98
|
-
<a href="classes/Inflector.html#
|
99
|
-
<a href="classes/
|
100
|
-
<a href="classes/
|
101
|
-
<a href="classes/
|
102
|
-
<a href="classes/SimpleMapper/
|
103
|
-
<a href="classes/
|
104
|
-
<a href="classes/
|
105
|
-
<a href="classes/
|
106
|
-
<a href="classes/
|
23
|
+
<a href="classes/Callbacks.html#M000041">add_callback (Callbacks)</a><br />
|
24
|
+
<a href="classes/SimpleMapper/Base.html#M000070">add_connection_adapter (SimpleMapper::Base)</a><br />
|
25
|
+
<a href="classes/OAuthController.html#M000011">authenticate! (OAuthController)</a><br />
|
26
|
+
<a href="classes/OAuthController.html#M000009">authorized? (OAuthController)</a><br />
|
27
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000059">base_uri (SimpleMapper::HttpAdapter)</a><br />
|
28
|
+
<a href="classes/Callbacks.html#M000040">callbacks (Callbacks)</a><br />
|
29
|
+
<a href="classes/Inflector.html#M000023">camelize (Inflector)</a><br />
|
30
|
+
<a href="classes/Inflector.html#M000030">classify (Inflector)</a><br />
|
31
|
+
<a href="classes/Inflector/Inflections.html#M000039">clear (Inflector::Inflections)</a><br />
|
32
|
+
<a href="classes/SimpleMapper/Base.html#M000073">connection (SimpleMapper::Base)</a><br />
|
33
|
+
<a href="classes/SimpleMapper/Base.html#M000069">connection_adapters (SimpleMapper::Base)</a><br />
|
34
|
+
<a href="classes/SimpleMapper/Base.html#M000072">connections (SimpleMapper::Base)</a><br />
|
35
|
+
<a href="classes/Inflector.html#M000032">constantize (Inflector)</a><br />
|
36
|
+
<a href="classes/Array.html#M000006">crawl (Array)</a><br />
|
37
|
+
<a href="classes/Hash.html#M000004">crawl (Hash)</a><br />
|
38
|
+
<a href="classes/SimpleMapper/Base.html#M000075">create (SimpleMapper::Base)</a><br />
|
39
|
+
<a href="classes/Inflector.html#M000026">dasherize (Inflector)</a><br />
|
40
|
+
<a href="classes/SimpleMapper/Base.html#M000082">data (SimpleMapper::Base)</a><br />
|
41
|
+
<a href="classes/SimpleMapper/Base.html#M000081">data= (SimpleMapper::Base)</a><br />
|
42
|
+
<a href="classes/SimpleMapper/Base.html#M000068">debug! (SimpleMapper::Base)</a><br />
|
43
|
+
<a href="classes/SimpleMapper/Base.html#M000067">debug? (SimpleMapper::Base)</a><br />
|
44
|
+
<a href="classes/SimpleMapper/Base.html#M000088">delete (SimpleMapper::Base)</a><br />
|
45
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000066">delete (SimpleMapper::HttpAdapter)</a><br />
|
46
|
+
<a href="classes/Inflector.html#M000028">demodulize (Inflector)</a><br />
|
47
|
+
<a href="classes/Array.html#M000005">except (Array)</a><br />
|
48
|
+
<a href="classes/Object.html#M000013">extended (Object)</a><br />
|
49
|
+
<a href="classes/SimpleMapper/Base.html#M000077">extract_from (SimpleMapper::Base)</a><br />
|
50
|
+
<a href="classes/SimpleMapper/Base.html#M000078">extract_one (SimpleMapper::Base)</a><br />
|
51
|
+
<a href="classes/Inflector.html#M000031">foreign_key (Inflector)</a><br />
|
52
|
+
<a href="classes/SimpleMapper/Base.html#M000071">format= (SimpleMapper::Base)</a><br />
|
53
|
+
<a href="classes/SimpleMapper/Base.html#M000084">formatted_data (SimpleMapper::Base)</a><br />
|
54
|
+
<a href="classes/SimpleMapper/XmlFormat/ClassMethods.html#M000058">from_xml (SimpleMapper::XmlFormat::ClassMethods)</a><br />
|
55
|
+
<a href="classes/SimpleMapper/Base.html#M000074">get (SimpleMapper::Base)</a><br />
|
56
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000063">get (SimpleMapper::HttpAdapter)</a><br />
|
57
|
+
<a href="classes/Enumerable.html#M000043">group_by (Enumerable)</a><br />
|
58
|
+
<a href="classes/Serialize.html#M000019">hash_from_xml (Serialize)</a><br />
|
59
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000060">headers (SimpleMapper::HttpAdapter)</a><br />
|
60
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000061">headers= (SimpleMapper::HttpAdapter)</a><br />
|
61
|
+
<a href="classes/Inflector.html#M000027">humanize (Inflector)</a><br />
|
62
|
+
<a href="classes/SimpleMapper/SimpleModel/ClassMethods.html#M000050">identifier (SimpleMapper::SimpleModel::ClassMethods)</a><br />
|
63
|
+
<a href="classes/SimpleMapper/SimpleModel.html#M000047">identifier (SimpleMapper::SimpleModel)</a><br />
|
64
|
+
<a href="classes/Proc.html#M000007">in_context (Proc)</a><br />
|
65
|
+
<a href="classes/SimpleMapper/XmlFormat.html#M000055">included (SimpleMapper::XmlFormat)</a><br />
|
66
|
+
<a href="classes/SimpleMapper/SimpleModel.html#M000045">included (SimpleMapper::SimpleModel)</a><br />
|
67
|
+
<a href="classes/Inflector.html#M000020">inflections (Inflector)</a><br />
|
68
|
+
<a href="classes/OAuth/RequestProxy/Base.html#M000015">inspect (OAuth::RequestProxy::Base)</a><br />
|
69
|
+
<a href="classes/SimpleMapper/Base.html#M000083">instantiate (SimpleMapper::Base)</a><br />
|
70
|
+
<a href="classes/Inflector/Inflections.html#M000037">irregular (Inflector::Inflections)</a><br />
|
71
|
+
<a href="classes/SimpleMapper/SimpleModel.html#M000048">method_missing (SimpleMapper::SimpleModel)</a><br />
|
72
|
+
<a href="classes/SimpleMapper/XmlFormat.html#M000056">mime_type_headers (SimpleMapper::XmlFormat)</a><br />
|
73
|
+
<a href="classes/Inflector/Inflections.html#M000034">new (Inflector::Inflections)</a><br />
|
74
|
+
<a href="classes/OAuthController.html#M000008">new (OAuthController)</a><br />
|
75
|
+
<a href="classes/OAuth/Signature/Base.html#M000014">new (OAuth::Signature::Base)</a><br />
|
76
|
+
<a href="classes/SimpleMapper/Base.html#M000079">new (SimpleMapper::Base)</a><br />
|
77
|
+
<a href="classes/SimpleMapper/HttpOAuthExtension.html#M000053">oauth (SimpleMapper::HttpOAuthExtension)</a><br />
|
78
|
+
<a href="classes/Serialize.html#M000016">object_to_xml (Serialize)</a><br />
|
79
|
+
<a href="classes/Inflector.html#M000033">ordinalize (Inflector)</a><br />
|
80
|
+
<a href="classes/SimpleMapper/Base.html#M000080">original_data= (SimpleMapper::Base)</a><br />
|
81
|
+
<a href="classes/SimpleMapper/Base.html#M000089">persisted? (SimpleMapper::Base)</a><br />
|
82
|
+
<a href="classes/SimpleMapper/Base.html#M000076">persistent? (SimpleMapper::Base)</a><br />
|
83
|
+
<a href="classes/Inflector/Inflections.html#M000035">plural (Inflector::Inflections)</a><br />
|
84
|
+
<a href="classes/Inflector.html#M000021">pluralize (Inflector)</a><br />
|
85
|
+
<a href="classes/SimpleMapper/Base.html#M000087">post (SimpleMapper::Base)</a><br />
|
86
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000065">post (SimpleMapper::HttpAdapter)</a><br />
|
87
|
+
<a href="classes/SimpleMapper/SimpleModel/ClassMethods.html#M000049">properties (SimpleMapper::SimpleModel::ClassMethods)</a><br />
|
88
|
+
<a href="classes/SimpleMapper/Base.html#M000086">put (SimpleMapper::Base)</a><br />
|
89
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000064">put (SimpleMapper::HttpAdapter)</a><br />
|
90
|
+
<a href="classes/OAuthController.html#M000012">request_signed! (OAuthController)</a><br />
|
91
|
+
<a href="classes/SimpleMapper/HttpOAuthExtension.html#M000051">requires_oauth (SimpleMapper::HttpOAuthExtension)</a><br />
|
92
|
+
<a href="classes/Callbacks.html#M000042">run_callback (Callbacks)</a><br />
|
93
|
+
<a href="classes/SimpleMapper/Base.html#M000085">save (SimpleMapper::Base)</a><br />
|
94
|
+
<a href="classes/OAuthController.html#M000010">scriptable? (OAuthController)</a><br />
|
95
|
+
<a href="classes/SimpleMapper/HttpAdapter.html#M000062">set_headers (SimpleMapper::HttpAdapter)</a><br />
|
96
|
+
<a href="classes/SimpleMapper/HttpOAuthExtension.html#M000054">set_oauth (SimpleMapper::HttpOAuthExtension)</a><br />
|
97
|
+
<a href="classes/Inflector/Inflections.html#M000036">singular (Inflector::Inflections)</a><br />
|
98
|
+
<a href="classes/Inflector.html#M000022">singularize (Inflector)</a><br />
|
99
|
+
<a href="classes/Hash.html#M000003">stringify_keys! (Hash)</a><br />
|
100
|
+
<a href="classes/Inflector.html#M000029">tableize (Inflector)</a><br />
|
101
|
+
<a href="classes/Inflector.html#M000024">titleize (Inflector)</a><br />
|
102
|
+
<a href="classes/SimpleMapper/SimpleModel.html#M000046">to_hash (SimpleMapper::SimpleModel)</a><br />
|
103
|
+
<a href="classes/Time.html#M000001">to_param (Time)</a><br />
|
104
|
+
<a href="classes/Hash.html#M000002">to_query (Hash)</a><br />
|
105
|
+
<a href="classes/Serialize.html#M000018">to_string (Serialize)</a><br />
|
106
|
+
<a href="classes/Serialize.html#M000017">to_xml (Serialize)</a><br />
|
107
|
+
<a href="classes/SimpleMapper/XmlFormat.html#M000057">to_xml (SimpleMapper::XmlFormat)</a><br />
|
108
|
+
<a href="classes/Inflector/Inflections.html#M000038">uncountable (Inflector::Inflections)</a><br />
|
109
|
+
<a href="classes/Inflector.html#M000025">underscore (Inflector)</a><br />
|
110
|
+
<a href="classes/SimpleMapper/HttpOAuthExtension.html#M000052">with_oauth (SimpleMapper::HttpOAuthExtension)</a><br />
|
111
|
+
<a href="classes/Merb/Request.html#M000044">xml_params (Merb::Request)</a><br />
|
107
112
|
</div>
|
108
113
|
</div>
|
109
114
|
</body>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
require 'net/http'
|
2
2
|
require 'uri'
|
3
3
|
require 'simple_mapper/default_plugins/callbacks'
|
4
|
+
require 'simple_mapper/default_plugins/options_to_query'
|
4
5
|
|
5
6
|
# SimpleMapper::HttpAdapter.
|
6
7
|
# Input:
|
@@ -27,8 +28,9 @@ module SimpleMapper
|
|
27
28
|
end
|
28
29
|
alias :set_headers :headers=
|
29
30
|
|
30
|
-
def get(
|
31
|
-
|
31
|
+
def get(find_options={})
|
32
|
+
query = find_options.empty? ? '' : ('?' + find_options.to_query)
|
33
|
+
http.request(request('get', base_uri.path + query)).body
|
32
34
|
end
|
33
35
|
|
34
36
|
def put(identifier,data)
|
data/lib/simple_mapper/base.rb
CHANGED
@@ -7,14 +7,24 @@ module SimpleMapper
|
|
7
7
|
def debug?; @debug end
|
8
8
|
def debug!; @debug = true end
|
9
9
|
|
10
|
-
def
|
10
|
+
def connection_adapters
|
11
|
+
@connection_adapters ||= Hash.new {|h,k| h[k] = {}}
|
12
|
+
end
|
13
|
+
|
14
|
+
def add_connection_adapter(name_or_adapter,adapter=nil,&block)
|
15
|
+
if adapter.nil?
|
16
|
+
adapter = name_or_adapter
|
17
|
+
name = :default
|
18
|
+
else
|
19
|
+
name = name_or_adapter.to_sym
|
20
|
+
end
|
11
21
|
# Should complain if the adapter doesn't exist.
|
12
|
-
|
13
|
-
require "#{File.dirname(__FILE__)}/adapters/#{
|
14
|
-
|
15
|
-
|
22
|
+
connection_adapters[name][:adapter] = adapter
|
23
|
+
require "#{File.dirname(__FILE__)}/adapters/#{adapter}_adapter"
|
24
|
+
connection_adapters[name][:init_block] = block if block_given?
|
25
|
+
connection_adapters[name][:debug] = @debug
|
26
|
+
[name, adapter]
|
16
27
|
end
|
17
|
-
alias :set_connection_adapter :connection_adapter=
|
18
28
|
|
19
29
|
# set_format :xml
|
20
30
|
# self.format = :json
|
@@ -27,21 +37,27 @@ module SimpleMapper
|
|
27
37
|
alias :set_format :format=
|
28
38
|
attr_reader :format_name
|
29
39
|
|
30
|
-
def
|
31
|
-
@
|
40
|
+
def connections
|
41
|
+
@connections ||= {}
|
42
|
+
end
|
43
|
+
def connection(name=:default,refresh=false)
|
44
|
+
connections[name] = begin
|
32
45
|
# Initialize the connection with the connection adapter.
|
33
|
-
adapter = Object.module_eval("::SimpleMapper::#{
|
34
|
-
|
46
|
+
adapter = Object.module_eval("::SimpleMapper::#{connection_adapters[name][:adapter].to_s.camelize}Adapter", __FILE__, __LINE__).new
|
47
|
+
connection_adapters[name][:init_block].in_context(adapter).call if connection_adapters[name][:init_block].is_a?(Proc)
|
35
48
|
adapter.set_headers format.mime_type_headers
|
36
|
-
adapter.debug! if
|
49
|
+
adapter.debug! if connection_adapters[name][:debug]
|
37
50
|
adapter
|
38
|
-
end if
|
39
|
-
|
51
|
+
end if !connections[name] || refresh
|
52
|
+
connections[name]
|
40
53
|
end
|
41
54
|
|
42
55
|
# get
|
43
56
|
def get(*args)
|
44
|
-
|
57
|
+
adapter = adapter_from_args(*args)
|
58
|
+
objs = extract_from(connection(adapter || :default).get(*args))
|
59
|
+
objs.is_a?(Array) ? objs.each {|e| e.instance_variable_set(:@adapter, adapter)} : objs.instance_variable_set(:@adapter, adapter) if adapter
|
60
|
+
objs
|
45
61
|
end
|
46
62
|
|
47
63
|
# new.save
|
@@ -54,7 +70,7 @@ module SimpleMapper
|
|
54
70
|
end
|
55
71
|
|
56
72
|
def extract_from(formatted_data)
|
57
|
-
objs = send(
|
73
|
+
objs = send("from_#{format_name}".to_sym, formatted_data)
|
58
74
|
objs.is_a?(Array) ? objs.collect {|e| e.extended {@persisted = true}} : objs.extended {@persisted = true}
|
59
75
|
end
|
60
76
|
|
@@ -66,6 +82,13 @@ module SimpleMapper
|
|
66
82
|
identifier.nil? ? objs : (objs.identifier == identifier ? objs : nil)
|
67
83
|
end
|
68
84
|
end
|
85
|
+
|
86
|
+
private
|
87
|
+
def adapter_from_args(*args)
|
88
|
+
adapter = nil
|
89
|
+
adapter = args.first.delete(:adapter) if args.first.is_a?(Hash)
|
90
|
+
adapter
|
91
|
+
end
|
69
92
|
end
|
70
93
|
|
71
94
|
def initialize(data=nil)
|
@@ -93,13 +116,13 @@ module SimpleMapper
|
|
93
116
|
# your own spin-off of one of those, too.
|
94
117
|
def instantiate(data)
|
95
118
|
raise TypeError, "data must be a hash" unless data.is_a?(Hash)
|
96
|
-
data.each {|k,v| instance_variable_set(
|
119
|
+
data.each {|k,v| instance_variable_set("@#{k}".to_sym, v)}
|
97
120
|
end
|
98
121
|
|
99
122
|
# Reads the data from the object for saving back to the persisted store. This is provided as a default
|
100
123
|
# method, but you can overwrite it in your model.
|
101
124
|
def formatted_data
|
102
|
-
send(
|
125
|
+
send("to_#{self.class.format_name}".to_sym)
|
103
126
|
end
|
104
127
|
|
105
128
|
# persisted? ? put : post
|
@@ -108,21 +131,21 @@ module SimpleMapper
|
|
108
131
|
end
|
109
132
|
|
110
133
|
# sends a put request with self.data
|
111
|
-
def put
|
112
|
-
self.data = self.class.extract_one(self.class.connection.put(identifier, formatted_data), identifier).to_hash
|
134
|
+
def put(*args)
|
135
|
+
self.data = self.class.extract_one(self.class.connection(@adapter || :default).put(identifier, formatted_data), identifier).to_hash
|
113
136
|
self
|
114
137
|
end
|
115
138
|
|
116
139
|
# sends a post request with self.data
|
117
|
-
def post
|
118
|
-
self.data = self.class.extract_one(self.class.connection.post(formatted_data)).to_hash
|
140
|
+
def post(*args)
|
141
|
+
self.data = self.class.extract_one(self.class.connection(@adapter || :default).post(formatted_data)).to_hash
|
119
142
|
@persisted = true
|
120
143
|
self
|
121
144
|
end
|
122
145
|
|
123
146
|
# delete
|
124
147
|
def delete
|
125
|
-
if self.class.connection.delete(identifier)
|
148
|
+
if self.class.connection(@adapter || :default).delete(identifier)
|
126
149
|
@persisted = false
|
127
150
|
instance_variable_set('@'+self.class.identifier, nil)
|
128
151
|
true
|
@@ -132,7 +155,7 @@ module SimpleMapper
|
|
132
155
|
end
|
133
156
|
|
134
157
|
def persisted?
|
135
|
-
!!@persisted
|
158
|
+
!!@persisted && (self.class.identifier.nil? || !instance_variable_get('@'+self.class.identifier).nil?)
|
136
159
|
end
|
137
160
|
end
|
138
161
|
end
|
@@ -1,5 +1,4 @@
|
|
1
|
-
|
2
|
-
$:.unshift('gems/gems/oauth-0.2.2/lib')
|
1
|
+
gem 'oauth'
|
3
2
|
require 'oauth'
|
4
3
|
require 'oauth/consumer'
|
5
4
|
require 'oauth/client/net_http'
|
@@ -33,15 +32,13 @@ module SimpleMapper
|
|
33
32
|
def requires_oauth(consumer_key, consumer_secret, options={})
|
34
33
|
@consumer_key = consumer_key
|
35
34
|
@consumer_secret = consumer_secret
|
36
|
-
@oauth_options = options
|
35
|
+
@oauth_options = options || {}
|
37
36
|
|
38
37
|
# Ingeniousity here... ;)
|
39
38
|
# Duplicates the class to give it a temporary session-attached oauth scope, sets oauth to the Model-Controller-OAuth class,
|
40
39
|
# then makes the class use the original class for all of its instantiation.
|
41
40
|
# NOTE: This only really makes the class methods use OAuth. Object methods, like associations, won't play the trick as well.
|
42
41
|
def self.with_oauth(controller)
|
43
|
-
self.element_name = self.element_name
|
44
|
-
self.collection_name = self.collection_name
|
45
42
|
duped = self.dup
|
46
43
|
duped.set_oauth(controller)
|
47
44
|
yield if block_given?
|
@@ -54,7 +51,7 @@ module SimpleMapper
|
|
54
51
|
|
55
52
|
def set_oauth(controller)
|
56
53
|
@oauth = OAuthController.new(controller, self, @consumer_key, @consumer_secret, @oauth_options)
|
57
|
-
|
54
|
+
add_callback('initialize_request') do |request|
|
58
55
|
@oauth.authenticate! if !@oauth.authorized? && @oauth.scriptable?
|
59
56
|
raise RuntimeError, "Must authorize OAuth before attempting to get data from the provider." unless @oauth.authorized?
|
60
57
|
@oauth.request_signed!(request)
|