class BusinessCentral::URLBuilder

Attributes

child_id[R]
child_path[R]
parent_id[R]
parent_path[R]
sequence[R]
url[R]

Public Class Methods

new(parent_path, parent_id, options = {}) click to toggle source

@param parent_path [String] The path for the parent object @param parent_id [String] The object ID @param options [Hash] any associated child object

# File lib/business_central/url_builder.rb, line 15
def initialize(parent_path, parent_id, options = {})
  @url = ""
  @parent_path = parent_path
  @parent_id = parent_id
  @child_path = options.fetch(:child_path, nil)
  @child_id = options.fetch(:child_id, nil)
  @sequence = options.fetch(:sequence, nil)
  build
end

Public Instance Methods

build() click to toggle source

Creates the URL string from the provided options

# File lib/business_central/url_builder.rb, line 27
def build
  @url = "/#{@parent_path}(#{@parent_id})"
  @url += "/#{@child_path}" unless @child_path.nil?
  @url += "(#{@child_id})" unless @child_id.nil?
end