lib/ecoportal/api/graphql/model/organization.rb in ecoportal-api-graphql-0.1.6 vs lib/ecoportal/api/graphql/model/organization.rb in ecoportal-api-graphql-0.1.7

- old
+ new

@@ -1,44 +1,67 @@ module Ecoportal module API class GraphQL module Model class Organization < Ecoportal::API::GraphQL::Base::Organization + DEFAULT_PATH = ["currentOrganization"] + class << self - #userGroup, userGroups, - #tagTree, tagTrees, + def path(*add) + DEFAULT_PATH.dup.push(*add) + end + + #userGroup, userGroups + + # @return [Collection::TagTree, Query::TagTrees] + def tagTrees(**kargs, &block) + if kargs.empty? && !block_given? + tagTreesQuery + else + tagTreesQuery.query(**kargs, &block) + end + end + + #tagTree + #register, registers #personMembers, attachablePersonMembers #contractorEntity, # @return [Connection::ContractorEntity, Query::ContractorEntities] def contractorEntities(**kargs, &block) - if kargs.empty? + if kargs.empty? && !block_given? contractorEntitiesQuery else contractorEntitiesQuery.query(**kargs, &block) end end - def contractorEntitiesQuery - Ecoportal::API::GraphQL::Query::ContractorEntities.new(client) - end - # @return [Connection::Action, Query::Actions] def actions(**kargs, &block) - if kargs.empty? + if kargs.empty? && !block_given? actionsQuery else actionsQuery.query(**kargs, &block) end end - def actionsQuery - Ecoportal::API::GraphQL::Query::Actions.new(client) + #action, actionsByPage, actionsCounter + #actionCategories + + private + + def tagTreesQuery + Ecoportal::API::GraphQL::Query::TagTrees.new(client, base_path: path) end - #actionCategories - #action, actionsByPage, actionsCounter + def contractorEntitiesQuery + Ecoportal::API::GraphQL::Query::ContractorEntities.new(client, base_path: path) + end + + def actionsQuery + Ecoportal::API::GraphQL::Query::Actions.new(client, base_path: path) + end end end end end end