Class: GlobalRequestModel

Inherits:
Object
  • Object
show all
Defined in:
lib/wingify/packages/network_layer/models/global_request_model.rb

Overview

Copyright 2024-2026 Wingify Software Pvt. Ltd.

Licensed under the Apache License, Version 2.0 (the “License”); you may not use this file except in compliance with the License. You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an “AS IS” BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url, query, body, headers) ⇒ GlobalRequestModel

Constructs an instance of the GlobalRequestModel.

Parameters:

  • url (String)

    The base URL of the HTTP request.

  • query (Hash)

    Query parameters as a record of key-value pairs.

  • body (Hash)

    Body of the request as a record of key-value pairs.

  • headers (Hash)

    HTTP headers as a record of key-value pairs.



23
24
25
26
27
28
29
30
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 23

def initialize(url, query, body, headers)
  @url = url
  @query = query
  @body = body
  @headers = headers
  @timeout = 3000 # Default timeout in milliseconds
  @is_development_mode = nil # Flag to indicate if the request is in development mode
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



16
17
18
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 16

def body
  @body
end

#headersObject

Returns the value of attribute headers.



16
17
18
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 16

def headers
  @headers
end

#is_development_modeObject

Returns the value of attribute is_development_mode.



16
17
18
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 16

def is_development_mode
  @is_development_mode
end

#queryObject

Returns the value of attribute query.



16
17
18
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 16

def query
  @query
end

#timeoutObject

Returns the value of attribute timeout.



16
17
18
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 16

def timeout
  @timeout
end

#urlObject

Returns the value of attribute url.



16
17
18
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 16

def url
  @url
end

Instance Method Details

#get_base_urlObject

Retrieves the base URL of the HTTP request.



64
65
66
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 64

def get_base_url
  @url
end

#get_bodyObject

Retrieves the body of the HTTP request.



52
53
54
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 52

def get_body
  @body
end

#get_development_modeObject

Retrieves the development mode status of the request.



100
101
102
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 100

def get_development_mode
  @is_development_mode
end

#get_headersObject

Retrieves the HTTP headers of the request.



88
89
90
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 88

def get_headers
  @headers
end

#get_queryObject

Retrieves the query parameters of the HTTP request.



40
41
42
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 40

def get_query
  @query
end

#get_timeoutObject

Retrieves the timeout duration of the HTTP request.



76
77
78
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 76

def get_timeout
  @timeout
end

#set_base_url(url) ⇒ Object

Sets the base URL of the HTTP request.

Parameters:

  • url (String)

    The base URL as a string.



58
59
60
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 58

def set_base_url(url)
  @url = url
end

#set_body(body) ⇒ Object

Sets the body of the HTTP request.

Parameters:

  • body (Hash)

    A record of key-value pairs representing the body content.



46
47
48
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 46

def set_body(body)
  @body = body
end

#set_development_mode(is_development_mode) ⇒ Object

Sets the development mode status for the request.

Parameters:

  • is_development_mode (Boolean)

    Boolean flag indicating if the request is in development mode.



94
95
96
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 94

def set_development_mode(is_development_mode)
  @is_development_mode = is_development_mode
end

#set_headers(headers) ⇒ Object

Sets the HTTP headers for the request.

Parameters:

  • headers (Hash)

    A record of key-value pairs representing the HTTP headers.



82
83
84
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 82

def set_headers(headers)
  @headers = headers
end

#set_query(query) ⇒ Object

Sets the query parameters for the HTTP request.

Parameters:

  • query (Hash)

    A record of key-value pairs representing the query parameters.



34
35
36
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 34

def set_query(query)
  @query = query
end

#set_timeout(timeout) ⇒ Object

Sets the timeout duration for the HTTP request.

Parameters:

  • timeout (Integer)

    Timeout in milliseconds.



70
71
72
# File 'lib/wingify/packages/network_layer/models/global_request_model.rb', line 70

def set_timeout(timeout)
  @timeout = timeout
end