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



102
103
104
# File 'lib/eventbrite_sdk/resource/operations/endpoint.rb', line 102

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

#path(postfixed_path = '') ⇒ Object



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/eventbrite_sdk/resource/operations/endpoint.rb', line 85

def path(postfixed_path = '')
  resource_path = self.class.path(new?).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