Sha256: 3b3b220687c1f3eda9493975e6442917bda13d420e0389084e59f0bf039cb2f4
Contents?: true
Size: 694 Bytes
Versions: 1
Compression:
Stored size: 694 Bytes
Contents
# frozen_string_literal: true module NCMB class Role < NCMB::Object include NCMB def initialize(name) if name.is_a? Hash @fields = name else @fields = { roleName: name } end @fields[:acl] = NCMB::Acl.new end def self.find_or_create(name) d = NCMB::DataStore.new('role') d.path = NCMB::Role.new(name).base_path role = d.where('roleName', name).limit(1).get.first role ? NCMB::Role.new(role.fields) : NCMB::Role.new(name).save() end def name "role:#{@fields[:roleName]}" end def base_path path = "/#{@@client.api_version}/roles" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
ncmb-ruby-client-0.2.0 | lib/ncmb/role.rb |