cloudfuji 0.0.44 → 0.0.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/lib/cloudfuji.rb CHANGED
@@ -23,6 +23,7 @@ module Cloudfuji #:nodoc:
23
23
  require "cloudfuji/app"
24
24
  require "cloudfuji/user"
25
25
  require "cloudfuji/event"
26
+ require "cloudfuji/expectation"
26
27
  require "cloudfuji/version"
27
28
  require "cloudfuji/envs"
28
29
  require "cloudfuji/data"
@@ -6,37 +6,23 @@ module Cloudfuji
6
6
  # * data
7
7
  # Data will hold the arbitrary data for the type of event signalled
8
8
  class Event
9
- begin
10
- @@events = JSON.parse(ENV["CLOUDFUJI_EVENTS"]) #:nodoc:
11
- rescue
12
- @@events = []
13
- end
14
-
15
9
  attr_reader :category, :name, :data
16
10
 
17
11
  class << self
18
12
  def events_url
19
13
  "#{Cloudfuji::Platform.host}/apps/#{Cloudfuji::Platform.name}/events.json"
20
14
  end
21
-
22
- # Lists all events
23
- def all
24
- @@events.collect{ |e| Event.new(e) }
25
- end
26
15
 
27
- # Lists the first (oldest) event
28
- def first
29
- Event.new(@@events.first)
16
+ def event_url(event_ido_id)
17
+ "#{Cloudfuji::Platform.host}/apps/#{Cloudfuji::Platform.name}/events/#{event_ido_id}.json"
30
18
  end
31
-
32
- # Lists the last (newest) event
33
- def last
34
- Event.new(@@events.last)
35
- end
36
-
37
- # NOOP right now
38
- def refresh
39
- @@events = Cloudfuji::Command.get_command(events_url)
19
+
20
+ # Find an event by its ido_id Be careful not to abuse this - an
21
+ # app can be throttled if requesting too many events too
22
+ # quickly, which will cause errors and a bad user experience for
23
+ # the end user
24
+ def find(event_ido_id)
25
+ Cloudfuji::Command.get_command(event_url(event_ido_id))
40
26
  end
41
27
 
42
28
  def publish(options={})
@@ -0,0 +1,27 @@
1
+ module Cloudfuji
2
+ class Expectation
3
+ class << self
4
+ def expectations_url
5
+ "#{Cloudfuji::Platform.host}/apps/#{Cloudfuji::Platform.name}/expectations.json"
6
+ end
7
+
8
+ def create!(options={})
9
+ # Enforce standard format on client side so that any errors
10
+ # can be more quickly caught for the developer
11
+ return StandardError("Cloudfuji::Event format incorrect, please make sure you're using the correct structure for sending events") unless !options[:criteria].nil? && !options[:expires_at].nil? && !options[:event].nil?
12
+ return StandardError("Cloudfuji::Event format incorrect, please make sure you're using the correct structure for sending events") unless !options[:event][:category].nil? && !options[:event][:name].nil? && !options[:event][:data].nil?
13
+
14
+ expectation = {}
15
+ expectation[:criteria] = options[:criteria]
16
+ expectation[:expires_at] = options[:expires_at]
17
+ expectation[:event] = options[:event]
18
+ expectation[:parent_event_id] = options[:parent_event_id]
19
+
20
+ payload = {:expectation => expectation}
21
+
22
+ Cloudfuji::Command.post_command(expectations_url, payload)
23
+ end
24
+
25
+ end
26
+ end
27
+ end
@@ -1,4 +1,4 @@
1
1
  module Cloudfuji
2
2
  # Current version of the Cloudfuji gem
3
- VERSION = "0.0.44"
3
+ VERSION = "0.0.45"
4
4
  end
metadata CHANGED
@@ -1,91 +1,74 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: cloudfuji
3
- version: !ruby/object:Gem::Version
4
- version: 0.0.44
3
+ version: !ruby/object:Gem::Version
5
4
  prerelease:
5
+ version: 0.0.45
6
6
  platform: ruby
7
- authors:
7
+ authors:
8
8
  - Sean Grove
9
9
  - Kev Zettler
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2012-05-29 00:00:00.000000000 Z
14
- dependencies:
15
- - !ruby/object:Gem::Dependency
13
+
14
+ date: 2012-06-03 00:00:00 Z
15
+ dependencies:
16
+ - !ruby/object:Gem::Dependency
16
17
  name: rest-client
17
- requirement: !ruby/object:Gem::Requirement
18
+ requirement: &id001 !ruby/object:Gem::Requirement
18
19
  none: false
