example.rb in leancloud-ruby-client-0.1.1 vs example.rb in leancloud-ruby-client-0.2.0
- old
+ new
@@ -1,35 +1,35 @@
# -*- encoding : utf-8 -*-
-AV.init :application_id => "your_application_id",
+LC.init :application_id => "your_application_id",
:api_key => "your_REST_API_Key"
-profile = AV::Object.new "Profile"
+profile = LC::Object.new "Profile"
profile["first_name"] = "John"
profile["last_name"] = "Doe"
profile["username"] = "jdoe"
profile["email_address"] = "jdoe@fubar.com"
-profile["birthday"] = AV::Date.new "1980-12-25"
+profile["birthday"] = LC::Date.new "1980-12-25"
profile.save
profile.increment "login_count"
# Queries
cls = "GameScore"
(1..100).each { |i|
- score = AV::Object.new cls
+ score = LC::Object.new cls
score["score"] = i
score.save
}
-AV::Query.new(cls) \
+LC::Query.new(cls) \
.greater_eq("score", 10) \
.less_eq("score", 20) \
.get
-AV::Query.new(cls) \
+LC::Query.new(cls) \
.value_in("score", [10, 20, 30, 40]) \
.get
# Pushes
-push = AV::Push.new({ "alert"=> "I'm sending this push to all my app users!" })
+push = LC::Push.new({ "alert"=> "I'm sending this push to all my app users!" })
push.save