Sha256: 9e030f65babac7193efeb2416bb397ee9da4b1ad20595db3f665ccf92a269fdc
Contents?: true
Size: 668 Bytes
Versions: 1
Compression:
Stored size: 668 Bytes
Contents
module NCMB class Role < NCMB::Object include NCMB def initialize(name) if name.is_a? Hash @fields = name else @fields = { roleName: name } end 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 to_json 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.1.0 | lib/ncmb/role.rb |