Skip to content

Commit

Permalink
Merge pull request #118 from pedelman/update_gift_certificate_example
Browse files Browse the repository at this point in the history
Update the GiftCertificate example
  • Loading branch information
pedelman authored Jun 21, 2016
2 parents 475e6d4 + 5e58058 commit 8a5bc0a
Showing 1 changed file with 5 additions and 4 deletions.
9 changes: 5 additions & 4 deletions examples/marketing/gift_certificates.rb
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
require 'bigcommerce'
require 'securerandom'

Bigcommerce.configure do |config|
config.auth = 'legacy'
Expand All @@ -9,22 +10,22 @@
end

# List gift certificates
@gift_certificates = Bigcommerce::Giftcertificates.all
@gift_certificates = Bigcommerce::GiftCertificates.all
puts @gift_certificates

# Get a gift certificate
puts Bigcommerce::GiftCertificates.find(@gift_certificates.first.id)

# Create a gift certificate
@gift_certificates = Bigcommerce::GiftCertificates.create(
@gift_certificate = Bigcommerce::GiftCertificates.create(
to_name: 'Test',
to_email: '[email protected]',
from_name: 'Test2',
from_email: '[email protected]',
code: SecureRandom.hex,
amount: 100
)
puts @gift_certificates
puts @gift_certificate

# Update an instance of a gift certificate
puts @gift_certificates.first.update(balance: 50)
Expand All @@ -36,4 +37,4 @@
puts Bigcommerce::GiftCertificates.destroy(@gift_certificates.first.id)

# Delete all gift certificates
puts Bigcommerce::GiftCertificates.destroy_all
# puts Bigcommerce::GiftCertificates.destroy_all

0 comments on commit 8a5bc0a

Please sign in to comment.