-
Notifications
You must be signed in to change notification settings - Fork 1
/
notes.txt
170 lines (146 loc) · 6.23 KB
/
notes.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
brian
chris
Call page on cell phone number listed on business after
Tips
-research the website
-explain your passion for social interaction sites, namely doing them better
-pair programming experiences
-ror
-linux open source, test driven
ruby script/generate scaffold oauth_remote_service_provider name:string description:string authenticate_url:string consumer_key:string consumer_secret:string authorize_url:string
name:string description:string authenticate_url:string consumer_key:string consumer_secret:string authorize_url:string
ruby script/generate rspec_scaffold oauth_remote_access_token oauth_remote_service_provider_id:integer,user_id:integer,token_object:string
newrelic install
+ ./LICENSE
+ ./README
+ ./init.rb
+ ./install.rb
+ ./lib/newrelic/agent/agent.rb
+ ./lib/newrelic/agent/error_collector.rb
+ ./lib/newrelic/agent/instrumentation/action_controller.rb
+ ./lib/newrelic/agent/instrumentation/action_web_service.rb
+ ./lib/newrelic/agent/instrumentation/active_record.rb
+ ./lib/newrelic/agent/instrumentation/dispatcher.rb
+ ./lib/newrelic/agent/instrumentation/errors.rb
+ ./lib/newrelic/agent/instrumentation/memcache.rb
+ ./lib/newrelic/agent/instrumentation/memcached.rb
+ ./lib/newrelic/agent/instrumentation/rails.rb
+ ./lib/newrelic/agent/method_tracer.rb
+ ./lib/newrelic/agent/samplers/cpu.rb
+ ./lib/newrelic/agent/samplers/memory.rb
+ ./lib/newrelic/agent/samplers/mongrel.rb
+ ./lib/newrelic/agent/stats_engine.rb
+ ./lib/newrelic/agent/synchronize.rb
+ ./lib/newrelic/agent/transaction_sampler.rb
+ ./lib/newrelic/agent/worker_loop.rb
+ ./lib/newrelic/agent.rb
+ ./lib/newrelic/metric_data.rb
+ ./lib/newrelic/noticed_error.rb
+ ./lib/newrelic/shim_agent.rb
+ ./lib/newrelic/stats.rb
+ ./lib/newrelic/transaction_sample.rb
+ ./lib/newrelic_routing.rb
+ ./newrelic.yml
+ ./tasks/agent_tests.rake
+ ./test/newrelic/agent/mock_agent.rb
+ ./test/newrelic/agent/mock_ar_connection.rb
+ ./test/newrelic/agent/mock_http.rb
+ ./test/newrelic/agent/mock_http_server.rb
+ ./test/newrelic/agent/mock_scope_listener.rb
+ ./test/newrelic/agent/tc_agent.rb
+ ./test/newrelic/agent/tc_controller.rb
+ ./test/newrelic/agent/tc_error_collector.rb
+ ./test/newrelic/agent/tc_method_tracer.rb
+ ./test/newrelic/agent/tc_stats_engine.rb
+ ./test/newrelic/agent/tc_synchronize.rb
+ ./test/newrelic/agent/tc_transaction_sample.rb
+ ./test/newrelic/agent/tc_transaction_sample_builder.rb
+ ./test/newrelic/agent/tc_transaction_sampler.rb
+ ./test/newrelic/agent/tc_worker_loop.rb
+ ./test/newrelic/agent/testable_agent.rb
+ ./test/newrelic/tc_stats.rb
+ ./ui/controllers/newrelic_controller.rb
+ ./ui/helpers/google_pie_chart.rb
+ ./ui/helpers/newrelic_helper.rb
+ ./ui/helpers/transaction_analysis.rb
+ ./ui/views/layouts/default.rhtml
+ ./ui/views/newrelic/_sample.rhtml
+ ./ui/views/newrelic/_segment.rhtml
+ ./ui/views/newrelic/_segment_row.rhtml
+ ./ui/views/newrelic/_show_sample_detail.rhtml
+ ./ui/views/newrelic/_show_sample_sql.rhtml
+ ./ui/views/newrelic/_show_sample_summary.rhtml
+ ./ui/views/newrelic/_sql_row.rhtml
+ ./ui/views/newrelic/_stack_trace.rhtml
+ ./ui/views/newrelic/_table.rhtml
+ ./ui/views/newrelic/explain_sql.rhtml
+ ./ui/views/newrelic/images/16-arrow-down.png
+ ./ui/views/newrelic/images/16-arrow-right.png
+ ./ui/views/newrelic/images/blue_bar.gif
+ ./ui/views/newrelic/images/gray_bar.gif
+ ./ui/views/newrelic/index.rhtml
+ ./ui/views/newrelic/javascript/transaction_sample.js
+ ./ui/views/newrelic/sample_not_found.rhtml
+ ./ui/views/newrelic/show_sample.rhtml
+ ./ui/views/newrelic/show_source.rhtml
+ ./ui/views/newrelic/stylesheets/style.css
Syntax:
token_object = @token = User.current.oauth_remote_access_tokens.find_by_name("firebird")
class OauthRemoteServiceProvider < ActiveRecord::Base
has_many :oauth_remote_access_tokens
validates_pressence_of :name
validates_uniquenes_of :name
validates_pressence_of :consumer_key
validates_pressence_of :consumer_secret
validates_format_of :authorize_url, :with => /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix, :message => "is not a valid url"
end
class OauthRemoteAccessToken < ActiveRecord::Base
after_validation_on_create :delete_existing_access_token_if_exists
belongs_to :user
belongs_to :oauth_remote_service_provider
serialize :token_object # serializes OAuth::AccessToken
alias :expire, :destroy
# there should only be one active access token per service provider per user
def delete_existing_access_token_if_exists
if(existing_token = OauthRemoteAccessToken.find(:conditions => ['oauth_service_provider_id = ? AND user_id = ?',self.oauth_service_provider_id, self.user_id])
existing_token.destroy
end
end
end
describe OauthRemoteAccessToken
it "self.expire should destroy token" do
end
it "should delete exisiting access token on save, if validations pass"
it "should serialize the given access token"
end
module OauthFinderMethods
self.included
define_method
end
end
# validates the correctness and existance of a given url
# adapted from: http://www.igvita.com/2006/09/07/validating-url-in-ruby-on-rails/
class ActiveRecord::Base
def self.validates_uri_and_existence_of(*attr_names)
configuration = { :message => "is not valid or not responding", :on => :save }
configuration.update(attr_names.pop) if attr_names.last.is_a?(Hash)
valid_uri = /(^$)|(^(http|https):\/\/[a-z0-9]+([\-\.]{1}[a-z0-9]+)*\.[a-z]{2,5}(([0-9]{1,5})?\/.*)?$)/ix
validates_each(attr_names, configuration) do |r, a, v|
if v.to_s =~ valid_uri # check RegExp
begin # check header response
case Net::HTTP.get_response(URI.parse(v))
when Net::HTTPSuccess then true
else r.errors.add(a, "does not exist, or is not responding") and false
end
rescue # Recover on DNS failures..
r.errors.add(a, "does not exist, or is not responding") and false
end
else
r.errors.add(a, "is not a valid URI") and false
end
end
end
end
class OauthAccessToken < ActiveRecord::Base
serialize :token_object
end