Skip to content
This repository has been archived by the owner on Sep 28, 2023. It is now read-only.

LOC-12: Support character set label specification option #8

Merged
merged 1 commit into from
Aug 20, 2019

Conversation

grayxr
Copy link

@grayxr grayxr commented Aug 19, 2019

Epic: https://stockx-services.atlassian.net/browse/LOC-12
Specific card: https://stockx-services.atlassian.net/browse/LOC-201

Proposed Changes

Adds the character set option to the shipment request XML body

See pages 130-131 of the UPS Shipping Package XML Developer Guide for more information on the possible character set values.

@grayxr grayxr requested a review from brian31988 August 19, 2019 03:40
@grayxr grayxr self-assigned this Aug 19, 2019
@@ -511,6 +511,8 @@ def build_shipment_request(origin, destination, packages, options={})
label_format = options[:label_format] ? options[:label_format].upcase : 'GIF'
label_size = options[:label_size] ? options[:label_size] : [4, 6]

character_set = options[:character_set] ? options[:character_set] : 'eng'

Choose a reason for hiding this comment

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

Not requesting the change, but a cool Ruby thing: options.fetch(:character_set, 'eng') will grab the value from the hash or return the 2nd arg as a default.

Copy link

Choose a reason for hiding this comment

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

👍

Choose a reason for hiding this comment

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

And if you don't specify a 2nd arg to #fetch, it will raise an error rather than return nil if the key cannot be found.

@grayxr grayxr merged commit 49ca148 into master Aug 20, 2019
@grayxr grayxr deleted the grayxr/LOC-12 branch August 20, 2019 15:16
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants