Module: BookingSync::API::Client::Photos
- Included in:
- BookingSync::API::Client
- Defined in:
- lib/bookingsync/api/client/photos.rb
Instance Method Summary collapse
-
#create_photo(rental, options = {}) ⇒ BookingSync::API::Resource
Create a photo.
-
#delete_photo(photo) ⇒ NilClass
Delete a photo.
-
#edit_photo(photo, options = {}) ⇒ BookingSync::API::Resource
Edit a photo.
-
#photo(photo, options = {}) ⇒ BookingSync::API::Resource
Get a single photo.
-
#photos(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
List photos.
Instance Method Details
#create_photo(rental, options = {}) ⇒ BookingSync::API::Resource
Create a photo
48 49 50 51 52 53 |
# File 'lib/bookingsync/api/client/photos.rb', line 48 def create_photo(rental, = {}) if photo_path = .delete(:photo_path) [:photo] ||= encode(photo_path) end post("rentals/#{rental}/photos", photos: []).pop end |
#delete_photo(photo) ⇒ NilClass
Delete a photo
75 76 77 |
# File 'lib/bookingsync/api/client/photos.rb', line 75 def delete_photo(photo) delete "photos/#{photo}" end |
#edit_photo(photo, options = {}) ⇒ BookingSync::API::Resource
Edit a photo
62 63 64 65 66 67 |
# File 'lib/bookingsync/api/client/photos.rb', line 62 def edit_photo(photo, = {}) if photo_path = .delete(:photo_path) [:photo] ||= encode(photo_path) end put("photos/#{photo}", photos: []).pop end |
#photo(photo, options = {}) ⇒ BookingSync::API::Resource
Get a single photo
30 31 32 |
# File 'lib/bookingsync/api/client/photos.rb', line 30 def photo(photo, = {}) get("photos/#{photo}", ).pop end |
#photos(options = {}, &block) ⇒ Array<BookingSync::API::Resource>
List photos
Returns photos for the account user is authenticated with.
19 20 21 |
# File 'lib/bookingsync/api/client/photos.rb', line 19 def photos( = {}, &block) paginate :photos, , &block end |