Sha256: f0f97d69d8efed3cd86b43a415eea46868e8e18ff73dc3ad5207df82a061fe10

Contents?: true

Size: 1.1 KB

Versions: 9

Compression:

Stored size: 1.1 KB

Contents

require 'hashie'

module Cashstar
  class Client
    module GiftCardMethods
      def balance_inquiry(merchant, egc_code)
        response = get("/v2/merchant/#{merchant}/egc/#{egc_code}/balance/")
        format.to_s.downcase == 'xml' ? response['egc'] : response['egc']
      end
      
      def cancel(merchant, egc_code)
        response = delete("/v2/merchant/#{merchant}/egc/#{egc_code}/")
        format.to_s.downcase == 'xml' ? response['egc'] : response['egc']
      end
    end
    
    # Defines methods related to a Cashstar Order
    class GiftCard < Hashie::Dash
      property :merchant_code, :required => true
      property :initial_balance, :required => true
      property :currency, :default => 'USD'
      property :challenge
      property :challenge_description
      property :delivery
      property :message
    end
    
    class Delivery < Hashie::Dash
      property :delivered_by, :default => 'CASHSTAR'
      property :method
      property :target
      property :scheduled
    end
    
    class Message < Hashie::Dash
      property :from
      property :to
      property :body
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
cashstar-ruby-0.2.4 lib/cashstar/client/gift_card.rb
cashstar-ruby-0.2.3 lib/cashstar/client/gift_card.rb
cashstar-ruby-0.2.2 lib/cashstar/client/gift_card.rb
cashstar-ruby-0.2.1 lib/cashstar/client/gift_card.rb
cashstar-ruby-0.2.0 lib/cashstar/client/gift_card.rb
cashstar-ruby-0.1.8 lib/cashstar/client/gift_card.rb
cashstar-ruby-0.1.7 lib/cashstar/client/gift_card.rb
cashstar-0.1.5 lib/cashstar/client/gift_card.rb
cashstar-0.1.4 lib/cashstar/client/gift_card.rb