Skip to content

Commit

Permalink
Add missing CRUD actions to existing endpoints
Browse files Browse the repository at this point in the history
Remove unused BillingAddresses endpoint
  • Loading branch information
Fredar committed Oct 17, 2015
1 parent f430b1b commit f2a997d
Show file tree
Hide file tree
Showing 89 changed files with 3,056 additions and 396 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## master

- Add missing CRUD actions to existing endpoints.
- Remove unused BillingAddresses endpoint.

## 0.0.29

- Add support for Bathrooms and Bedrooms endpoints.
Expand Down
2 changes: 0 additions & 2 deletions lib/bookingsync/api/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require "bookingsync/api/client/accounts"
require "bookingsync/api/client/amenities"
require "bookingsync/api/client/availabilities"
require "bookingsync/api/client/billing_addresses"
require "bookingsync/api/client/bathrooms"
require "bookingsync/api/client/bedrooms"
require "bookingsync/api/client/bookings"
Expand Down Expand Up @@ -43,7 +42,6 @@ class Client
include BookingSync::API::Client::Accounts
include BookingSync::API::Client::Amenities
include BookingSync::API::Client::Availabilities
include BookingSync::API::Client::BillingAddresses
include BookingSync::API::Client::Bathrooms
include BookingSync::API::Client::Bedrooms
include BookingSync::API::Client::Bookings
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/accounts.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,17 @@ module Accounts
def accounts(options = {}, &block)
paginate :accounts, options, &block
end

# Get a single account
#
# @param account [BookingSync::API::Resource|Integer] Account or ID
# of the account.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def account(account, options = {})
get("accounts/#{account}", options).pop
end
end
end
end
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/bathrooms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ def bathrooms(options = {}, &block)
paginate :bathrooms, options, &block
end

# Get a single bathroom
#
# @param bathroom [BookingSync::API::Resource|Integer] Bedroom or ID
# of the bathroom.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def bathroom(bathroom, options = {})
get("bathrooms/#{bathroom}", options).pop
end

# Create a new bathroom
#
# @param rental [BookingSync::API::Resource|Integer] Rental or ID of
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/bedrooms.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ def bedrooms(options = {}, &block)
paginate :bedrooms, options, &block
end

# Get a single bedroom
#
# @param bedroom [BookingSync::API::Resource|Integer] Bedroom or ID
# of the bedroom.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def bedroom(bedroom, options = {})
get("bedrooms/#{bedroom}", options).pop
end

# Create a new bedroom
#
# @param rental [BookingSync::API::Resource|Integer] Rental or ID of
Expand Down
22 changes: 0 additions & 22 deletions lib/bookingsync/api/client/billing_addresses.rb

This file was deleted.

11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/bookings_fees.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ module BookingsFees
def bookings_fees(options = {}, &block)
paginate :bookings_fees, options, &block
end

# Get a single bookings fee
#
# @param bookings_fee [BookingSync::API::Resource|Integer] BookingsFee or ID
# of the bookings fee.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def bookings_fee(bookings_fee, options = {})
get("bookings_fees/#{bookings_fee}", options).pop
end
end
end
end
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/bookings_payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ module BookingsPayments
def bookings_payments(options = {}, &block)
paginate :bookings_payments, options, &block
end

# Get a single bookings payment
#
# @param bookings_payment [BookingSync::API::Resource|Integer] BookingsPayment or ID
# of the bookings payment.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def bookings_payment(bookings_payment, options = {})
get("bookings_payments/#{bookings_payment}", options).pop
end
end
end
end
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/bookings_taxes.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ module BookingsTaxes
def bookings_taxes(options = {}, &block)
paginate :bookings_taxes, options, &block
end

# Get a single bookings tax
#
# @param bookings_tax [BookingSync::API::Resource|Integer] BookingsTax or ID
# of the bookings tax.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def bookings_tax(bookings_tax, options = {})
get("bookings_taxes/#{bookings_tax}", options).pop
end
end
end
end
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/clients.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def clients(options = {}, &block)
paginate :clients, options, &block
end

# Get a single client
#
# @param client [BookingSync::API::Resource|Integer] Client or ID
# of the client.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def client(client, options = {})
get("clients/#{client}", options).pop
end

# Create a new client
#
# @param options [Hash] Client attributes
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/destinations.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ module Destinations
def destinations(options = {}, &block)
paginate :destinations, options, &block
end

# Get a single destination
#
# @param destination [BookingSync::API::Resource|Integer] Destination or ID
# of the destination.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def destination(destination, options = {})
get("destinations/#{destination}", options).pop
end
end
end
end
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/fees.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,17 @@ module Fees
def fees(options = {}, &block)
paginate :fees, options, &block
end

# Get a single fee
#
# @param fee [BookingSync::API::Resource|Integer] Fee or ID
# of the fee.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def fee(fee, options = {})
get("fees/#{fee}", options).pop
end
end
end
end
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/inquiries.rb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ def inquiries(options = {}, &block)
paginate :inquiries, options, &block
end

