Skip to content

Metadata query params #34

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

Merged
merged 8 commits into from
Aug 18, 2021
Merged

Metadata query params #34

merged 8 commits into from
Aug 18, 2021

Conversation

kleinjm
Copy link
Contributor

@kleinjm kleinjm commented Aug 11, 2021

What

  • Generating the SDK after changes to the swagger.json file
  • Adds ability to query orders index with metadata
  • Set up a toggle for running specs locally

Why

  • Adds the ability to query orders via metadata.

SDK Release Checklist

  • Have you added an integration test for the changes?
  • Have you built the gem locally and made queries against it successfully?
  • Did you update the changelog?
  • Did you bump the package version?
  • For breaking changes, did you plan for the release of the new SDK versions and deploy the API to production?

@kleinjm kleinjm requested a review from pcothenet August 11, 2021 23:14
@kleinjm kleinjm removed the request for review from pcothenet August 13, 2021 16:01
@@ -13,6 +13,7 @@ jobs:
strategy:
matrix:
ruby-version: [3.0.1, 2.7.4, 2.6.8]
max-parallel: 1
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this will slow down CI but reduce the amount of "collisions" we may see due to the same tests running on the same endpoints in parallel. Considering we don't run CI on these projects very frequently, I feel the stability is worth the extra 2 minutes until we change up the test suite to not hit the real API

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This makes sense!

@@ -33,7 +27,7 @@
)

expect(flight_estimate.data.type).to eq 'flight'
expect(flight_estimate.data.mass_g).to eq 1_031_697
expect(flight_estimate.data.mass_g).to eq 1_000_622
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I confirmed this change is correct with Brendan

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As discussed, we will probably want to remove this type of tests from the SDK itself.

@@ -71,15 +65,24 @@
expect(order.registry_url).not_to be_empty
end

it 'supports create with metadata' do
it 'supports creation with and querying by metadata' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this is the most stable strategy for now. Creating an order with metadata and then querying for it in the same spec reduces the chance of the order being on a following page

@@ -43,20 +39,12 @@
end

describe 'returned fields' do
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

combining specs here for performance and stability

Comment on lines +45 to +46
if ENV.fetch('LOCAL_SDK_TEST', false)
config.access_token = ENV.fetch('LOCAL_PATCH_API_KEY')
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set these 2 env vars to run tests against your local patch instance

@kleinjm kleinjm requested a review from pcothenet August 17, 2021 19:21
Copy link
Contributor

@pcothenet pcothenet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To confirm: Ruby was handling the metadata object quite nicely out of the box?

If so, looks good to go!

Comment on lines 285 to 286
# @option opts [String] :metadata_ext_id
# @option opts [String] :metadata_disregarded
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Those two feel a little confusing here. Any chance we could rename those two examples?

@@ -27,6 +29,7 @@ def self.attribute_map
{
:'timestamp' => :'timestamp',
:'gas_used' => :'gas_used',
:'transaction_value_eth_gwei' => :'transaction_value_eth_gwei',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@kleinjm can you add this one to the changelog?

Comment on lines -2 to -6
before do
Patch.configure do |config|
config.access_token = ENV['SANDBOX_API_KEY']
end
end
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Moved to the helper

it 'returns average_price_per_tonne_cents_usd' do
expect(@project.average_price_per_tonne_cents_usd).to be_an_instance_of(Integer)
end
it 'returns the expected fields' do
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@pcothenet
Copy link
Contributor

Note: please add the new ETH parameter to the changelog!

@kleinjm
Copy link
Contributor Author

kleinjm commented Aug 17, 2021

Ruby was handling the metadata object quite nicely out of the box?

yep! Which makes sense since it's ruby to ruby

@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.9.0] - 2021-08-17
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thoughts on having this be Unreleased until we tag main ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bspellacy not sure I follow. What's the release flow you have in mind? I'm planning on releasing all the SDKs then the changes to patch (docs)

@kleinjm kleinjm merged commit ae67c8d into main Aug 18, 2021
@kleinjm kleinjm deleted the jklein/metadata_query branch August 18, 2021 17:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants