Skip to content

Conversation

@sle-c
Copy link
Contributor

@sle-c sle-c commented Feb 7, 2024

Description

Follow up on #1205

How has this been tested?

Setup a new ruby project with the following script

# main.rb
require 'shopify_api'

access_token = '<truncated>'
shop = '<truncated>'

test_session = ShopifyAPI::Auth::Session.new(
  shop:,
  access_token:
)

ShopifyAPI::Context.setup(
  api_key: '<truncated>',
  api_secret_key: '<truncated>',
  api_version: '2024-01',
  scope: 'read_products, price_rules',
  is_private: false,
  is_embedded: true
)

ShopifyAPI::Context.activate_session(test_session)

response = ShopifyAPI::DiscountCode.get_batch_results(
  session: test_session,
  price_rule_id: 1445781537073,
  batch_id: 416335102257,
)
p response

Run it with

bundle exec ruby main.rb

This script prints the following result

[
  <ShopifyAPI::DiscountCode::BatchResult code="SUMMERSALE10OFF1" errors={"code"=>["must be unique. Please try a different code."]} id=nil>, 
  <ShopifyAPI::DiscountCode::BatchResult code="SUMMER2" errors={"code"=>["must be unique. Please try a different code."]} id=nil>, 
  <ShopifyAPI::DiscountCode::BatchResult code="SUMMER3" errors={"code"=>["must be unique. Please try a different code."]} id=nil>
]

Checklist:

  • My commit message follow the pattern described in here
  • I have performed a self-review of my own code.
  • I have added tests that prove my fix is effective or that my feature works.
  • I have updated the project documentation.
  • I have added a changelog line.

@sle-c sle-c changed the title Sle c/discount code types Fixes DiscountCode errors type, adds new BatchResult type Feb 7, 2024
sle-c added 2 commits February 7, 2024 16:14
- `get_batch_results` returns BatchResult objects instead of
  `DiscountCode`
@sle-c sle-c force-pushed the sle-c/discount-code-types branch from 4569dc0 to d307315 Compare February 7, 2024 21:15
@sle-c
Copy link
Contributor Author

sle-c commented Feb 14, 2024

closed because we decided that this issue is not worth fixing given that the documentation and generated will be diverged by this solution

@sle-c sle-c closed this Feb 14, 2024
@sle-c sle-c deleted the sle-c/discount-code-types branch February 14, 2024 16:12
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.

1 participant