19
- requirements:
20
- - - ! '>='
21
- - !ruby/object:Gem::Version
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
22
23
  version: 1.6.1
23
24
  type: :runtime
24
25
  prerelease: false
25
- version_requirements: !ruby/object:Gem::Requirement
26
- none: false
27
- requirements:
28
- - - ! '>='
29
- - !ruby/object:Gem::Version
30
- version: 1.6.1
31
- - !ruby/object:Gem::Dependency
26
+ version_requirements: *id001
27
+ - !ruby/object:Gem::Dependency
32
28
  name: json
33
- requirement: !ruby/object:Gem::Requirement
29
+ requirement: &id002 !ruby/object:Gem::Requirement
34
30
  none: false
35
- requirements:
36
- - - ! '>='
37
- - !ruby/object:Gem::Version
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
38
34
  version: 1.4.6
39
35
  type: :runtime
40
36
  prerelease: false
41
- version_requirements: !ruby/object:Gem::Requirement
42
- none: false
43
- requirements:
44
- - - ! '>='
45
- - !ruby/object:Gem::Version
46
- version: 1.4.6
47
- - !ruby/object:Gem::Dependency
37
+ version_requirements: *id002
38
+ - !ruby/object:Gem::Dependency
48
39
  name: highline
49
- requirement: !ruby/object:Gem::Requirement
40
+ requirement: &id003 !ruby/object:Gem::Requirement
50
41
  none: false
51
- requirements:
52
- - - ! '>='
53
- - !ruby/object:Gem::Version
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
54
45
  version: 1.6.1
55
46
  type: :runtime
56
47
  prerelease: false
57
- version_requirements: !ruby/object:Gem::Requirement
58
- none: false
59
- requirements:
60
- - - ! '>='
61
- - !ruby/object:Gem::Version
62
- version: 1.6.1
63
- - !ruby/object:Gem::Dependency
48
+ version_requirements: *id003
49
+ - !ruby/object:Gem::Dependency
64
50
  name: orm_adapter
65
- requirement: !ruby/object:Gem::Requirement
51
+ requirement: &id004 !ruby/object:Gem::Requirement
66
52
  none: false
67
- requirements:
53
+ requirements:
68
54
  - - ~>
69
- - !ruby/object:Gem::Version
55
+ - !ruby/object:Gem::Version
70
56
  version: 0.0.3
71
57
  type: :runtime
72
58
  prerelease: false
73
- version_requirements: !ruby/object:Gem::Requirement
74
- none: false
75
- requirements:
76
- - - ~>
77
- - !ruby/object:Gem::Version
78
- version: 0.0.3
59
+ version_requirements: *id004
79
60
  description: A module for integrating the Cloudfuji platform into a ruby app
80
- email:
61
+ email:
81
62
  - support@cloudfuji.com
82
63
  - s@bushi.do
83
64
  - k@bushi.do
84
- executables:
65
+ executables:
85
66
  - cloudfuji
86
67
  extensions: []
68
+
87
69
  extra_rdoc_files: []
88
- files:
70
+
71
+ files:
89
72
  - .gitignore
90
73
  - .rspec
91
74
  - Gemfile
@@ -112,6 +95,7 @@ files:
112
95
  - lib/cloudfuji/envs_helper.rb
113
96
  - lib/cloudfuji/event.rb
114
97
  - lib/cloudfuji/event_observer.rb
98
+ - lib/cloudfuji/expectation.rb
115
99
  - lib/cloudfuji/mail_helper.rb
116
100
  - lib/cloudfuji/mail_route.rb
117
101
  - lib/cloudfuji/middleware.rb
@@ -257,32 +241,148 @@ files:
257
241
  - test_app/spec/views/home.html.erb_spec.rb
258
242
  homepage: https://github.com/cloudfuji/cloudfuji_client
259
243
  licenses: []
244
+
260
245
  post_install_message:
261
246
  rdoc_options: []
262
- require_paths:
247
+
248
+ require_paths:
263
249
  - lib
264
- required_ruby_version: !ruby/object:Gem::Requirement
250
+ required_ruby_version: !ruby/object:Gem::Requirement
265
251
  none: false
266
- requirements:
267
- - - ! '>='
268
- - !ruby/object:Gem::Version
269
- version: '0'
270
- segments:
252
+ requirements:
253
+ - - ">="
254
+ - !ruby/object:Gem::Version
255
+ hash: -942491381349623522
256
+ segments:
271
257
  - 0
