| Module | Rufus::Google::CollectionMixin |
| In: |
lib/rufus/google.rb
|
| href | [R] | |
| name | [R] |
# File lib/rufus/google.rb, line 120
120: def initialize (auth_token, entry)
121:
122: @token = auth_token
123: @name = entry.title.to_s
124: @href = entry.links.find { |l| l.rel == 'alternate' }.href
125: end
Removes an object from the collection
# File lib/rufus/google.rb, line 145
145: def delete! (entry)
146:
147: uri = entry.entry.edit_url
148:
149: #r = collection.delete!(nil, uri)
150: r = collection.http.delete(uri, nil, { 'If-Match' => entry.etag })
151:
152: raise "failed to delete entry (#{r.code}): #{r.body}" \
153: unless r.code.to_i == 200
154:
155: r
156: end
Posts (creates) an object
Returns the URI of the created resource.
# File lib/rufus/google.rb, line 132
132: def post! (o)
133:
134: r = collection.post!(o.entry)
135:
136: raise "posting object of class #{o.class} failed : #{r.body}" \
137: unless r.code.to_i == 201
138:
139: r['Location']
140: end