Class: SOULs::SOULsQuery
- Inherits:
-
GraphQL::Schema::Resolver
- Object
- GraphQL::Schema::Resolver
- SOULs::SOULsQuery
- Defined in:
- lib/souls/app/graphql/souls_query.rb
Class Attribute Summary collapse
-
.schedule ⇒ Object
Returns the value of attribute schedule.
Class Method Summary collapse
Instance Method Summary collapse
- #souls_check_user_permissions(user, obj, method) ⇒ Object
- #souls_post(url:, payload: {}, content_type: "application/json") ⇒ Object
Class Attribute Details
.schedule ⇒ Object
Returns the value of attribute schedule.
5 6 7 |
# File 'lib/souls/app/graphql/souls_query.rb', line 5 def schedule @schedule end |
Class Method Details
.all_schedules ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 |
# File 'lib/souls/app/graphql/souls_query.rb', line 26 def self.all_schedules schedule_list = {} Queries.constants.select { |c| Queries.const_get(c).is_a?(Class) } .each do |clname| next if clname == :BaseQuery job_schedule = Queries.const_get(clname).schedule schedule_list[clname] = job_schedule unless job_schedule.nil? end schedule_list end |
.cron(schedule) ⇒ Object
22 23 24 |
# File 'lib/souls/app/graphql/souls_query.rb', line 22 def self.cron(schedule) self.schedule = schedule end |
Instance Method Details
#souls_check_user_permissions(user, obj, method) ⇒ Object
13 14 15 16 17 18 19 20 |
# File 'lib/souls/app/graphql/souls_query.rb', line 13 def (user, obj, method) raise(StandardError, "Invalid or Missing Token") unless user policy_class = obj.class.name + "Policy" policy_clazz = policy_class.constantize.new(user, obj) = policy_clazz.public_send(method) raise(Pundit::NotAuthorizedError, "permission error!") unless end |
#souls_post(url:, payload: {}, content_type: "application/json") ⇒ Object
8 9 10 11 |
# File 'lib/souls/app/graphql/souls_query.rb', line 8 def souls_post(url:, payload: {}, content_type: "application/json") response = Faraday.post(url, payload.to_json, "Content-Type": content_type) response.body end |