272
- hash: 957748079068696331
273
- required_rubygems_version: !ruby/object:Gem::Requirement
258
+ version: "0"
259
+ required_rubygems_version: !ruby/object:Gem::Requirement
274
260
  none: false
275
- requirements:
276
- - - ! '>='
277
- - !ruby/object:Gem::Version
278
- version: '0'
279
- segments:
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ hash: -942491381349623522
265
+ segments:
280
266
  - 0
281
- hash: 957748079068696331
267
+ version: "0"
282
268
  requirements: []
269
+
283
270
  rubyforge_project: cloudfuji
284
- rubygems_version: 1.8.24
271
+ rubygems_version: 1.8.17
285
272
  signing_key:
286
273
  specification_version: 3
287
274
  summary: Cloudfuji integration
288
- test_files: []
275
+ test_files:
276
+ - spec/app_spec/controllers/envs_controller_spec.rb
277
+ - spec/app_spec/controllers/mail_controller_spec.rb
278
+ - spec/app_spec/integration/app_claim_spec.rb
279
+ - spec/gem_spec/base_spec.rb
280
+ - spec/gem_spec/command_spec.rb
281
+ - spec/gem_spec/config_spec.rb
282
+ - spec/gem_spec/data_spec.rb
283
+ - spec/gem_spec/hooks_spec.rb
284
+ - spec/gem_spec/mail_route_spec.rb
285
+ - spec/gem_spec/platform_spec.rb
286
+ - spec/gem_spec/user_spec.rb
287
+ - spec/spec_helper.rb
288
+ - spec/test_apps/rails-2.3/.gitignore
289
+ - spec/test_apps/rails-2.3/Gemfile
290
+ - spec/test_apps/rails-2.3/README
291
+ - spec/test_apps/rails-2.3/Rakefile
292
+ - spec/test_apps/rails-2.3/app/controllers/application_controller.rb
293
+ - spec/test_apps/rails-2.3/app/helpers/application_helper.rb
294
+ - spec/test_apps/rails-2.3/config/boot.rb
295
+ - spec/test_apps/rails-2.3/config/environment.rb
296
+ - spec/test_apps/rails-2.3/config/environments/development.rb
297
+ - spec/test_apps/rails-2.3/config/environments/production.rb
298
+ - spec/test_apps/rails-2.3/config/environments/test.rb
299
+ - spec/test_apps/rails-2.3/config/initializers/backtrace_silencers.rb
300
+ - spec/test_apps/rails-2.3/config/initializers/cookie_verification_secret.rb
301
+ - spec/test_apps/rails-2.3/config/initializers/inflections.rb
302
+ - spec/test_apps/rails-2.3/config/initializers/mime_types.rb
303
+ - spec/test_apps/rails-2.3/config/initializers/new_rails_defaults.rb
304
+ - spec/test_apps/rails-2.3/config/initializers/session_store.rb
305
+ - spec/test_apps/rails-2.3/config/locales/en.yml
306
+ - spec/test_apps/rails-2.3/config/routes.rb
307
+ - spec/test_apps/rails-2.3/db/seeds.rb
308
+ - spec/test_apps/rails-2.3/doc/README_FOR_APP
309
+ - spec/test_apps/rails-2.3/lib/tasks/rspec.rake
310
+ - spec/test_apps/rails-2.3/public/404.html
311
+ - spec/test_apps/rails-2.3/public/422.html
312
+ - spec/test_apps/rails-2.3/public/500.html
313
+ - spec/test_apps/rails-2.3/public/favicon.ico
314
+ - spec/test_apps/rails-2.3/public/images/rails.png
315
+ - spec/test_apps/rails-2.3/public/javascripts/application.js
316
+ - spec/test_apps/rails-2.3/public/javascripts/controls.js
317
+ - spec/test_apps/rails-2.3/public/javascripts/dragdrop.js
318
+ - spec/test_apps/rails-2.3/public/javascripts/effects.js
319
+ - spec/test_apps/rails-2.3/public/javascripts/prototype.js
320
+ - spec/test_apps/rails-2.3/public/robots.txt
321
+ - spec/test_apps/rails-2.3/script/about
322
+ - spec/test_apps/rails-2.3/script/autospec
323
+ - spec/test_apps/rails-2.3/script/console
324
+ - spec/test_apps/rails-2.3/script/dbconsole
325
+ - spec/test_apps/rails-2.3/script/destroy
326
+ - spec/test_apps/rails-2.3/script/generate
327
+ - spec/test_apps/rails-2.3/script/performance/benchmarker
328
+ - spec/test_apps/rails-2.3/script/performance/profiler
329
+ - spec/test_apps/rails-2.3/script/plugin
330
+ - spec/test_apps/rails-2.3/script/runner
331
+ - spec/test_apps/rails-2.3/script/server
332
+ - spec/test_apps/rails-2.3/script/spec
333
+ - spec/test_apps/rails-2.3/spec/all_spec.rb
334
+ - spec/test_apps/rails-2.3/spec/rcov.opts
335
+ - spec/test_apps/rails-2.3/spec/spec.opts
336
+ - spec/test_apps/rails-2.3/spec/spec_helper.rb
337
+ - spec/test_apps/rails-2.3/test/performance/browsing_test.rb
338
+ - spec/test_apps/rails-2.3/test/test_helper.rb
339
+ - spec/test_apps/rails-3.0/.gitignore
340
+ - spec/test_apps/rails-3.0/.rspec
341
+ - spec/test_apps/rails-3.0/Gemfile
342
+ - spec/test_apps/rails-3.0/README
343
+ - spec/test_apps/rails-3.0/Rakefile
344
+ - spec/test_apps/rails-3.0/app/controllers/application_controller.rb
345
+ - spec/test_apps/rails-3.0/app/controllers/static_controller.rb
346
+ - spec/test_apps/rails-3.0/app/helpers/application_helper.rb
347
+ - spec/test_apps/rails-3.0/app/helpers/static_helper.rb
348
+ - spec/test_apps/rails-3.0/app/views/layouts/application.html.erb
349
+ - spec/test_apps/rails-3.0/app/views/static/home.html.erb
350
+ - spec/test_apps/rails-3.0/config.ru
351
+ - spec/test_apps/rails-3.0/config/application.rb
352
+ - spec/test_apps/rails-3.0/config/boot.rb
353
+ - spec/test_apps/rails-3.0/config/environment.rb
354
+ - spec/test_apps/rails-3.0/config/environments/development.rb
355
+ - spec/test_apps/rails-3.0/config/environments/production.rb
356
+ - spec/test_apps/rails-3.0/config/environments/test.rb
357
+ - spec/test_apps/rails-3.0/config/initializers/backtrace_silencers.rb
358
+ - spec/test_apps/rails-3.0/config/initializers/inflections.rb
359
+ - spec/test_apps/rails-3.0/config/initializers/mime_types.rb
360
+ - spec/test_apps/rails-3.0/config/initializers/secret_token.rb
361
+ - spec/test_apps/rails-3.0/config/initializers/session_store.rb
362
+ - spec/test_apps/rails-3.0/config/locales/en.yml
363
+ - spec/test_apps/rails-3.0/config/routes.rb
364
+ - spec/test_apps/rails-3.0/db/schema.rb
365
+ - spec/test_apps/rails-3.0/db/seeds.rb
366
+ - spec/test_apps/rails-3.0/doc/README_FOR_APP
367
+ - spec/test_apps/rails-3.0/lib/tasks/.gitkeep
368
+ - spec/test_apps/rails-3.0/public/404.html
369
+ - spec/test_apps/rails-3.0/public/422.html
370
+ - spec/test_apps/rails-3.0/public/500.html
371
+ - spec/test_apps/rails-3.0/public/favicon.ico
372
+ - spec/test_apps/rails-3.0/public/images/rails.png
373
+ - spec/test_apps/rails-3.0/public/index.html
374
+ - spec/test_apps/rails-3.0/public/javascripts/application.js
375
+ - spec/test_apps/rails-3.0/public/javascripts/controls.js
376
+ - spec/test_apps/rails-3.0/public/javascripts/dragdrop.js
377
+ - spec/test_apps/rails-3.0/public/javascripts/effects.js
378
+ - spec/test_apps/rails-3.0/public/javascripts/prototype.js
379
+ - spec/test_apps/rails-3.0/public/javascripts/rails.js
380
+ - spec/test_apps/rails-3.0/public/robots.txt
381
+ - spec/test_apps/rails-3.0/public/stylesheets/.gitkeep
382
+ - spec/test_apps/rails-3.0/script/rails
383
+ - spec/test_apps/rails-3.0/spec/all_spec.rb
384
+ - spec/test_apps/rails-3.0/spec/spec_helper.rb
385
+ - spec/test_apps/rails-3.0/test/performance/browsing_test.rb
386
+ - spec/test_apps/rails-3.0/test/test_helper.rb
387
+ - spec/test_apps/rails-3.0/vendor/plugins/.gitkeep
388
+ - test_app/spec/views/home.html.erb_spec.rb