Module: EventbriteSDK::Resource::Operations::Endpoint::InstanceMethods

Defined in:
lib/eventbrite_sdk/resource/operations/endpoint.rb

Instance Method Summary collapse

Instance Method Details

#full_url(request = EventbriteSDK) ⇒ Object



89
90
91
# File 'lib/eventbrite_sdk/resource/operations/endpoint.rb', line 89

def full_url(request = EventbriteSDK)
  request.url path
end

#path(postfixed_path = '') ⇒ Object



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
# File 'lib/eventbrite_sdk/resource/operations/endpoint.rb', line 72

def path(postfixed_path = '')
  resource_path = self.class.path.dup
  tokens = resource_path.scan(/:\w+/)

  full_path = tokens.reduce(resource_path) do |path_frag, token|
    method = token.delete(':')
    path_frag.gsub(token, send(method).to_s)
  end

  if postfixed_path.empty?
    full_path
  else
    full_path += '/' unless full_path.end_with?('/')
    "#{full_path}#{postfixed_path}"
  end
end