informant-rails 0.3.0 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: e78c8253683a9d854fb0702b6fb28502f0921e24
4
- data.tar.gz: 52294cde986bc75570ad277d1e9358bfd27ee64f
3
+ metadata.gz: b475336e08262fb18d9144935a74c840e66eb077
4
+ data.tar.gz: 97825732d9a6b6eec24086e3204512ad9a0ceab9
5
5
  SHA512:
6
- metadata.gz: d074dc65c5f740aeb80ae77add7bdc9fbe0eae46daeb0147c18688454f7910f796f3d3fc677fc5b0ed2239a0ff3f722df676aab012f690e06fed250b98a6a487
7
- data.tar.gz: 694cf69ce4a38a6137585757c550e35d6c69d8508b2c90d34931a02dbc611c7637dfb975afb88f4b177314ccfab9ba717e838f960fbde40b324e96260467c82c
6
+ metadata.gz: 9d4de5d1a83e3cbae1501a77cd610a027d237a4ea6c0c035f2b12284a4b483124c58015739bb00b0fc251ab109732ff7480a9f2fd86b55e37fe3390dc64346c4
7
+ data.tar.gz: 9b55616f2b53852b21343a429374e6125c62a3f2fc240c5b470f911006d28207dc07c24f917d5703674522fca6ac3017c78f4693755f53c7e09169b520b4f6a7
data/README.markdown CHANGED
@@ -4,14 +4,14 @@
4
4
 
5
5
  The informant-rails gem provides Rails and ActiveRecord hooks for The Informant.
6
6
 
