parse-ruby-client 0.1.3 → 0.1.4

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,161 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.parse.com/1/classes/TestSave
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"age":20}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ User-Agent:
15
+ - Parse for Ruby, 0.0
16
+ X-Parse-Master-Key:
17
+ - ''
18
+ X-Parse-Rest-Api-Key:
19
+ - D3Y8jNCQk6kpkKhpRGnWLYTrFGQ7j8dtDVnWZRnZ
20
+ X-Parse-Application-Id:
21
+ - PPVk6L5M9R1R8GVk8Ye9jT8f5SQNBIeoJUDJLmkT
22
+ X-Parse-Session-Token:
23
+ - ''
24
+ Expect:
25
+ - ''
26
+ response:
27
+ status:
28
+ code: 201
29
+ message: !binary |-
30
+ Q3JlYXRlZA==
31
+ headers:
32
+ !binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
33
+ - !binary |-
34
+ Kg==
35
+ !binary "QWNjZXNzLUNvbnRyb2wtUmVxdWVzdC1NZXRob2Q=":
36
+ - !binary |-
37
+ Kg==
38
+ !binary "Q2FjaGUtQ29udHJvbA==":
39
+ - !binary |-
40
+ bm8tY2FjaGU=
41
+ !binary "Q29udGVudC1UeXBl":
42
+ - !binary |-
43
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
44
+ !binary "RGF0ZQ==":
45
+ - !binary |-
46
+ VHVlLCAwOSBPY3QgMjAxMiAyMTo0NToyMCBHTVQ=
47
+ !binary "TG9jYXRpb24=":
48
+ - !binary |-
49
+ aHR0cHM6Ly9hcGkucGFyc2UuY29tLzEvY2xhc3Nlcy9UZXN0U2F2ZS9LOWRB
50
+ M0FnMUlo
51
+ !binary "U2VydmVy":
52
+ - !binary |-
53
+ bmdpbngvMS4yLjI=
54
+ !binary "U2V0LUNvb2tpZQ==":
55
+ - !binary |-
56
+ X3BhcnNlX3Nlc3Npb249QkFoN0Jra2lEM05sYzNOcGIyNWZhV1FHT2daRlJp
57
+ SWxPV00xTURneE5ERXdNMlUzWW1Ka1l6aGhZalJtT0RVMVptTTNOREJpWXpZ
58
+ JTNELS00ZGEyZDM2YTZhNGYzYjM4ODFkNmQ4NTI1ZTJiMDNjMjdmNGQ3NDg2
59
+ OyBkb21haW49LnBhcnNlLmNvbTsgcGF0aD0vOyBleHBpcmVzPVN1biwgMDkt
60
+ T2N0LTIwMjIgMjE6NDU6MjAgR01UOyBzZWN1cmU7IEh0dHBPbmx5
61
+ !binary "U3RhdHVz":
62
+ - !binary |-
63
+ MjAxIENyZWF0ZWQ=
64
+ !binary "WC1SdW50aW1l":
65
+ - !binary |-
66
+ MC4xMTM2NjE=
67
+ !binary "WC1VYS1Db21wYXRpYmxl":
68
+ - !binary |-
69
+ SUU9RWRnZSxjaHJvbWU9MQ==
70
+ !binary "Q29udGVudC1MZW5ndGg=":
71
+ - !binary |-
72
+ NjQ=
73
+ !binary "Q29ubmVjdGlvbg==":
74
+ - !binary |-
75
+ a2VlcC1hbGl2ZQ==
76
+ body:
77
+ encoding: ASCII-8BIT
78
+ string: !binary |-
79
+ eyJjcmVhdGVkQXQiOiIyMDEyLTEwLTA5VDIxOjQ1OjIwLjcyNloiLCJvYmpl
80
+ Y3RJZCI6Iks5ZEEzQWcxSWgifQ==
81
+ http_version:
82
+ recorded_at: Tue, 09 Oct 2012 21:45:21 GMT
83
+ - request:
84
+ method: put
85
+ uri: https://api.parse.com/1/classes/TestSave/K9dA3Ag1Ih
86
+ body:
87
+ encoding: UTF-8
88
+ string: ! '{"age":40}'
89
+ headers:
90
+ Content-Type:
91
+ - application/json
92
+ Accept:
93
+ - application/json
94
+ User-Agent:
95
+ - Parse for Ruby, 0.0
96
+ X-Parse-Master-Key:
97
+ - ''
98
+ X-Parse-Rest-Api-Key:
99
+ - D3Y8jNCQk6kpkKhpRGnWLYTrFGQ7j8dtDVnWZRnZ
100
+ X-Parse-Application-Id:
101
+ - PPVk6L5M9R1R8GVk8Ye9jT8f5SQNBIeoJUDJLmkT
102
+ X-Parse-Session-Token:
103
+ - ''
104
+ Expect:
105
+ - ''
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: !binary |-
110
+ T0s=
111
+ headers:
112
+ !binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
113
+ - !binary |-
114
+ Kg==
115
+ !binary "QWNjZXNzLUNvbnRyb2wtUmVxdWVzdC1NZXRob2Q=":
116
+ - !binary |-
117
+ Kg==
118
+ !binary "Q2FjaGUtQ29udHJvbA==":
119
+ - !binary |-
120
+ bWF4LWFnZT0wLCBwcml2YXRlLCBtdXN0LXJldmFsaWRhdGU=
121
+ !binary "Q29udGVudC1UeXBl":
122
+ - !binary |-
123
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
124
+ !binary "RGF0ZQ==":
125
+ - !binary |-
126
+ VHVlLCAwOSBPY3QgMjAxMiAyMTo0NToyNCBHTVQ=
127
+ !binary "RXRhZw==":
128
+ - !binary |-
129
+ Ijg4YmNhYjgxNDczMjI1MmRhMDY5MTliYmUxYTcyOWRhIg==
130
+ !binary "U2VydmVy":
131
+ - !binary |-
132
+ bmdpbngvMS4yLjI=
133
+ !binary "U2V0LUNvb2tpZQ==":
134
+ - !binary |-
135
+ X3BhcnNlX3Nlc3Npb249QkFoN0Jra2lEM05sYzNOcGIyNWZhV1FHT2daRlJp
136
+ SWxPR013TWprME1XUTBZelppTjJNMk1EVTJNVFZpTVRobVlXSmhOalJpTkRr
137
+ JTNELS0yNmU3YTJjZjE5N2U4MzFiNDkzODIwM2VhMWYxMGNiMjg0NTc3MDg4
138
+ OyBkb21haW49LnBhcnNlLmNvbTsgcGF0aD0vOyBleHBpcmVzPVN1biwgMDkt
139
+ T2N0LTIwMjIgMjE6NDU6MjQgR01UOyBzZWN1cmU7IEh0dHBPbmx5
140
+ !binary "U3RhdHVz":
141
+ - !binary |-
142
+ MjAwIE9L
143
+ !binary "WC1SdW50aW1l":
144
+ - !binary |-
145
+ MC4xNTE0ODc=
146
+ !binary "WC1VYS1Db21wYXRpYmxl":
147
+ - !binary |-
148
+ SUU9RWRnZSxjaHJvbWU9MQ==
149
+ !binary "Q29udGVudC1MZW5ndGg=":
150
+ - !binary |-
151
+ NDA=
152
+ !binary "Q29ubmVjdGlvbg==":
153
+ - !binary |-
154
+ a2VlcC1hbGl2ZQ==
155
+ body:
156
+ encoding: ASCII-8BIT
157
+ string: !binary |-
158
+ eyJ1cGRhdGVkQXQiOiIyMDEyLTEwLTA5VDIxOjQ1OjI0Ljc2MFoifQ==
159
+ http_version:
160
+ recorded_at: Tue, 09 Oct 2012 21:45:25 GMT
161
+ recorded_with: VCR 2.0.1
@@ -0,0 +1,161 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.parse.com/1/classes/Post
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"title":"hello"}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ User-Agent:
15
+ - Parse for Ruby, 0.0
16
+ X-Parse-Master-Key:
17
+ - ''
18
+ X-Parse-Rest-Api-Key:
19
+ - D3Y8jNCQk6kpkKhpRGnWLYTrFGQ7j8dtDVnWZRnZ
20
+ X-Parse-Application-Id:
21
+ - PPVk6L5M9R1R8GVk8Ye9jT8f5SQNBIeoJUDJLmkT
22
+ X-Parse-Session-Token:
23
+ - ''
24
+ Expect:
25
+ - ''
26
+ response:
27
+ status:
28
+ code: 201
29
+ message: !binary |-
30
+ Q3JlYXRlZA==
31
+ headers:
32
+ !binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
33
+ - !binary |-
34
+ Kg==
35
+ !binary "QWNjZXNzLUNvbnRyb2wtUmVxdWVzdC1NZXRob2Q=":
36
+ - !binary |-
37
+ Kg==
38
+ !binary "Q2FjaGUtQ29udHJvbA==":
39
+ - !binary |-
40
+ bm8tY2FjaGU=
41
+ !binary "Q29udGVudC1UeXBl":
42
+ - !binary |-
43
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
44
+ !binary "RGF0ZQ==":
45
+ - !binary |-
46
+ VHVlLCAwOSBPY3QgMjAxMiAyMTo0NTozMiBHTVQ=
47
+ !binary "TG9jYXRpb24=":
48
+ - !binary |-
49
+ aHR0cHM6Ly9hcGkucGFyc2UuY29tLzEvY2xhc3Nlcy9Qb3N0LzNiODJoeWI2
50
+ UUY=
51
+ !binary "U2VydmVy":
52
+ - !binary |-
53
+ bmdpbngvMS4yLjI=
54
+ !binary "U2V0LUNvb2tpZQ==":
55
+ - !binary |-
56
+ X3BhcnNlX3Nlc3Npb249QkFoN0Jra2lEM05sYzNOcGIyNWZhV1FHT2daRlJp
57
+ SWxPR1ZrTVdWbFpqWmpZbU5qWVdNell6Tm1NMk5rTmpoa09UTTFZV1pqTjJZ
58
+ JTNELS05N2M1NmUwNDBmMWUyMGQ3MmZlNzA0MGRhOGViZjFlYWM1ZjYwMGNm
59
+ OyBkb21haW49LnBhcnNlLmNvbTsgcGF0aD0vOyBleHBpcmVzPVN1biwgMDkt
60
+ T2N0LTIwMjIgMjE6NDU6MzIgR01UOyBzZWN1cmU7IEh0dHBPbmx5
61
+ !binary "U3RhdHVz":
62
+ - !binary |-
63
+ MjAxIENyZWF0ZWQ=
64
+ !binary "WC1SdW50aW1l":
65
+ - !binary |-
66
+ MC4wMTg5OTc=
67
+ !binary "WC1VYS1Db21wYXRpYmxl":
68
+ - !binary |-
69
+ SUU9RWRnZSxjaHJvbWU9MQ==
70
+ !binary "Q29udGVudC1MZW5ndGg=":
71
+ - !binary |-
72
+ NjQ=
73
+ !binary "Q29ubmVjdGlvbg==":
74
+ - !binary |-
75
+ a2VlcC1hbGl2ZQ==
76
+ body:
77
+ encoding: ASCII-8BIT
78
+ string: !binary |-
79
+ eyJjcmVhdGVkQXQiOiIyMDEyLTEwLTA5VDIxOjQ1OjMyLjQ4OFoiLCJvYmpl
80
+ Y3RJZCI6IjNiODJoeWI2UUYifQ==
81
+ http_version:
82
+ recorded_at: Tue, 09 Oct 2012 21:45:32 GMT
83
+ - request:
84
+ method: put
85
+ uri: https://api.parse.com/1/classes/Post/3b82hyb6QF
86
+ body:
87
+ encoding: UTF-8
88
+ string: ! '{"title":"hello 2"}'
89
+ headers:
90
+ Content-Type:
91
+ - application/json
92
+ Accept:
93
+ - application/json
94
+ User-Agent:
95
+ - Parse for Ruby, 0.0
96
+ X-Parse-Master-Key:
97
+ - ''
98
+ X-Parse-Rest-Api-Key:
99
+ - D3Y8jNCQk6kpkKhpRGnWLYTrFGQ7j8dtDVnWZRnZ
100
+ X-Parse-Application-Id:
101
+ - PPVk6L5M9R1R8GVk8Ye9jT8f5SQNBIeoJUDJLmkT
102
+ X-Parse-Session-Token:
103
+ - ''
104
+ Expect:
105
+ - ''
106
+ response:
107
+ status:
108
+ code: 200
109
+ message: !binary |-
110
+ T0s=
111
+ headers:
112
+ !binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
113
+ - !binary |-
114
+ Kg==
115
+ !binary "QWNjZXNzLUNvbnRyb2wtUmVxdWVzdC1NZXRob2Q=":
116
+ - !binary |-
117
+ Kg==
118
+ !binary "Q2FjaGUtQ29udHJvbA==":
119
+ - !binary |-
120
+ bWF4LWFnZT0wLCBwcml2YXRlLCBtdXN0LXJldmFsaWRhdGU=
121
+ !binary "Q29udGVudC1UeXBl":
122
+ - !binary |-
123
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
124
+ !binary "RGF0ZQ==":
125
+ - !binary |-
126
+ VHVlLCAwOSBPY3QgMjAxMiAyMTo0NTozMiBHTVQ=
127
+ !binary "RXRhZw==":
128
+ - !binary |-
129
+ IjhhZTRmMTQzOGY1ZWM3M2Q1NzkyMDdjZTg5MjVmYTFjIg==
130
+ !binary "U2VydmVy":
131
+ - !binary |-
132
+ bmdpbngvMS4yLjI=
133
+ !binary "U2V0LUNvb2tpZQ==":
134
+ - !binary |-
135
+ X3BhcnNlX3Nlc3Npb249QkFoN0Jra2lEM05sYzNOcGIyNWZhV1FHT2daRlJp
136
+ SWxZVFJpTlRabFkyRXpaVGMyWWpCaFl6SmhaV1l6TnpsaE1XTTFaakl6WldZ
137
+ JTNELS1hYTJkNjdlN2FkNjZhODBlZGRmMTk5OTJjZjg4YmFiYWU1NDJiNzVm
138
+ OyBkb21haW49LnBhcnNlLmNvbTsgcGF0aD0vOyBleHBpcmVzPVN1biwgMDkt
139
+ T2N0LTIwMjIgMjE6NDU6MzIgR01UOyBzZWN1cmU7IEh0dHBPbmx5
140
+ !binary "U3RhdHVz":
141
+ - !binary |-
142
+ MjAwIE9L
143
+ !binary "WC1SdW50aW1l":
144
+ - !binary |-
145
+ MC4wMzUwODU=
146
+ !binary "WC1VYS1Db21wYXRpYmxl":
147
+ - !binary |-
148
+ SUU9RWRnZSxjaHJvbWU9MQ==
149
+ !binary "Q29udGVudC1MZW5ndGg=":
150
+ - !binary |-
151
+ NDA=
152
+ !binary "Q29ubmVjdGlvbg==":
153
+ - !binary |-
154
+ a2VlcC1hbGl2ZQ==
155
+ body:
156
+ encoding: ASCII-8BIT
157
+ string: !binary |-
158
+ eyJ1cGRhdGVkQXQiOiIyMDEyLTEwLTA5VDIxOjQ1OjMyLjU5N1oifQ==
159
+ http_version:
160
+ recorded_at: Tue, 09 Oct 2012 21:45:32 GMT
161
+ recorded_with: VCR 2.0.1
@@ -0,0 +1,83 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://api.parse.com/1/users
6
+ body:
7
+ encoding: UTF-8
8
+ string: ! '{"username":"0.71975770632902","password":"topsecret"}'
9
+ headers:
10
+ Content-Type:
11
+ - application/json
12
+ Accept:
13
+ - application/json
14
+ User-Agent:
15
+ - Parse for Ruby, 0.0
16
+ X-Parse-Master-Key:
17
+ - ''
18
+ X-Parse-Rest-Api-Key:
19
+ - D3Y8jNCQk6kpkKhpRGnWLYTrFGQ7j8dtDVnWZRnZ
20
+ X-Parse-Application-Id:
21
+ - PPVk6L5M9R1R8GVk8Ye9jT8f5SQNBIeoJUDJLmkT
22
+ X-Parse-Session-Token:
23
+ - ''
24
+ Expect:
25
+ - ''
26
+ response:
27
+ status:
28
+ code: 201
29
+ message: !binary |-
30
+ Q3JlYXRlZA==
31
+ headers:
32
+ !binary "QWNjZXNzLUNvbnRyb2wtQWxsb3ctT3JpZ2lu":
33
+ - !binary |-
34
+ Kg==
35
+ !binary "QWNjZXNzLUNvbnRyb2wtUmVxdWVzdC1NZXRob2Q=":
36
+ - !binary |-
37
+ Kg==
38
+ !binary "Q2FjaGUtQ29udHJvbA==":
39
+ - !binary |-
40
+ bm8tY2FjaGU=
41
+ !binary "Q29udGVudC1UeXBl":
42
+ - !binary |-
43
+ YXBwbGljYXRpb24vanNvbjsgY2hhcnNldD11dGYtOA==
44
+ !binary "RGF0ZQ==":
45
+ - !binary |-
46
+ VHVlLCAwOSBPY3QgMjAxMiAyMTo0NTozNCBHTVQ=
47
+ !binary "TG9jYXRpb24=":
48
+ - !binary |-
49
+ aHR0cHM6Ly9hcGkucGFyc2UuY29tLzEvdXNlcnMvTDlnWm1FVkZFSA==
50
+ !binary "U2VydmVy":
51
+ - !binary |-
52
+ bmdpbngvMS4yLjI=
53
+ !binary "U2V0LUNvb2tpZQ==":
54
+ - !binary |-
55
+ X3BhcnNlX3Nlc3Npb249QkFoN0Jra2lEM05sYzNOcGIyNWZhV1FHT2daRlJp
56
+ SWxORE5pWXpWaFpUSTRNVE00TWprd016YzBPRFk0TXpSaFpHSTRZamsxTXpr
57
+ JTNELS00MWE4YTBmMzNjZGQ3NjU5MDIyNmNhZWNiMjY0Y2FlNjFlOTM4N2Zj
58
+ OyBkb21haW49LnBhcnNlLmNvbTsgcGF0aD0vOyBleHBpcmVzPVN1biwgMDkt
59
+ T2N0LTIwMjIgMjE6NDU6MzQgR01UOyBzZWN1cmU7IEh0dHBPbmx5
60
+ !binary "U3RhdHVz":
61
+ - !binary |-
62
+ MjAxIENyZWF0ZWQ=
63
+ !binary "WC1SdW50aW1l":
64
+ - !binary |-
65
+ MC4yNDczNTA=
66
+ !binary "WC1VYS1Db21wYXRpYmxl":
67
+ - !binary |-
68
+ SUU9RWRnZSxjaHJvbWU9MQ==
69
+ !binary "Q29udGVudC1MZW5ndGg=":
70
+ - !binary |-
71
+ MTA3
72
+ !binary "Q29ubmVjdGlvbg==":
73
+ - !binary |-
74
+ a2VlcC1hbGl2ZQ==
75
+ body:
76
+ encoding: ASCII-8BIT
77
+ string: !binary |-
78
+ eyJjcmVhdGVkQXQiOiIyMDEyLTEwLTA5VDIxOjQ1OjM0LjI4N1oiLCJvYmpl
79
+ Y3RJZCI6Ikw5Z1ptRVZGRUgiLCJzZXNzaW9uVG9rZW4iOiJjejU0YmtmMm8w
80
+ eXg4dDF5cnpvMndjMHE4In0=
81
+ http_version:
82
+ recorded_at: Tue, 09 Oct 2012 21:45:34 GMT
83
+ recorded_with: VCR 2.0.1
@@ -22,4 +22,5 @@ require 'parse/datatypes'
22
22
  require 'parse/util'
