Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching #693

Open
wants to merge 10 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 16 additions & 8 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
version: 2
updates:
- package-ecosystem: bundler
directory: "/"
schedule:
interval: daily
open-pull-requests-limit: 99
allow:
- dependency-type: direct
- dependency-type: indirect
- package-ecosystem: "bundler"
directory: "/"
schedule:
interval: "daily"
open-pull-requests-limit: 99
allow:
- dependency-type: "direct"
- dependency-type: "indirect"
assignees:
- "biow0lf"
- package-ecosystem: "github-actions"
directory: "/"
schedule:
interval: "daily"
assignees:
- "biow0lf"
2 changes: 1 addition & 1 deletion .github/workflows/rspec.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ jobs:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
- run: bundle exec rspec
- run: bundle exec standardrb
- run: bundle exec standardrb --format github
- run: bundle exec fasterer
2 changes: 1 addition & 1 deletion .ruby-version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.2.0
3.2.1
6 changes: 1 addition & 5 deletions .standard.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1 @@
ruby_version: 2.7.6

ignore:
- 'lib/eve_online/esi/base.rb':
- Lint/DuplicateBranch
ruby_version: 2.7.7
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,4 @@ DEPENDENCIES
webmock

BUNDLED WITH
2.4.5
2.4.6
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) 2015-2022 Igor Zubkov
Copyright (c) 2015-2023 Igor Zubkov

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
93 changes: 60 additions & 33 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This gem was extracted from [EveMonk](https://evemonk.com). Source code of EveMo
* [Usage](#usage)
* [Useful links](#useful-links)
* [Development](#development)
* [Caching](#caching)
* [Contributing](#contributing)
* [Author](#author)
* [Contributors](#contributors)
Expand All @@ -30,7 +31,7 @@ This gem was extracted from [EveMonk](https://evemonk.com). Source code of EveMo
Add this line to your application's Gemfile:

```ruby
gem 'eve_online'
gem "eve_online"
```

And then execute:
Expand Down Expand Up @@ -135,7 +136,7 @@ alliance_icon.icon_small # => "https://images.evetech.net/alliances/99005443/log
#### Get character assets

```ruby
options = { token: 'token123', character_id: 90_729_314, page: 1 }
options = { token: "token123", character_id: 90_729_314, page: 1 }

character_assets = EveOnline::ESI::CharacterAssets.new(options)

Expand Down Expand Up @@ -171,7 +172,7 @@ asset.type_id # => 1010
#### Get character asset locations

```ruby
options = { token: 'token123', character_id: 1_337_512_245, item_ids: [1_001_215_602_246] }
options = { token: "token123", character_id: 1_337_512_245, item_ids: [1_001_215_602_246] }

character_assets_locations = EveOnline::ESI::CharacterAssetsLocations.new(options)

Expand All @@ -197,7 +198,7 @@ asset_location.position.z # => -971212198300.4812
#### Get character asset names

```ruby
options = { token: 'token123', character_id: 1_337_512_245, item_ids: [1_001_215_602_246] }
options = { token: "token123", character_id: 1_337_512_245, item_ids: [1_001_215_602_246] }

character_assets_names = EveOnline::ESI::CharacterAssetsNames.new(options)

Expand All @@ -217,7 +218,7 @@ asset_name.name # => "HOLE"
#### Get corporation assets

```ruby
options = { token: 'token123', corporation_id: 98_134_807, page: 1 }
options = { token: "token123", corporation_id: 98_134_807, page: 1 }

corporation_assets = EveOnline::ESI::CorporationAssets.new(options)

Expand Down Expand Up @@ -255,7 +256,7 @@ asset.type_id # => 1010
#### Get corporation asset locations

```ruby
options = { token: 'token123', corporation_id: 98_134_807, item_ids: [1_001_215_602_246] }
options = { token: "token123", corporation_id: 98_134_807, item_ids: [1_001_215_602_246] }

corporation_assets_locations = EveOnline::ESI::CorporationAssetsLocations.new(options)

Expand Down Expand Up @@ -283,7 +284,7 @@ asset_location.position.z # => -971212198300.4812
#### Get corporation asset names

```ruby
options = { token: 'token123', corporation_id: 98_134_807, item_ids: [1_001_215_602_246] }
options = { token: "token123", corporation_id: 98_134_807, item_ids: [1_001_215_602_246] }

corporation_assets_names = EveOnline::ESI::CorporationAssetsNames.new(options)

Expand Down Expand Up @@ -318,7 +319,7 @@ asset_name.name # => "HOLE"

```ruby
# Add `from_event` if you want skip records
options = { token: 'token123', character_id: 90_729_314 }
options = { token: "token123", character_id: 90_729_314 }

character_calendar = EveOnline::ESI::CharacterCalendar.new(options)

Expand All @@ -344,7 +345,7 @@ event.title # => "Moon extraction for 66-PMM - GoldMine-5-"
#### Get an event

```ruby
options = { token: 'token123', character_id: 90_729_314, event_id: 1_635_240 }
options = { token: "token123", character_id: 90_729_314, event_id: 1_635_240 }

calendar_event = EveOnline::ESI::CharacterCalendarEvent.new(options)

Expand Down Expand Up @@ -418,7 +419,7 @@ character.title # => nil
#### Get blueprints

```ruby
options = { token: 'token123', character_id: 90729314, page: 1 }
options = { token: "token123", character_id: 90729314, page: 1 }

character_blueprints = EveOnline::ESI::CharacterBlueprints.new(options)

Expand Down Expand Up @@ -480,7 +481,7 @@ entry.start_date # => Tue, 10 May 2011 10:23:00 UTC +00:00
#### Get jump fatigue

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_fatigue = EveOnline::ESI::CharacterFatigue.new(options)

Expand All @@ -502,7 +503,7 @@ character_fatigue.last_update_date # => nil
#### Get character notifications

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_notifications = EveOnline::ESI::CharacterNotifications.new(options)

Expand Down Expand Up @@ -556,7 +557,7 @@ character_portrait.small # => "https://images.evetech.net/Character/1337512245_6
#### Get standings

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_standing = EveOnline::ESI::CharacterStandings.new(options)

Expand Down Expand Up @@ -586,7 +587,7 @@ standing.standing # => 0.3303719111639991
#### Get clones

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_clones = EveOnline::ESI::CharacterClones.new(options)

Expand Down Expand Up @@ -619,7 +620,7 @@ character_clones.last_station_change_date # => Tue, 30 Jun 2015 21:51:13 UTC +00
#### Get active implants

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_implants = EveOnline::ESI::CharacterImplants.new(options)

Expand Down Expand Up @@ -655,7 +656,7 @@ character_implants.implant_ids # => [9899, 9941, 9942, 9943, 9956]
#### Get contracts

```ruby
options = { token: 'token123', character_id: 1337512245, page: 1 }
options = { token: "token123", character_id: 1337512245, page: 1 }

contracts = EveOnline::ESI::CharacterContracts.new(options)

Expand Down Expand Up @@ -885,7 +886,7 @@ entry.start_date # => Mon, 03 Jun 2019 00:17:00 UTC +00:00
#### Get corporation blueprints

```ruby
options = { token: 'token123', corporation_id: 98260237, page: 1 }
options = { token: "token123", corporation_id: 98260237, page: 1 }

corporation_blueprints = EveOnline::ESI::CorporationBlueprints.new(options)

Expand Down Expand Up @@ -935,7 +936,7 @@ corporation_blueprints.roles # => ["Director"]
#### Get corporation members

```ruby
options = { token: 'token123', corporation_id: 98565696 }
options = { token: "token123", corporation_id: 98565696 }

corporation_members = EveOnline::ESI::CorporationMembers.new(options)

Expand Down Expand Up @@ -1175,7 +1176,7 @@ modifier.operator # => 6
#### List character industry jobs

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_jobs = EveOnline::ESI::CharacterIndustryJobs.new(options)

Expand Down Expand Up @@ -1243,7 +1244,7 @@ job.successful_runs # => nil
#### List corporation industry jobs

```ruby
options = { token: 'token123', corporation_id: 98_146_630 }
options = { token: "token123", corporation_id: 98_146_630 }

corporation_jobs = EveOnline::ESI::CorporationIndustryJobs.new(options)

Expand Down Expand Up @@ -1319,7 +1320,7 @@ corporation_jobs.roles # => ["Factory_Manager"]
#### Get a character's recent kills and losses

```ruby
options = { token: 'token123', character_id: 90_729_314 }
options = { token: "token123", character_id: 90_729_314 }

character_killmails = EveOnline::ESI::CharacterKillmailsRecent.new(options)

Expand All @@ -1343,7 +1344,7 @@ killmail.killmail_id # => 81646519
#### Get a corporation's recent kills and losses

```ruby
options = { token: 'token123', corporation_id: 98_146_630 }
options = { token: "token123", corporation_id: 98_146_630 }

corporation_killmails = EveOnline::ESI::CorporationKillmailsRecent.new(options)

Expand Down Expand Up @@ -1381,7 +1382,7 @@ killmail = EveOnline::ESI::Killmail.new(options)
#### Get character location

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_location = EveOnline::ESI::CharacterLocation.new(options)

Expand All @@ -1399,7 +1400,7 @@ character_location.structure_id # => nil
#### Get character online

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_online = EveOnline::ESI::CharacterOnline.new(options)

Expand All @@ -1419,7 +1420,7 @@ character_online.online # => false
#### Get current ship

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_ship = EveOnline::ESI::CharacterShip.new(options)

Expand All @@ -1439,7 +1440,7 @@ character_ship.ship_type_id # => 606
#### Get loyalty points

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_loyalty_points = EveOnline::ESI::CharacterLoyaltyPoints.new(options)

Expand Down Expand Up @@ -1594,7 +1595,7 @@ label.unread_count # => 227
#### List open orders from a character

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_orders = EveOnline::ESI::CharacterOrders.new(options)

Expand Down Expand Up @@ -1629,7 +1630,7 @@ order.volume_total
#### List open orders from a corporation

```ruby
options = { token: 'token123', corporation_id: 1_000_168, page: 1 }
options = { token: "token123", corporation_id: 1_000_168, page: 1 }

corporation_orders = EveOnline::ESI::CorporationOrders.new(options)

Expand Down Expand Up @@ -1873,7 +1874,7 @@ search.solar_system_ids # => [30000142]
#### Get character attributes

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_attributes = EveOnline::ESI::CharacterAttributes.new(options)

Expand Down Expand Up @@ -1901,7 +1902,7 @@ character_attributes.willpower # => 23
#### Get character's skill queue

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_skill_queue = EveOnline::ESI::CharacterSkillQueue.new(options)

Expand Down Expand Up @@ -1933,7 +1934,7 @@ skill_queue_entry.training_start_sp # => 7263
#### Get character skills

```ruby
options = { token: 'token123', character_id: 90729314 }
options = { token: "token123", character_id: 90729314 }

character_skills = EveOnline::ESI::CharacterSkills.new(options)

Expand Down Expand Up @@ -2733,7 +2734,7 @@ type_dogma_effect.is_default # => false
#### Get a character's wallet balance

```ruby
options = { token: 'token123', character_id: 90_729_314 }
options = { token: "token123", character_id: 90_729_314 }

character_wallet = EveOnline::ESI::CharacterWallet.new(options)

Expand All @@ -2747,7 +2748,7 @@ character_wallet.wallet # => 409488252.49
#### Get character wallet journal

```ruby
options = { token: 'token123', character_id: 90_729_314, page: 1 }
options = { token: "token123", character_id: 90_729_314, page: 1 }

character_wallet_journal = EveOnline::ESI::CharacterWalletJournal.new(options)

Expand Down Expand Up @@ -3086,6 +3087,32 @@ After checking out the repo, run `bin/setup` to install dependencies. Then, run

To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).

## Caching

If you want to cache API calls (and this is highly recommended by CCP), you
can use [Faraday Http Cache](https://github.com/sourcelevel/faraday-http-cache).

Add the gem to your Gemfile

```ruby
gem "faraday-http-cache"
```

Next, construct your own Faraday middleware:

```ruby
stack = Faraday::RackBuilder.new do |builder|
builder.use Faraday::HttpCache, serializer: Marshal, shared_cache: false
builder.use Octokit::Response::RaiseError
builder.adapter Faraday.default_adapter
end
EveOnline::ESI.middleware = stack
```

Once configured, the middleware will store responses in cache based on ETag
fingerprint and serve those back up for future `304` responses for the same
resource. See the [project README](https://github.com/sourcelevel/faraday-http-cache) for advanced usage.

## Contributing

Issue reports and pull requests are welcome on GitHub at <https://github.com/evemonk/eve_online>.
Expand Down