lib/yao/resources/restfully_accessible.rb in yao-0.13.4 vs lib/yao/resources/restfully_accessible.rb in yao-0.14.0
- old
+ new
@@ -13,52 +13,67 @@
end
end
end
end
+ # @param name [String]
+ # @return
def service=(name)
@service = name
end
attr_reader :service
+ # @return [String]
def api_version
@api_version || ''
end
+ # @param v [String]
+ # @return [String]
def api_version=(v)
raise("Set api_version after service is declared") unless service
@api_version = v
api_version
end
+ # @param bool [Boolean]
+ # @return [Boolean]
def admin=(bool)
@admin = bool
end
+ # @return [Boolean]
def return_single_on_querying
@return_single_on_querying
end
+ # @param bool [Boolean]
+ # @return [Boolean]
def return_single_on_querying=(bool)
@return_single_on_querying = bool
end
+ # @return [String]
def resources_path
@resources_path || resources_name
end
+ # @param path [String]
+ # @return [String]
def resources_path=(path)
@resources_path = path.sub(%r!^\/!, "")
end
+ # @return [Faraday::Connection]
def client
if @admin
Yao.default_client.admin_pool[service]
else
Yao.default_client.pool[service]
end or raise "You do not have #{@admin ? 'admin' : 'public'} access to the #{service} service"
end
+ # @param blk [Proc]
def as_member(&blk)
if @admin
@admin = false
result = yield
@admin = true