class ApiClient::Resource::Scope
Public Instance Methods
append_format(path)
click to toggle source
# File lib/api_client/resource/scope.rb, line 14 def append_format(path) format ? [path, format].join('.') : path end
create(params = {})
click to toggle source
# File lib/api_client/resource/scope.rb, line 35 def create(params = {}) path = append_format(@path) hash = if @scopeable.namespace { @scopeable.namespace => params } else params end response = post(path, hash) scoped(self) do raw? ? response : @scopeable.build(response) end end
destroy(id)
click to toggle source
# File lib/api_client/resource/scope.rb, line 62 def destroy(id) path = [@path, id].join('/') path = append_format(path) delete(path) true end
find(id)
click to toggle source
# File lib/api_client/resource/scope.rb, line 18 def find(id) path = [@path, id].join('/') path = append_format(path) response = get(path) scoped(self) do raw? ? response : @scopeable.build(response) end end
find_all(params = {})
click to toggle source
# File lib/api_client/resource/scope.rb, line 27 def find_all(params = {}) path = append_format(@path) response = get(path, params) scoped(self) do raw? ? response : @scopeable.build(response) end end
format()
click to toggle source
# File lib/api_client/resource/scope.rb, line 10 def format @scopeable.format end
update(id, params = {})
click to toggle source
# File lib/api_client/resource/scope.rb, line 48 def update(id, params = {}) path = [@path, id].join('/') path = append_format(path) hash = if @scopeable.namespace { @scopeable.namespace => params } else params end response = put(path, hash) scoped(self) do raw? ? response : @scopeable.build(response) end end