Skip to content

Commit

Permalink
Update google apis installation instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
PivtoranisV committed Sep 20, 2024
1 parent 3dc78a1 commit f231792
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions ruby/files_and_serialization/project_event_manager.md
Original file line number Diff line number Diff line change
Expand Up @@ -618,15 +618,18 @@ Let's look for a solution before we attempt to build a solution.

#### Installing the Google API Client

Ruby comes packaged with the `gem` command. This tool allows you to download libraries by knowing the name of the library you want to install.
In this section, we’ll use [Bundler](https://bundler.io) to manage and install our gem dependencies. Bundler ensures that the correct versions of gems are installed and works seamlessly with different Ruby versions and project requirements.

```bash
$ gem install google-api-client
Successfully installed google-api-client-0.15.0
1 gem installed
$ bundle init # Initializes a Gemfile if one doesn't exist

Check failure on line 624 in ruby/files_and_serialization/project_event_manager.md

View workflow job for this annotation

GitHub Actions / Lint project files

Dollar signs used before commands without showing output

ruby/files_and_serialization/project_event_manager.md:624:1 MD014/commands-show-output Dollar signs used before commands without showing output [Context: "$ bundle init # Initializes a..."] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md014.md
$ bundle add google-apis-civicinfo_v2 # Adds the gem to the Gemfile and installs it

Check failure on line 625 in ruby/files_and_serialization/project_event_manager.md

View workflow job for this annotation

GitHub Actions / Lint project files

Dollar signs used before commands without showing output

ruby/files_and_serialization/project_event_manager.md:625:1 MD014/commands-show-output Dollar signs used before commands without showing output [Context: "$ bundle add google-apis-civic..."] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md014.md
```

If you receive a signet error when installing the Google API gem, it is due to modern Ruby updates requiring an updated version of signet that is not compatible with the API. To fix, please [downgrade your version of signet](https://github.com/googleapis/google-api-ruby-client/issues/833) before installing the gem.
Once you’ve set up your gems with Bundler, you should use the following command to run your project:

```bash
$ bundle exec ruby lib/event_manager.rb

Check failure on line 631 in ruby/files_and_serialization/project_event_manager.md

View workflow job for this annotation

GitHub Actions / Lint project files

Dollar signs used before commands without showing output

ruby/files_and_serialization/project_event_manager.md:631:1 MD014/commands-show-output Dollar signs used before commands without showing output [Context: "$ bundle exec ruby lib/event_m..."] https://github.com/DavidAnson/markdownlint/blob/v0.32.1/doc/md014.md
```

#### Showing all legislators in a zip code

Expand Down Expand Up @@ -694,7 +697,7 @@ end
Running our application, we find an error.

```bash
$ ruby lib/event_manager.rb
$ ruby bundle exec ruby lib/event_manager.rb
/ruby-2.4.0/gems/google-api-client-0.15.0/lib/google/apis/core/http_command.rb:218:in 'check_status': parseError: Failed to parse address (Google::Apis::ClientError)
```

Expand Down Expand Up @@ -784,7 +787,7 @@ legislator_names = legislators.map(&:name)
If we were to replace `legislators` with `legislator_names` in our output, we would be presented with a *slightly* better output.

```bash
$ ruby lib/event_manager.rb
$ ruby bundle exec ruby lib/event_manager.rb
EventManager initialized.
Allison 20010 ["Eleanor Norton"]
SArah 20009 ["Eleanor Norton"]
Expand Down Expand Up @@ -826,7 +829,7 @@ end
Running our application this time should give us a much more pleasant looking output:

```bash
$ ruby lib/event_manager.rb
$ ruby bundle exec ruby lib/event_manager.rb
EventManager initialized.
Allison 20010 Eleanor Norton
SArah 20009 Eleanor Norton
Expand Down

0 comments on commit f231792

Please sign in to comment.