<commit_before>Intercom Integration
===========

Intercom Application Rails engine and generator

Description
-----------
This gem includes a Rails Engine and generators for writing Rails applications using the Intercom API. The Engine provides a SessionsController and all the required code for authenticating with an app via OAuth.

[Getting started with Intercom Integrations](https://developers.intercom.io/docs/integration-setup-guide)

Apply to become an Intercom Developer
--------------------------------
To create an Intercom application and get your `client_id` and `client_secret` you will need to create an [Intercom account](https://app.intercom.io) first.
Once your application is created you can apply for an OAuth application in the "App Settings >> OAuth" section.
Make sure you request read admin permission to use [omniauth-intercom](http://github.com/intercom/omniauth-intercom).
Installation
------------
To get started create a new rails app :

``` sh
# Create a new rails app
$ rails new my_intercom_app
$ cd my_intercom_app
```
Then add `intercom-app` to your Gemfile and bundle install :
`gem 'intercom-app', '>= 0.2.1'`
and run :
``` sh
$ bundle install
```

Now we are ready to run any of the intercom_app generators. The following section explains the generators and what they can do.


Generators
----------

### Default Generator

The default generator will run the `install`, `app_model`, and `home_controller` generators. This is the recommended way to start your app.

```sh
$ rails generate intercom_app --app_key <your_app_key> --app_secret <your_app_secret> --oauth_modal true
```
 **oauth_modal**:
   - If true you can authenticate with Intercom using a modal
   - If false you can authenticate with Intercom directly from the current tab


*Note that you will need to run rake db:migrate after this generator*



### Adding your own Intercom app to your Integration

If you wish to add Intercom's widget for your integration (which you definitely should!), we recommend that you configure [intercom-rails]("https://github.com/intercom/intercom-rails") independently.


### Install Generator

```sh
$ rails generate intercom_app:install

# or optionally with arguments:

$ rails generate intercom_app:install --app_key <intercom_client_id> --secret <intercom_client_secret> --oauth_modal true
```

*Note that you will need to run rake db:migrate after this generator*

You can update any of these settings later on easily, the arguments are simply for convenience.<commit_msg>add explaination about authenticatedController and intercom_client instance<commit_after>Intercom Integration
===========

Intercom Application Rails engine and generator

Description
-----------
This gem includes a Rails Engine and generators for writing Rails applications using the Intercom API. The Engine provides a SessionsController and all the required code for authenticating with an app via OAuth.

[Getting started with Intercom Integrations](https://developers.intercom.io/docs/integration-setup-guide)

Apply to become an Intercom Developer
--------------------------------
To create an Intercom application and get your `client_id` and `client_secret` you will need to create an [Intercom account](https://app.intercom.io) first.
Once your application is created you can apply for an OAuth application in the "App Settings >> OAuth" section.
Make sure you request read admin permission to use [omniauth-intercom](http://github.com/intercom/omniauth-intercom).
Installation
------------
To get started create a new rails app :

``` sh
# Create a new rails app
$ rails new my_intercom_app
$ cd my_intercom_app
```
Then add `intercom-app` to your Gemfile and bundle install :
`gem 'intercom-app', '>= 0.2.1'`
and run :
``` sh
$ bundle install
```

Now we are ready to run any of the intercom_app generators. The following section explains the generators and what they can do.


Generators
----------

### Default Generator

The default generator will run the `install`, `app_model`, and `home_controller` generators. This is the recommended way to start your app.

```sh
$ rails generate intercom_app --app_key <intercom_client_id> --app_secret <intercom_client_secret> --oauth_modal true
```
 **oauth_modal**:
   - If true you can authenticate with Intercom using a modal
   - If false you can authenticate with Intercom directly from the current tab


*Note that you will need to run rake db:migrate after this generator*

At this point you've finished the setup. You can run `rails s` and complete Intercom Authentication to generate a new intercom_token.
You can make calls to Intercom APIs using `@intercom_client` in all controllers that inherits from `IntercomApp::AuthenticatedController`. This `@intercom_client` variable is instantiated with the token associated to the current session.

### Adding your own Intercom app to your Integration

If you want to add Intercom's widget for your integration (which you definitely should!), we recommend that you configure [intercom-rails]("https://github.com/intercom/intercom-rails") independently.
### Install Generator

```sh
$ rails generate intercom_app:install

# or optionally with arguments:

$ rails generate intercom_app:install --app_key <intercom_client_id> --app_secret <intercom_client_secret> --oauth_modal true
```

*Note that you will need to run rake db:migrate after this generator*

You can update any of these settings later on easily, the arguments are simply for convenience.
{'fraction_non_alphanumeric': 0.09627329192546584, 'fraction_numerical': 0.0010960906101571063, 'mean_word_length': 4.3466796875, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 17, 'https://': 6, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5334651', 'n_tokens_mistral': 1490, 'n_tokens_neox': 1400, 'n_words': 663}