Sha256: e6ef937bdda7ae06e6bc4effb5d4b6366b2e21dc043d54cb1a66b5fbef9921f6

Contents?: true

Size: 799 Bytes

Versions: 5

Compression:

Stored size: 799 Bytes

Contents

# frozen_string_literal: true

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))

require 'rubygems'
require 'ncmb'
require 'yaml'
yaml = YAML.load_file(File.join(File.dirname(__FILE__), '..', 'setting.yml'))
NCMB.initialize(
  application_key: yaml['application_key'],
  client_key: yaml['client_key']
)

Food = NCMB::DataStore.new 'Food'

Basket = NCMB::DataStore.new('Basket')
basket = Basket.new
basket.foods = []
basket.foods << Food.new(name: 'banana', type: 'fruit')
basket.foods << Food.new(name: 'pear', type: 'fruit')

# relation = NCMB::Relation.new
# relation << Food.new(name: "banana", type: "fruit", objectId: "test1")
# relation << Food.new(name: "pear", type: "fruit", objectId: "test2")

# puts basket.fields
basket.save

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
ncmb-ruby-client-0.2.0 examples/relation.rb
ncmb-ruby-client-0.1.7 examples/relation.rb
ncmb-ruby-client-0.1.6 examples/relation.rb
ncmb-ruby-client-0.1.5 examples/relation.rb
ncmb-ruby-client-0.1.4 examples/relation.rb