Sha256: 4dfad8e4bc00fb5a414b4b83d7e87435f04a6cf5e35bc6a3238d6d6df4491a13

Contents?: true

Size: 943 Bytes

Versions: 2

Compression:

Stored size: 943 Bytes

Contents

require 'time'

module Xolphin
  module Api
    module Responses
      class Certificate < Base
        def initialize(data)
          super(data)
        end

        def id
          @data["id"]
        end

        def domain_name
          @data["domainName"]
        end

        def subject_alternative_names
          @data["subjectAlternativeNames"]
        end

        def date_issued
          Time.parse(@data["dateIssued"])
        end

        def date_expired
          Time.parse(@data["dateExpired"])
        end

        def company
          @data["company"]
        end

        def customer_id
          @data["customerId"]
        end

        def expired?
          date_expired <= Time.now
        end

        def product
          @product ||= begin
            if _embedded && _embedded["product"]
              Product.new(_embedded["product"])
            end
          end
        end
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
xolphin-api-1.9.0 lib/xolphin/api/responses/certificate.rb
xolphin-api-1.8.0 lib/xolphin/api/responses/certificate.rb