Sha256: 91b8f3fc519fab9837be72de65ada8b0689fc77aed1145b6136aa3b47cc52107

Contents?: true

Size: 494 Bytes

Versions: 3

Compression:

Stored size: 494 Bytes

Contents

module Faalis
  module Generators
    class Relation < String
      attr_accessor :to

      def initialize(value, to_)
        super(value)
        self.to = to_
      end

      def resource_name
        to.split("/").last
      end

      def restangular
        result = "API"
        to.split("/").each do |resource|
          result = "#{result}.all(\"#{resource}\")"
        end
        result
      end

      def get_list
        "#{restangular}.getList()"
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
faalis-0.18.1 lib/faalis/generators/fields/relation.rb
faalis-0.18.0 lib/faalis/generators/fields/relation.rb
faalis-0.17.0 lib/faalis/generators/fields/relation.rb