Class: EasyqaApi::Item
Direct Known Subclasses
Issue, IssueAttachment, Organization, Project, Role, Status, TestCase, TestModule, TestObject, TestPlan, TestRun, TestRunResult, User
Constant Summary
collapse
- CONNECTION =
{
json: {
instance: -> { json_connection },
content_type: 'application/json'
},
multipart: {
instance: -> { multipart_connection },
content_type: 'multipart/form-data'
}
}.freeze
- @@default_user =
nil
ClassMethodsSettable::METHODS
Class Method Summary
collapse
Instance Method Summary
collapse
install_class_methods!
Constructor Details
#initialize(*_args) ⇒ Item
Returns a new instance of Item.
51
52
|
# File 'lib/easyqa_api/item.rb', line 51
def initialize(*_args)
end
|
Class Method Details
.json_connection ⇒ Object
19
20
21
22
23
24
25
|
# File 'lib/easyqa_api/item.rb', line 19
def json_connection
@json_connection ||= Faraday.new(url: EasyqaApi.configuration.url) do |faraday|
faraday.request :json
faraday.response :json
faraday.adapter Faraday.default_adapter
end
end
|
.multipart_connection ⇒ Object
27
28
29
30
31
32
33
|
# File 'lib/easyqa_api/item.rb', line 27
def multipart_connection
@multipart_connection ||= Faraday.new(url: EasyqaApi.configuration.url) do |faraday|
faraday.request :multipart
faraday.response :json
faraday.adapter Faraday.default_adapter
end
end
|
.operation_status(response) ⇒ Object
.send_request(url, html_method, type = :json, &block) ⇒ Object
35
36
37
38
39
40
41
42
43
|
# File 'lib/easyqa_api/item.rb', line 35
def send_request(url, html_method, type = :json, &block)
response = EasyqaApi::Item::CONNECTION[type][:instance].call.send(html_method) do |req|
req.url EasyqaApi.configuration.api_path + url
req.['Content-Type'] = EasyqaApi::Item::CONNECTION[type][:content_type]
yield(req) if block
end
operation_status(response)
end
|
Instance Method Details
#install_variables!(arguments) ⇒ Object
56
57
58
59
60
61
62
|
# File 'lib/easyqa_api/item.rb', line 56
def install_variables!(arguments)
allowed_methods = retrive_allowed_methods
arguments.each do |key, value|
method_name = "#{key}=".to_sym
send(method_name, value) if allowed_methods.include? method_name
end
end
|