Module: Parse

Defined in:
lib/parsecom.rb,
lib/parse/acl.rb,
lib/parse/date.rb,
lib/parse/file.rb,
lib/parse/role.rb,
lib/parse/user.rb,
lib/parse/util.rb,
lib/parse/batch.rb,
lib/parse/event.rb,
lib/parse/query.rb,
lib/parse/client.rb,
lib/parse/object.rb,
lib/parse/op/add.rb,
lib/parse/pointer.rb,
lib/parse/version.rb,
lib/parse/relation.rb,
lib/parse/geo_point.rb,
lib/parse/op/delete.rb,
lib/parse/op/remove.rb,
lib/parse/cloud_code.rb,
lib/parse/event/error.rb,
lib/parse/http_client.rb,
lib/parse/installation.rb,
lib/parse/op/increment.rb,
lib/parse/op/add_unique.rb,
lib/parse/op/add_relation.rb,
lib/parse/event/app_opened.rb,
lib/parse/batch_http_client.rb,
lib/parse/op/remove_relation.rb

Defined Under Namespace

Modules: Op, Util Classes: ACL, Batch, BatchHttpClient, Client, Event, GeoPoint, HttpClient, Installation, Object, ParseDate, ParseFile, Pointer, Query, Relation, Role, User

Constant Summary collapse

RESERVED_EVENT_CLASS =
{
  'AppOpened' => 'Parse::Event::AppOpened',
  'Error' => 'Parse::Event::Error'
}
RESERVED_PARSE_CLASS =
{
  '_User' => 'Parse::User',
  '_Role' => 'Parse::Role',
  '_Installation' => 'Parse::Installation'
}
VERSION =
"0.6.1"
@@application_id =
ENV['PARSE_APPLICATION_ID']
@@api_key =
ENV['PARSE_API_KEY']
@@master_key =
ENV['PARSE_MASTER_KEY']
@@auto_snake_case =
false

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.api_keyObject



57
58
59
# File 'lib/parsecom.rb', line 57

def api_key
  @@api_key
end

.api_key=(api_key) ⇒ Object



61
62
63
# File 'lib/parsecom.rb', line 61

def api_key= api_key
  @@api_key = api_key
end

.application_idObject



49
50
51
# File 'lib/parsecom.rb', line 49

def application_id
  @@application_id
end

.application_id=(application_id) ⇒ Object



53
54
55
# File 'lib/parsecom.rb', line 53

def application_id= application_id
  @@application_id = application_id
end

.auto_snake_caseObject



83
84
85
# File 'lib/parsecom.rb', line 83

def auto_snake_case
  @@auto_snake_case
end

.auto_snake_case=(auto_snake_case) ⇒ Object



87
88
89
# File 'lib/parsecom.rb', line 87

def auto_snake_case= auto_snake_case
  @@auto_snake_case = auto_snake_case
end

.batch(&block) ⇒ Object



44
45
46
# File 'lib/parse/batch.rb', line 44

def self.batch &block
  Batch.new(&block).run
end

.batch!(&block) ⇒ Object



48
49
50
# File 'lib/parse/batch.rb', line 48

def self.batch! &block
  Batch.new(&block).run!
end

.credentials(hash) ⇒ Object



73
74
75
76
77
# File 'lib/parsecom.rb', line 73

def credentials hash
  @@application_id = hash[:application_id]
  @@api_key = hash[:api_key]
  @@master_key = hash[:master_key]
end

.credentials=(hash) ⇒ Object



79
80
81
# File 'lib/parsecom.rb', line 79

def credentials= hash
  credentials hash
end

.date(*args) ⇒ Object



52
53
54
# File 'lib/parse/date.rb', line 52

def date *args
  ParseDate.parse *args
end

.dry_run!Object



95
96
97
# File 'lib/parsecom.rb', line 95

def dry_run!
  Parse::Client.default.dry_run!
end

.master_keyObject



65
66
67
# File 'lib/parsecom.rb', line 65

def master_key
  @@master_key
end

.master_key=(master_key) ⇒ Object



69
70
71
# File 'lib/parsecom.rb', line 69

def master_key= master_key
  @@master_key = master_key
end

.Object(parse_class_name, mod = ::Object) ⇒ Object

create or get ParseObject class in the given module

Parameters:

parse_class_name

Parse class name

mod

module where ParseObject is populated

Returns:

subclass of ParseObject for the given parse_class_name



333
334
335
336
337
338
339
340
341
# File 'lib/parse/object.rb', line 333

def self.Object parse_class_name, mod=::Object
  if RESERVED_PARSE_CLASS.has_key? parse_class_name.to_s
    eval RESERVED_PARSE_CLASS[parse_class_name.to_s]
  else
    Parse::Object.create parse_class_name, mod \
      unless mod.const_defined? parse_class_name
    mod.const_get parse_class_name
  end
end

.use_master_key!Object



91
92
93
# File 'lib/parsecom.rb', line 91

def use_master_key!
  Parse::Client.default.use_master_key!
end

Instance Method Details

#Query(parse_class_name = nil) ⇒ Object



365
366
367
# File 'lib/parse/query.rb', line 365

def Query parse_class_name=nil
  Query.new parse_class_name
end