parsecom 0.5.1 → 0.5.2

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -464,13 +464,13 @@ role.delete
464
464
  #### Uploading Files
465
465
 
466
466
  ```ruby
467
- file = Parse::File.new :name => 'hello.txt', :content => 'Hello, World!'
467
+ file = Parse::ParseFile.new :name => 'hello.txt', :content => 'Hello, World!'
468
468
  file.save
469
469
  file.url # => "http://files.parse.com/7883...223/7480...b6d-hello.txt"
470
470
  ```
471
471
 
472
472
  ```ruby
473
- file = Parse::File.new :name => 'myPicture.jpg', :content => './myPicture.jpg'
473
+ file = Parse::ParseFile.new :name => 'myPicture.jpg', :content => './myPicture.jpg'
474
474
  file.save
475
475
  file.url # => "http://files.parse.com/7883...223/81c7...bdf-myPicture.jpg"
476
476
  ```
@@ -478,7 +478,7 @@ file.url # => "http://files.parse.com/7883...223/81c7...bdf-myPicture.jpg"
478
478
  #### Associating with Objects
479
479
 
480
480
  ```ruby
481
- file = Parse::File.new :name => 'profile.png', :content => './profile.png'
481
+ file = Parse::ParseFile.new :name => 'profile.png', :content => './profile.png'
482
482
  profile = PlayerProfile.new 'name' => 'Andrew', 'picture' => file
483
483
  profile.save
484
484
  ```
@@ -9,6 +9,12 @@ module Parse
9
9
  @blocks << block if block
10
10
  end
11
11
 
12
+ def run!
13
+ Parse::Client.default.use_master_key do
14
+ run
15
+ end
16
+ end
17
+
12
18
  def run
13
19
  default_client = Parse::Client.default
14
20
  default_http_client = default_client.http_client
@@ -34,4 +40,12 @@ module Parse
34
40
  end
35
41
  end
36
42
  end
43
+
44
+ def self.batch &block
45
+ Batch.new(&block).run
46
+ end
47
+
48
+ def self.batch! &block
49
+ Batch.new(&block).run!
50
+ end
37
51
  end
@@ -24,7 +24,9 @@ module Parse
24
24
 
25
25
  def save
26
26
  raise "Files cannot be updated." if @url
27
- @content = File.read @content if @type =~ %r|^image/|
27
+ if @type =~ %r|^image/|
28
+ @content = @content.respond_to?(:read) ? @content.read : File.read(@content)
29
+ end
28
30
  @client.call_api :post, "files/#{@name}", @content, 'Content-Type' => @type, 'Accept' => nil do |resp_body|
29
31
  @name = resp_body['name']
30
32
  @url = resp_body['url']
@@ -14,6 +14,14 @@ module Parse
14
14
  class << self
15
15
  attr_accessor :parse_class_name, :parse_client, :auto_camel_case
16
16
 
17
+ def reserved_columns
18
+ %w(objectId)
19
+ end
20
+
21
+ def reserved_column? c
22
+ reserved_columns.include? c
23
+ end
24
+
17
25
  def register_parse_class parse_class
18
26
  @@parse_class_vs_class_table[parse_class.parse_class_name] = parse_class
19
27
  end
@@ -1,10 +1,11 @@
1
1
  # coding:utf-8
2
2
  module Parse
3
3
  class Pointer
4
- attr_reader :object
4
+ attr_reader :object, :parse_object_id
5
5
 
6
6
  def initialize hash, parent=nil
7
7
  @raw_hash = hash
8
+ @parse_object_id = hash['objectId']
8
9
  @parent_object = parent
9
10
 
10
11
  if @raw_hash.has_key? 'body'
@@ -1,3 +1,3 @@
1
1
  module Parse
2
- VERSION = "0.5.1"
2
+ VERSION = "0.5.2"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsecom
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.1
4
+ version: 0.5.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-10-24 00:00:00.000000000 Z
12
+ date: 2013-10-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec