databasedotcom 1.3.1 → 1.3.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,245 @@
1
+ # databasedotcom
2
+
3
+ [![Build Status](https://travis-ci.org/heroku/databasedotcom.png?branch=master)](https://travis-ci.org/heroku/databasedotcom) [![Code Climate](https://codeclimate.com/badge.png)](https://codeclimate.com/github/heroku/databasedotcom) [![Dependency Status](https://gemnasium.com/heroku/databasedotcom.png)](https://gemnasium.com/heroku/databasedotcom)
4
+
5
+ databasedotcom is a gem to enable ruby applications to access the SalesForce REST API.
6
+ If you use bundler, simply list it in your Gemfile, like so:
7
+
8
+ ```
9
+ gem 'databasedotcom'
10
+ ```
11
+
12
+ If you don't use bundler, install it by hand:
13
+
14
+ ```
15
+ gem install databasedotcom
16
+ ```
17
+
18
+ ## Documentation
19
+
20
+ Reference documentation is available at [rubydoc.info](http://rubydoc.info/github/heroku/databasedotcom/master/frames)
21
+
22
+ ## Source
23
+
24
+ Source is available at [github](http://github.com/heroku/databasedotcom)
25
+
26
+ ## Contributions
27
+
28
+ To contribute, fork this repo, make changes in your fork, then send a pull request.
29
+ No pull requests without accompanying tests will be accepted. To run tests in your
30
+ fork, just do
31
+
32
+ ```
33
+ bundle install
34
+ rake
35
+ ```
36
+
37
+ # Usage
38
+ ## Initialization
39
+ When you create a Databasedotcom::Client object, you need to configure it with a client
40
+ id and client secret that corresponds to one of the Remote Access Applications configured
41
+ within your Salesforce instance. The Salesforce UI refers to the client id as "Consumer Key",
42
+ and to the client secret as "Consumer Secret".
43
+
44
+ You can configure your Client object with a client id and client secret in one of several
45
+ different ways:
46
+
47
+ ### Configuration from the environment
48
+
49
+ If configuration information is present in the environment, the new Client will take configuration
50
+ information from there.
51
+
52
+ ```bash
53
+ export DATABASEDOTCOM_CLIENT_ID=foo
54
+ export DATABASEDOTCOM_CLIENT_SECRET=bar
55
+ ```
56
+
57
+ Then
58
+
59
+ ```ruby
60
+ client = Databasedotcom::Client.new
61
+ client.client_id #=> foo
62
+ client.client_secret #=> bar
63
+ ```
64
+
65
+ ### Configuration from a YAML file
66
+
67
+ If you pass the name of a YAML file when you create a Client, the new Client will read the YAML
68
+ file and take the client id and client secret values from there.
69
+
70
+ ```yaml
71
+ # databasedotcom.yml
72
+ #
73
+ ---
74
+ client_secret: bro
75
+ client_id: baz
76
+ ```
77
+
78
+ Then
79
+
80
+ ```ruby
81
+ client = Databasedotcom::Client.new("databasedotcom.yml")
82
+ client.client_id #=> bro
83
+ client.client_secret #=> baz
84
+ ```
85
+
86
+ ### Configuration from a Hash
87
+
88
+ If you pass a hash when you create a Client, the new Client will take configuration information
89
+ from that Hash.
90
+
91
+ ```ruby
92
+ client = Databasedotcom::Client.new :client_id => "sponge", :client_secret => "bob"
93
+ client.client_id #=> sponge
94
+ client.client_secret #=> bob
95
+ ```
96
+
97
+ ### Configuration precedence
98
+
99
+ Configuration information present in the environment always takes precedence over that passed in
100
+ via a YAML file or a Hash.
101
+
102
+ ```bash
103
+ export DATABASEDOTCOM_CLIENT_ID=foo
104
+ export DATABASEDOTCOM_CLIENT_SECRET=bar
105
+ ```
106
+
107
+ Then
108
+
109
+ ```ruby
110
+ client = Databasedotcom::Client.new :client_id => "sponge", :client_secret => "bob"
111
+ client.client_id #=> foo
112
+ client.client_secret #=> bar
113
+ ```
114
+
115
+ ### Usage in an application deployed on Heroku
116
+
117
+ You can use the `heroku config:add` command to set environment variables:
118
+
119
+ ```bash
120
+ heroku config:add DATABASEDOTCOM_CLIENT_ID=foo
121
+ heroku config:add DATABASEDOTCOM_CLIENT_SECRET=bar
122
+ ```
123
+
124
+ Then, when you create your client like:
125
+
126
+ ```ruby
127
+ client = Databasedotcom::Client.new
128
+ ```
129
+
130
+ it will use the configuration information that you set with `heroku config:add`.
131
+
132
+ ### Connect to a SalesForce sandbox account
133
+
134
+ Specify the `:host` option when creating your Client, e.g,
135
+
136
+ ```ruby
137
+ Databasedotcom::Client.new :host => "test.salesforce.com", ...
138
+ ```
139
+
140
+ ## Authentication
141
+
142
+ The first thing you need to do with the new Client is to authenticate with Salesforce.
143
+ You can do this in one of several ways:
144
+
145
+ ### Authentication via an externally-acquired OAuth access token
146
+
147
+ If you have acquired an OAuth access token for your Salesforce instance through some external
148
+ means, you can use it. Note that you have to pass both the token and your Salesforce instance
149
+ URL to the `authenticate` method:
150
+
151
+ ```ruby
152
+ client.authenticate :token => "my-oauth-token", :instance_url => "http://na1.salesforce.com" #=> "my-oauth-token"
153
+ ```
154
+
155
+ ### Authentication via Omniauth
156
+
157
+ If you are using the gem within the context of a web application, and your web app is using Omniauth
158
+ to do OAuth with Salesforce, you can authentication the Client direction via the Hash that Omniauth
159
+ passes to your OAuth callback method, like so:
160
+
161
+ ```ruby
162
+ client.authenticate request.env['omniauth.auth'] #=> "the-oauth-token"
163
+ ```
164
+
165
+ ### Authentication via username and password
166
+
167
+ You can authenticate your Client directly with Salesforce with a valid username and password for
168
+ a user in your Salesforce instance. Note that, if access to your Salesforce instance requires a
169
+ [security token](http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_concepts_security.htm),
170
+ the value that you pass for <tt>:password</tt> must be the password for the user concatenated with
171
+ her security token.
172
+
173
+ ```ruby
174
+ client.authenticate :username => "foo@bar.com", :password => "ThePasswordTheSecurityToken" #=> "the-oauth-token"
175
+ ```
176
+
177
+ ## Accessing the Sobject API
178
+
179
+ You can retrieve a list of Sobject defined in your Salesforce instance like so:
180
+
181
+ ```ruby
182
+ client.list_sobjects #=> ['User', 'Group', 'Contact']
183
+ ```
184
+
185
+ Once you have the name of an Sobject, the easiest way to interact with it is to first materialize it:
186
+
187
+ ```ruby
188
+ contact_class = client.materialize("Contact") #=> Contact
189
+ ```
190
+
191
+ By default, Sobject classes are materialized into the global namespace- if you want materialize into
192
+ another module, you can easily do configure this:
193
+
194
+ ```ruby
195
+ client.sobject_module = My::Module
196
+ client.materialize("Contact") #=> My::Module::Contact
197
+ ```
198
+
199
+ Materialized Sobject classes behave much like ActiveRecord classes:
200
+
201
+ ```ruby
202
+ contact = Contact.find("contact_id") #=> #<Contact @Id="contact_id", ...>
203
+ contact = Contact.find_by_Name("John Smith") #=> dynamic finders!
204
+ contacts = Contact.all #=> a Databasedotcom::Collection of Contact instances
205
+ contacts = Contact.find_all_by_Company("IBM") #=> a Databasedotcom::Collection of matching Contacts
206
+ contact.Name #=> the contact's Name attribute
207
+ contact["Name"] #=> same thing
208
+ contact.Name = "new name" #=> change the contact's Name attribute, in memory
209
+ contact["Name"] = "new name" #=> same thing
210
+ contact.save #=> save the changes to the database
211
+ contact.update_attributes "Name" => "newer name",
212
+ "Phone" => "4156543210" #=> change several attributes at once and save them
213
+ contact.delete #=> delete the contact from the database
214
+ ```
215
+
216
+ See the [documentation](http://rubydoc.info/github/heroku/databasedotcom/master/frames) for full details.
217
+
218
+ ## Accessing the Chatter API
219
+
220
+ You can easily access Chatter feeds, group, conversations, etc.:
221
+
222
+ ```ruby
223
+ my_feed_items = Databasedotcom::Chatter::UserProfileFeed.find(client) #=> a Databasedotcom::Collection of FeedItems
224
+
225
+ my_feed_items.each do |feed_item|
226
+ feed_item.likes #=> a Databasedotcom::Collection of Like instances
227
+ feed_item.comments #=> a Databasedotcom::Collection of Comment instances
228
+ feed_item.raw_hash #=> the hash returned from the Chatter API describing this FeedItem
229
+ feed_item.comment("This is cool") #=> create a new comment on the FeedItem
230
+ feed_item.like #=> the authenticating user likes the FeedItem
231
+ end
232
+
233
+ me = Databasedotcom::Chatter::User.find(client, "me") #=> a User for the authenticating user
234
+ me.followers #=> a Databasedotcom::Collection of Users
235
+ me.post_status("what I'm doing now") #=> post a new status
236
+
237
+ you = Databasedotcom::Chatter::User.find(client, "your-user-id")
238
+ me.follow(you) #=> start following a user
239
+ ```
240
+
241
+ See the [documentation](http://rubydoc.info/github/heroku/databasedotcom/master/frames) for full details.
242
+
243
+ # License
244
+
245
+ This gem is licensed under the MIT License.
@@ -1,3 +1,5 @@
1
+ require 'active_support/core_ext'
2
+
1
3
  require 'databasedotcom/version'
2
4
  require 'databasedotcom/core_extensions'
3
5
  require 'databasedotcom/client'
@@ -1,3 +1 @@
1
- require 'databasedotcom/core_extensions/class_extensions'
2
1
  require 'databasedotcom/core_extensions/string_extensions'
3
- require 'databasedotcom/core_extensions/hash_extensions'
@@ -6,11 +6,4 @@ class String
6
6
  self.gsub(/([a-z])([A-Z])/, '\1-\2').downcase
7
7
  end
8
8
 
9
- def constantize
10
- unless /\A(?:::)?([A-Z]\w*(?:::[A-Z]\w*)*)\z/ =~ self
11
- raise NameError, "#{self.inspect} is not a valid constant name!"
12
- end
13
- Object.module_eval("::#{$1}", __FILE__, __LINE__)
14
- end
15
-
16
9
  end
@@ -1,3 +1,3 @@
1
1
  module Databasedotcom
2
- VERSION = "1.3.1"
2
+ VERSION = "1.3.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: databasedotcom
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.3.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-06-23 00:00:00.000000000 Z
12
+ date: 2012-12-27 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: multipart-post
16
- requirement: &70124183107340 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ~>
@@ -21,10 +21,15 @@ dependencies:
21
21
  version: '1.1'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70124183107340
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '1.1'
25
30
  - !ruby/object:Gem::Dependency
26
31
  name: json
27
- requirement: &70124183106920 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
28
33
  none: false
29
34
  requirements:
30
35
  - - ! '>='
@@ -32,10 +37,31 @@ dependencies:
32
37
  version: '0'
33
38
  type: :runtime
34
39
  prerelease: false
35
- version_requirements: *70124183106920
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ! '>='
44
+ - !ruby/object:Gem::Version
45
+ version: '0'
46
+ - !ruby/object:Gem::Dependency
47
+ name: activesupport
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ! '>='
52
+ - !ruby/object:Gem::Version
53
+ version: '0'
54
+ type: :runtime
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ! '>='
60
+ - !ruby/object:Gem::Version
61
+ version: '0'
36
62
  - !ruby/object:Gem::Dependency
37
63
  name: rspec
38
- requirement: &70124183106380 !ruby/object:Gem::Requirement
64
+ requirement: !ruby/object:Gem::Requirement
39
65
  none: false
40
66
  requirements:
41
67
  - - ~>
@@ -43,10 +69,15 @@ dependencies:
43
69
  version: '2.6'
44
70
  type: :development
45
71
  prerelease: false
46
- version_requirements: *70124183106380
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: '2.6'
47
78
  - !ruby/object:Gem::Dependency
48
79
  name: webmock
49
- requirement: &70124183105960 !ruby/object:Gem::Requirement
80
+ requirement: !ruby/object:Gem::Requirement
50
81
  none: false
51
82
  requirements:
52
83
  - - ! '>='
@@ -54,18 +85,28 @@ dependencies:
54
85
  version: '0'
55
86
  type: :development
56
87
  prerelease: false
57
- version_requirements: *70124183105960
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ! '>='
92
+ - !ruby/object:Gem::Version
93
+ version: '0'
58
94
  - !ruby/object:Gem::Dependency
59
95
  name: rake
60
- requirement: &70124183105340 !ruby/object:Gem::Requirement
96
+ requirement: !ruby/object:Gem::Requirement
61
97
  none: false
62
98
  requirements:
63
- - - =
99
+ - - ! '>='
64
100
  - !ruby/object:Gem::Version
65
101
  version: 0.8.6
66
102
  type: :development
67
103
  prerelease: false
68
- version_requirements: *70124183105340
104
+ version_requirements: !ruby/object:Gem::Requirement
105
+ none: false
106
+ requirements:
107
+ - - ! '>='
108
+ - !ruby/object:Gem::Version
109
+ version: 0.8.6
69
110
  description: A ruby wrapper for the Force.com REST API
70
111
  email:
71
112
  - me@glenngillen.com
@@ -73,7 +114,7 @@ executables: []
73
114
  extensions: []
74
115
  extra_rdoc_files: []
75
116
  files:
76
- - README.rdoc
117
+ - README.md
77
118
  - MIT-LICENSE
78
119
  - lib/databasedotcom/chatter/comment.rb
79
120
  - lib/databasedotcom/chatter/conversation.rb
@@ -92,8 +133,6 @@ files:
92
133
  - lib/databasedotcom/chatter.rb
93
134
  - lib/databasedotcom/client.rb
94
135
  - lib/databasedotcom/collection.rb
95
- - lib/databasedotcom/core_extensions/class_extensions.rb
96
- - lib/databasedotcom/core_extensions/hash_extensions.rb
97
136
  - lib/databasedotcom/core_extensions/string_extensions.rb
98
137
  - lib/databasedotcom/core_extensions.rb
99
138
  - lib/databasedotcom/sales_force_error.rb
@@ -101,7 +140,7 @@ files:
101
140
  - lib/databasedotcom/sobject.rb
102
141
  - lib/databasedotcom/version.rb
103
142
  - lib/databasedotcom.rb
104
- homepage: ''
143
+ homepage: https://github.com/heroku/databasedotcom
105
144
  licenses: []
106
145
  post_install_message:
107
146
  rdoc_options: []
@@ -121,7 +160,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
121
160
  version: '0'
122
161
  requirements: []
123
162
  rubyforge_project: databasedotcom
124
- rubygems_version: 1.8.11
163
+ rubygems_version: 1.8.23
125
164
  signing_key:
126
165
  specification_version: 3
127
166
  summary: A ruby wrapper for the Force.com REST API
@@ -1,166 +0,0 @@
1
- =databasedotcom
2
- databasedotcom is a gem to enable ruby applications to access the SalesForce REST API. If you use bundler, simply list it in your Gemfile, like so:
3
-
4
- gem 'databasedotcom'
5
-
6
- If you don't use bundler, install it by hand:
7
-
8
- gem install databasedotcom
9
-
10
- =Documentation
11
-
12
- Reference documentation is available at rubydoc.info[http://rubydoc.info/github/heroku/databasedotcom/master/frames]
13
-
14
- =Source
15
-
16
- Source is available at github[http://github.com/heroku/databasedotcom]
17
-
18
- = Contributions
19
-
20
- To contribute, fork this repo, make changes in your fork, then send a pull request. No pull requests without accompanying tests will be accepted. To run tests in your fork, just do
21
-
22
- bundle install
23
- rake
24
-
25
- = Usage
26
- == Initialization
27
- When you create a Databasedotcom::Client object, you need to configure it with a client id and client secret that corresponds to one of the Remote Access Applications configured within your Salesforce instance. The Salesforce UI refers to the client id as "Consumer Key", and to the client secret as "Consumer Secret".
28
-
29
- You can configure your Client object with a client id and client secret in one of several different ways:
30
- === Configuration from the environment
31
- If configuration information is present in the environment, the new Client will take configuration information from there.
32
-
33
- export DATABASEDOTCOM_CLIENT_ID=foo
34
- export DATABASEDOTCOM_CLIENT_SECRET=bar
35
-
36
- Then
37
-
38
- client = Databasedotcom::Client.new
39
- client.client_id #=> foo
40
- client.client_secret #=> bar
41
-
42
- === Configuration from a YAML file
43
- If you pass the name of a YAML file when you create a Client, the new Client will read the YAML file and take the client id and client secret values from there.
44
-
45
- # databasedotcom.yml
46
- #
47
- ---
48
- client_secret: bro
49
- client_id: baz
50
-
51
- Then
52
-
53
- client = Databasedotcom::Client.new("databasedotcom.yml")
54
- client.client_id #=> bro
55
- client.client_secret #=> baz
56
-
57
- === Configuration from a Hash
58
- If you pass a hash when you create a Client, the new Client will take configuration information from that Hash.
59
-
60
- client = Databasedotcom::Client.new :client_id => "sponge", :client_secret => "bob"
61
- client.client_id #=> sponge
62
- client.client_secret #=> bob
63
-
64
- === Configuration precedence
65
- Configuration information present in the environment always takes precedence over that passed in via a YAML file or a Hash.
66
-
67
- export DATABASEDOTCOM_CLIENT_ID=foo
68
- export DATABASEDOTCOM_CLIENT_SECRET=bar
69
-
70
- Then
71
-
72
- client = Databasedotcom::Client.new :client_id => "sponge", :client_secret => "bob"
73
- client.client_id #=> foo
74
- client.client_secret #=> bar
75
-
76
- === Usage in an application deployed on Heroku
77
- You can use the <tt>heroku config:add</tt> command to set environment variables:
78
-
79
- heroku config:add DATABASEDOTCOM_CLIENT_ID=foo
80
- heroku config:add DATABASEDOTCOM_CLIENT_SECRET=bar
81
-
82
- Then, when you create your client like:
83
-
84
- client = Databasedotcom::Client.new
85
-
86
- it will use the configuration information that you set with <tt>heroku config:add</tt>.
87
-
88
- === Connect to a SalesForce sandbox account
89
- Specify the <tt>:host</tt> option when creating your Client, e.g,
90
-
91
- Databasedotcom::Client.new :host => "test.salesforce.com", ...
92
-
93
- == Authentication
94
- The first thing you need to do with the new Client is to authenticate with Salesforce. You can do this in one of several ways:
95
-
96
- === Authentication via an externally-acquired OAuth access token
97
- If you have acquired an OAuth access token for your Salesforce instance through some external means, you can use it. Note that you have to pass both the token and your Salesforce instance URL to the <tt>authenticate</tt> method:
98
-
99
- client.authenticate :token => "my-oauth-token", :instance_url => "http://na1.salesforce.com" #=> "my-oauth-token"
100
-
101
- === Authentication via Omniauth
102
- If you are using the gem within the context of a web application, and your web app is using Omniauth to do OAuth with Salesforce, you can authentication the Client direction via the Hash that Omniauth passes to your OAuth callback method, like so:
103
-
104
- client.authenticate request.env['omniauth.auth'] #=> "the-oauth-token"
105
-
106
- === Authentication via username and password
107
- You can authenticate your Client directly with Salesforce with a valid username and password for a user in your Salesforce instance. Note that, if access to your Salesforce instance requires a {security token}[http://www.salesforce.com/us/developer/docs/api/Content/sforce_api_concepts_security.htm], the value that you pass for <tt>:password</tt> must be the password for the user concatenated with her security token.
108
-
109
- client.authenticate :username => "foo@bar.com", :password => "ThePasswordTheSecurityToken" #=> "the-oauth-token"
110
-
111
- == Accessing the Sobject API
112
- You can retrieve a list of Sobject defined in your Salesforce instance like so:
113
-
114
- client.list_sobjects #=> ['User', 'Group', 'Contact']
115
-
116
- Once you have the name of an Sobject, the easiest way to interact with it is to first materialize it:
117
-
118
- contact_class = client.materialize("Contact") #=> Contact
119
-
120
- By default, Sobject classes are materialized into the global namespace- if you want materialize into another module, you can easily do configure this:
121
-
122
- client.sobject_module = My::Module
123
- client.materialize("Contact") #=> My::Module::Contact
124
-
125
- Materialized Sobject classes behave much like ActiveRecord classes:
126
-
127
- contact = Contact.find("contact_id") #=> #<Contact @Id="contact_id", ...>
128
- contact = Contact.find_by_Name("John Smith") #=> dynamic finders!
129
- contacts = Contact.all #=> a Databasedotcom::Collection of Contact instances
130
- contacts = Contact.find_all_by_Company("IBM") #=> a Databasedotcom::Collection of matching Contacts
131
- contact.Name #=> the contact's Name attribute
132
- contact["Name"] #=> same thing
133
- contact.Name = "new name" #=> change the contact's Name attribute, in memory
134
- contact["Name"] = "new name" #=> same thing
135
- contact.save #=> save the changes to the database
136
- contact.update_attributes "Name" => "newer name",
137
- "Phone" => "4156543210" #=> change several attributes at once and save them
138
- contact.delete #=> delete the contact from the database
139
-
140
- See the documentation[http://rubydoc.info/github/heroku/databasedotcom/master/frames] for full details.
141
-
142
- == Accessing the Chatter API
143
- You can easily access Chatter feeds, group, conversations, etc.:
144
-
145
- my_feed_items = Databasedotcom::Chatter::UserProfileFeed.find(client) #=> a Databasedotcom::Collection of FeedItems
146
-
147
- my_feed_items.each do |feed_item|
148
- feed_item.likes #=> a Databasedotcom::Collection of Like instances
149
- feed_item.comments #=> a Databasedotcom::Collection of Comment instances
150
- feed_item.raw_hash #=> the hash returned from the Chatter API describing this FeedItem
151
- feed_item.comment("This is cool") #=> create a new comment on the FeedItem
152
- feed_item.like #=> the authenticating user likes the FeedItem
153
- end
154
-
155
- me = Databasedotcom::Chatter::User.find(client, "me") #=> a User for the authenticating user
156
- me.followers #=> a Databasedotcom::Collection of Users
157
- me.post_status("what I'm doing now") #=> post a new status
158
-
159
- you = Databasedotcom::Chatter::User.find(client, "your-user-id")
160
- me.follow(you) #=> start following a user
161
-
162
- See the documentation[http://rubydoc.info/github/heroku/databasedotcom/master/frames] for full details.
163
-
164
- = License
165
-
166
- This gem is licensed under the MIT License.
@@ -1,41 +0,0 @@
1
- # This extends Class to be able to use +cattr_accessor+ if active_support is not being used.
2
- class Class
3
- unless respond_to?(:cattr_reader)
4
- def cattr_reader(sym)
5
- class_eval(<<-EOS, __FILE__, __LINE__ + 1)
6
- unless defined? @@#{sym}
7
- @@#{sym} = nil
8
- end
9
-
10
- def self.#{sym}
11
- @@#{sym}
12
- end
13
-
14
- def #{sym}
15
- @@#{sym}
16
- end
17
- EOS
18
- end
19
-
20
- def cattr_writer(sym)
21
- class_eval(<<-EOS, __FILE__, __LINE__ + 1)
22
- unless defined? @@#{sym}
23
- @@#{sym} = nil
24
- end
25
-
26
- def self.#{sym}=(obj)
27
- @@#{sym} = obj
28
- end
29
-
30
- def #{sym}=(obj)
31
- @@#{sym} = obj
32
- end
33
- EOS
34
- end
35
-
36
- def cattr_accessor(*syms, &blk)
37
- cattr_reader(*syms)
38
- cattr_writer(*syms, &blk)
39
- end
40
- end
41
- end
@@ -1,8 +0,0 @@
1
- class Hash
2
- def symbolize_keys!
3
- keys.each do |key|
4
- self[(key.to_sym rescue key) || key] = delete(key)
5
- end
6
- self
7
- end
8
- end