Sha256: 1cc511bf99beb68aea88d1a048d33e1ad7d88c30df1ed0ad1eb16d665fe214f8

Contents?: true

Size: 703 Bytes

Versions: 4

Compression:

Stored size: 703 Bytes

Contents

require 'bearcat/api_array'

module Catalogcat
  class ApiArray < Bearcat::ApiArray
    def self.array_key(response)
      key = nil
      if response.env[:method] == :get
        path = response.env[:url].path
        key = 'courses' if path =~ %r{.*/courses}
        key = 'course' if path =~ %r{.*/courses/[0-9]*}
        key = 'catalogs' if path =~ %r{.*/catalogs}
        key = 'enrollments' if path =~ %r{.*/enrollments}
        key = 'order' if path =~ %r{.*/order/[0-9]*}
        key = 'completed_certificates' if path =~ %r{.*/completed_certificates}
        key = 'user_registrations' if path =~ %r{.*/user_registrations}
      end
      key.present? ? key : super(response)
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
bearcat-1.5.5 lib/catalogcat/api_array.rb
bearcat-1.5.4 lib/catalogcat/api_array.rb
bearcat-1.5.3 lib/catalogcat/api_array.rb
bearcat-1.5.2 lib/catalogcat/api_array.rb