Module: BookingSync::API::Client::Sources

Included in:
BookingSync::API::Client
Defined in:
lib/bookingsync/api/client/sources.rb

Instance Method Summary collapse

Instance Method Details

#create_source(options = {}) ⇒ BookingSync::API::Resource

Create a new source

Parameters:

  • options (Hash) (defaults to: {})

    source attributes

Returns:



25
26
27
# File 'lib/bookingsync/api/client/sources.rb', line 25

def create_source(options = {})
  post(:sources, sources: [options]).pop
end

#edit_source(source, options = {}) ⇒ BookingSync::API::Resource

Edit a source

ID of the source to be updated exception is raised otherwise

Examples:

source = @api.sources.first
@api.edit_source(source, { name: "Lorem" })

Parameters:

Returns:



39
40
41
# File 'lib/bookingsync/api/client/sources.rb', line 39

def edit_source(source, options = {})
  put("sources/#{source}", sources: [options]).pop
end

#sources(options = {}, &block) ⇒ Array<BookingSync::API::Resource>

List sources

Returns sources for the account user is authenticated with.

Examples:

Get the list of sources for the current account

sources = @api.sources
sources.first.name # => "HomeAway.com"

Get the list of sources only with name and account_id for smaller response

@api.sources(fields: [:name, :account_id])

Parameters:

  • options (Hash) (defaults to: {})

    A customizable set of options.

Options Hash (options):

  • fields: (Array)

    List of fields to be fetched.

Returns:

See Also:



17
18
19
# File 'lib/bookingsync/api/client/sources.rb', line 17

def sources(options = {}, &block)
  paginate :sources, options, &block
end