Sha256: 615ea9c989c7953864873e2461f5a68daa8282372393fc3d04e358489403e3f0

Contents?: true

Size: 796 Bytes

Versions: 1

Compression:

Stored size: 796 Bytes

Contents

module Attune
  module Model
    # Customer associated with an anonymous user
    #
    # @attr [String] customer
    class Customer
      attr_accessor :customer
      

      def initialize(attributes = {})
        return if attributes.empty?
        # Workaround since JSON.parse has accessors as strings rather than symbols
        @customer = attributes["customer"] || attributes[:"customer"]
        

      end

      def to_body
        Hash[ATTRIBUTE_MAP.map do |internal, external|
          next unless value = send(internal)
          [external, value]
        end.compact]
      end

      def to_json(options = {})
        to_body.to_json
      end

      private
      # :internal => :external
      ATTRIBUTE_MAP = {
          :customer => :customer

        }
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
attune-1.0.6 lib/attune/models/customer.rb