7
- [![Homepage](https://addons.heroku.com/informant)](https://addons.heroku.com.com/informant)
7
+ [![Homepage](https://s3.amazonaws.com/assets.heroku.com/addons.heroku.com/icons/1347/original.png)](https://addons.heroku.com/informant)
8
8
 
9
9
  ## Compatibility
10
10
 
11
11
  The informant-rails gem is tested against Ruby 1.9.3, 2.0.0, and Rubinius.
12
12
 
13
- [![Build Status](https://secure.travis-ci.org/theinformant/informant-rails.png)](http://travis-ci.org/informant/informant-rails)
14
- [![Code Climate](https://codeclimate.com/github/theinformant/informant-rails.png)](https://codeclimate.com/github/informant/informant-rails)
13
+ [![Build Status](https://travis-ci.org/informantapp/informant-rails.svg?branch=master)](https://travis-ci.org/informantapp/informant-rails)
14
+ [![Code Climate](https://codeclimate.com/github/informantapp/informant-rails.png)](https://codeclimate.com/github/informantapp/informant-rails)
15
15
 
16
16
  ## Installation
17
17
 
@@ -1,11 +1,15 @@
1
1
  require 'informant-rails/railtie'
2
2
 
3
+ load File.join(File.dirname(__FILE__), 'tasks', 'test_connection.rake')
4
+
3
5
  module InformantRails
4
- autoload :Config, 'informant-rails/config'
5
- autoload :Client, 'informant-rails/client'
6
- autoload :FieldError, 'informant-rails/field_error'
7
- autoload :Middleware, 'informant-rails/middleware'
8
- autoload :Model, 'informant-rails/model'
9
- autoload :Request, 'informant-rails/request'
10
- autoload :ParameterFilter, 'informant-rails/parameter_filter'
6
+ autoload :Config, 'informant-rails/config'
7
+ autoload :ConnectionTester, 'informant-rails/connection_tester'
8
+ autoload :Client, 'informant-rails/client'
9
+ autoload :FieldError, 'informant-rails/field_error'
10
+ autoload :Middleware, 'informant-rails/middleware'
11
+ autoload :Model, 'informant-rails/model'
12
+ autoload :Request, 'informant-rails/request'
13
+ autoload :ParameterFilter, 'informant-rails/parameter_filter'
14
+ autoload :VERSION, 'informant-rails/version'
11
15
  end
@@ -60,7 +60,7 @@ module InformantRails
60
60
  end
61
61
 
62
62
  def self.api_url
63
- @api_url ||= ['https://api.informantapp.com/api/v1', InformantRails::Config.server_environment].join('/')
63
+ @api_url ||= 'https://api.informantapp.com/api/v1/form_submissions'
64
64
  end
65
65
  end
66
66
  end
@@ -1,10 +1,9 @@
1
1
  module InformantRails::Config
2
2
  extend self
3
3
 
4
- attr_accessor :api_token, :server_environment, :exclude_models, :filter_parameters
4
+ attr_accessor :api_token, :exclude_models, :filter_parameters
5
5
 
6
6
  self.api_token = ENV['INFORMANT_API_KEY']
7
- self.server_environment = Rails.env
8
7
  self.exclude_models = []
9
8
  self.filter_parameters = []
10
9
 
@@ -0,0 +1,54 @@
1
+ module InformantRails
2
+ class ConnectionTester
3
+ def self.run; new.run end
4
+
5
+ def run
6
+ if InformantRails::Config.api_token.blank?
7
+ Rails.logger.info missing_api_token_message
8
+ else
9
+ InformantRails::Client.record('HTTP_REFERER' => '/connectivity/test')
10
+ InformantRails::Client.record_action('Connectivity', 'test')
11
+ InformantRails::Client.request.instance_variable_set('@models', [{
12
+ name: 'TestClass',
13
+ errors: [name: 'field_name', value: 'field_value', message: 'must be unique']
14
+ }])
15
+ response = InformantRails::Client.process
16
+
17
+ if response.success?
18
+ Rails.logger.info success_message
19
+ else
20
+ Rails.logger.info bad_response_message(response.body)
21
+ end
22
+ end
23
+
24
+ Rails.logger.info assistance_message
25
+ end
26
+
27
+ private
28
+
29
+ def missing_api_token_message
30
+ %<
31
+ Your API token could not be found in the configuration. You can retrieve it from your Informantapp.com dashboard.
32
+
33
+ Then add it to your server's environment as `INFORMANT_API_KEY`
34
+
35
+ OR
36
+
37
+ Set it manually with an initializer (config/informant.rb)
38
+ InformantRails::Config.api_token = 'your token'
39
+ >
40
+ end
41
+
42
+ def bad_response_message(server_message)
43
+ "Seems like we have a problem. \"#{server_message}\" in this case."
44
+ end
45
+
46
+ def success_message
47
+ "Everything looks good. You should see a test request on your dashboard."
48
+ end
49
+
50
+ def assistance_message
51
+ "If you need assistance or have any questions, send an email to informantapp@gmail.com or tweet @informantapp and we'll help you out!"
52
+ end
53
+ end
54
+ end
@@ -17,7 +17,8 @@ module InformantRails
17
17
  models: models.map(&:as_json),
18
18
  request_url: request_url,
19
19
  filename: filename,
20
- action: action
20
+ action: action,
21
+ client: "informant-rails-#{InformantRails::VERSION}"
21
22
  }
22
23
  end
23
24
 
@@ -1,3 +1,3 @@
1
1
  module InformantRails
2
- VERSION = '0.3.0'
2
+ VERSION = '0.4.0'
3
3
  end
@@ -0,0 +1,8 @@
1
+ namespace :informant do
2
+
3
+ desc "Sends a sample request from your server to Informant"
4
+ task :test_connection => :environment do
5
+ InformantRails::ConnectionTester.run
6
+ end
7
+
8
+ end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: informant-rails
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Paul Elliott
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-06-12 00:00:00.000000000 Z
12
+ date: 2014-07-25 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rails
@@ -17,14 +17,14 @@ dependencies:
17
17
  requirements:
18
18
  - - ">="
19
19
  - !ruby/object:Gem::Version
20
- version: '0'
20
+ version: 3.0.0
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
- version: '0'
27
+ version: 3.0.0
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: typhoeus
30
30
  requirement: !ruby/object:Gem::Requirement
@@ -52,6 +52,7 @@ files:
52
52
  - lib/informant-rails.rb
53
53
  - lib/informant-rails/client.rb
54
54
  - lib/informant-rails/config.rb
55
+ - lib/informant-rails/connection_tester.rb
55
56
  - lib/informant-rails/field_error.rb
56
57
  - lib/informant-rails/middleware.rb
57
58
  - lib/informant-rails/model.rb
@@ -59,6 +60,7 @@ files:
59
60
  - lib/informant-rails/railtie.rb
60
61
  - lib/informant-rails/request.rb
61
62
  - lib/informant-rails/version.rb
63
+ - lib/tasks/test_connection.rake
62
64
  homepage: https://www.informantapp.com
63
65
  licenses:
64
66
  - GPL