# Get a single inquiry
#
# @param inquiry [BookingSync::API::Resource|Integer] Inquiry or ID
# of the inquiry.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def inquiry(inquiry, options = {})
get("inquiries/#{inquiry}", options).pop
end

# Create a new inquiry
#
# @param rental [BookingSync::API::Resource] Rental or ID of the rental
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/payments.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def payments(options = {}, &block)
paginate :payments, options, &block
end

# Get a single payment
#
# @param payment [BookingSync::API::Resource|Integer] Payment or ID
# of the payment.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def payment(payment, options = {})
get("payments/#{payment}", options).pop
end

# Create a new payment
#
# @param booking_id [Integer] ID of the booking
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/periods.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def periods(options = {}, &block)
paginate :periods, options, &block
end

# Get a single period
#
# @param period [BookingSync::API::Resource|Integer] Period or ID
# of the period.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def period(period, options = {})
get("periods/#{period}", options).pop
end

# Create a new period
#
# @param season [BookingSync::API::Resource|Integer] Season or ID of
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/photos.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ def photos(options = {}, &block)
paginate :photos, options, &block
end

# Get a single photo
#
# @param photo [BookingSync::API::Resource|Integer] Photo or ID
# of the photo.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def photo(photo, options = {})
get("photos/#{photo}", options).pop
end

# Create a photo
#
# @param rental [BookingSync::API::Resource|Integer] Rental object or ID
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/rates.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ module Rates
def rates(options = {}, &block)
paginate :rates, options, &block
end

# Get a single rate
#
# @param rate [BookingSync::API::Resource|Integer] Rate or ID
# of the rate.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def rate(rate, options = {})
get("rates/#{rate}", options).pop
end
end
end
end
44 changes: 44 additions & 0 deletions lib/bookingsync/api/client/rates_rules.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,50 @@ module RatesRules
def rates_rules(options = {}, &block)
paginate :rates_rules, options, &block
end

# Get a single rates_rule
#
# @param rates_rule [BookingSync::API::Resource|Integer] RatesRule or ID
# of the rates_rule.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def rates_rule(rates_rule, options = {})
get("rates_rules/#{rates_rule}", options).pop
end

# Create a new rates_rule
#
# @param rates_table [BookingSync::API::Resource|Integer] RatesTable or ID of
# the rates_table for which rates_rule will be created.
# @param options [Hash] RatesRule's attributes.
# @return [BookingSync::API::Resource] Newly created rates_rule.
def create_rates_rule(rates_table, options = {})
post("rates_tables/#{rates_table}/rates_rules", rates_rules: [options]).pop
end

# Edit a rates_rule
#
# @param rates_rule [BookingSync::API::Resource|Integer] RatesRule or ID of
# the rates_rule to be updated.
# @param options [Hash] RatesRule attributes to be updated.
# @return [BookingSync::API::Resource] Updated rates_rule on success,
# exception is raised otherwise.
# @example
# rates_rule = @api.rates_rules.first
# @api.edit_rates_rule(rates_rule, { percentage: 10 })
def edit_rates_rule(rates_rule, options = {})
put("rates_rules/#{rates_rule}", rates_rules: [options]).pop
end

# Delete a rates_rule
#
# @param rates_rule [BookingSync::API::Resource|Integer] RatesRule or ID
# of the rates_rule to be deleted.
# @return [NilClass] Returns nil on success.
def delete_rates_rule(rates_rule)
delete "rates_rules/#{rates_rule}"
end
end
end
end
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/rates_tables.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def rates_tables(options = {}, &block)
paginate :rates_tables, options, &block
end

# Get a single rates_table
#
# @param rates_table [BookingSync::API::Resource|Integer] RatesTable or ID
# of the rates_table.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def rates_table(rates_table, options = {})
get("rates_tables/#{rates_table}", options).pop
end

# Create a new rates_table
#
# @param options [Hash] rates_table attributes
Expand Down
11 changes: 11 additions & 0 deletions lib/bookingsync/api/client/rental_agreements.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,17 @@ def rental_agreements(options = {}, &block)
paginate :rental_agreements, options, &block
end

# Get a single rental_agreement
#
# @param rental_agreement [BookingSync::API::Resource|Integer] RentalAgreement or ID
# of the rental_agreement.
# @param options [Hash] A customizable set of query options.
# @option options [Array] fields: List of fields to be fetched.
# @return [BookingSync::API::Resource]
def rental_agreement(rental_agreement, options = {})
get("rental_agreements/#{rental_agreement}", options).pop
end

# Create a new rental agreement for a booking.
#
# @param booking [BookingSync::API::Resource|Integer] Booking or ID of
Expand Down
Loading

0 comments on commit f2a997d

Please sign in to comment.