23
23
  require 'parse/protocol'
24
24
  require 'parse/user'
25
- require 'parse/push'
25
+ require 'parse/push'
26
+ require 'parse/cloud'
@@ -0,0 +1,23 @@
1
+ module Parse
2
+ module Cloud
3
+
4
+ class Function
5
+ attr_accessor :function_name
6
+
7
+ def initialize(function_name)
8
+ @function_name = function_name
9
+ end
10
+
11
+ def uri
12
+ Protocol.cloud_function_uri(@function_name)
13
+ end
14
+
15
+ def call(params={})
16
+ response = Parse.client.post(self.uri, params.to_json)
17
+ result = response["result"]
18
+ result
19
+ end
20
+ end
21
+
22
+ end
23
+ end
data/lib/parse/object.rb CHANGED
@@ -101,11 +101,22 @@ module Parse
101
101
  self
102
102
  end
103
103
 
104
+ def as_json(*a)
105
+ Hash[self.map do |key, value|
106
+ [key, value.nil? ? Protocol::DELETE_OP : value]
107
+ end]
108
+ end
109
+
110
+ def to_json(*a)
111
+ as_json.to_json(*a)
112
+ end
113
+
104
114
  # Update the fields of the local Parse object with the current
105
115
  # values from the API.
106
116
  def refresh
107
117
  if @parse_object_id
108
118
  data = Parse.get @class_name, @parse_object_id
119
+ clear
109
120
  if data
110
121
  parse data
111
122
  end