Module: MontageRails
- Defined in:
- lib/montage_rails.rb,
lib/montage_rails/base.rb,
lib/montage_rails/errors.rb,
lib/montage_rails/boolean.rb,
lib/montage_rails/railtie.rb,
lib/montage_rails/version.rb,
lib/montage_rails/relation.rb,
lib/montage_rails/base/column.rb,
lib/montage_rails/mock_server.rb,
lib/montage_rails/query_cache.rb,
lib/montage_rails/log_subscriber.rb,
lib/montage_rails/application_resource.rb
Defined Under Namespace
Classes: ApplicationResource, AttributeMissingError, Base, Boolean, LogSubscriber, MockServer, ModelGenerator, MontageAPIError, QueryCache, Railtie, Relation, RelationError
Constant Summary collapse
- VERSION =
"1.0.0"
Class Attribute Summary collapse
-
.debugger ⇒ Object
Returns the value of attribute debugger.
-
.domain ⇒ Object
Returns the value of attribute domain.
-
.no_caching ⇒ Object
Returns the value of attribute no_caching.
-
.password ⇒ Object
Returns the value of attribute password.
-
.token ⇒ Object
Returns the value of attribute token.
-
.use_mock_server ⇒ Object
Returns the value of attribute use_mock_server.
-
.username ⇒ Object
Returns the value of attribute username.
Class Method Summary collapse
- .boot_server ⇒ Object
- .configure {|_self| ... } ⇒ Object
- .connection ⇒ Object
- .notify(caller, &block) ⇒ Object
- .test_server ⇒ Object
Class Attribute Details
.debugger ⇒ Object
Returns the value of attribute debugger.
17 18 19 |
# File 'lib/montage_rails.rb', line 17 def debugger @debugger end |
.domain ⇒ Object
Returns the value of attribute domain.
17 18 19 |
# File 'lib/montage_rails.rb', line 17 def domain @domain end |
.no_caching ⇒ Object
Returns the value of attribute no_caching.
17 18 19 |
# File 'lib/montage_rails.rb', line 17 def no_caching @no_caching end |
.password ⇒ Object
Returns the value of attribute password.
17 18 19 |
# File 'lib/montage_rails.rb', line 17 def password @password end |
.token ⇒ Object
Returns the value of attribute token.
17 18 19 |
# File 'lib/montage_rails.rb', line 17 def token @token end |
.use_mock_server ⇒ Object
Returns the value of attribute use_mock_server.
17 18 19 |
# File 'lib/montage_rails.rb', line 17 def use_mock_server @use_mock_server end |
.username ⇒ Object
Returns the value of attribute username.
17 18 19 |
# File 'lib/montage_rails.rb', line 17 def username @username end |
Class Method Details
.boot_server ⇒ Object
26 27 28 |
# File 'lib/montage_rails.rb', line 26 def boot_server test_server.boot if Rails.env.test? end |
.configure {|_self| ... } ⇒ Object
19 20 21 22 23 24 |
# File 'lib/montage_rails.rb', line 19 def configure yield self validate get_token unless token boot_server if use_mock_server end |
.connection ⇒ Object
35 36 37 38 39 40 41 42 43 44 |
# File 'lib/montage_rails.rb', line 35 def connection @connection ||= begin Montage::Client.new do |c| c.token = token c.domain = domain c.environment = Rails.env c.test_url = "http://#{test_server.host}:#{test_server.port}/montage_rails_mock" end end end |
.notify(caller, &block) ⇒ Object
46 47 48 49 50 |
# File 'lib/montage_rails.rb', line 46 def notify(caller, &block) ActiveSupport::Notifications.instrument("reql.montage_rails", caller.payload) do yield end end |
.test_server ⇒ Object
30 31 32 33 |
# File 'lib/montage_rails.rb', line 30 def test_server require 'capybara/rails' if defined?(Rails) @test_server ||= ::Server.new(Rails.application) end |