Class: NewDemoApiClient::DealClient
- Inherits:
-
Object
- Object
- NewDemoApiClient::DealClient
- Defined in:
- lib/test_sdk/deal/client.rb
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#create(group_id:, name:, round_name:, status:, company_id:, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse
Create a new deal.
-
#delete(deal_id:, group_id:, archive: nil, request_options: nil) ⇒ Hash{String => String}
Delete a deal.
-
#get(group_id:, deal_id:, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse
Retrieve a deal by its ID.
- #initialize(request_client:) ⇒ NewDemoApiClient::DealClient constructor
-
#list(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse
Get all deals for a group.
-
#search(group_id:, name: nil, round_name: nil, notes: nil, tags: nil, company_name: nil, company_domain: nil, ignore_archived: nil, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse
Search deals within a group.
-
#update(group_id:, deal_id:, name: nil, round_name: nil, status: nil, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, company_id: nil, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse
Update a deal.
Constructor Details
#initialize(request_client:) ⇒ NewDemoApiClient::DealClient
18 19 20 |
# File 'lib/test_sdk/deal/client.rb', line 18 def initialize(request_client:) @request_client = request_client end |
Instance Attribute Details
#request_client ⇒ NewDemoApiClient::RequestClient (readonly)
14 15 16 |
# File 'lib/test_sdk/deal/client.rb', line 14 def request_client @request_client end |
Instance Method Details
#create(group_id:, name:, round_name:, status:, company_id:, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse
Create a new deal.
49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/test_sdk/deal/client.rb', line 49 def create(group_id:, name:, round_name:, status:, company_id:, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, request_options: nil) response = @request_client.conn.post do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), name: name, round_name: round_name, status: status, notes: notes, priority: priority, round_amount: round_amount, round_target: round_target, tags: , company_id: company_id }.compact req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal" end NewDemoApiClient::DealWithFilesResponse.from_json(json_object: response.body) end |
#delete(deal_id:, group_id:, archive: nil, request_options: nil) ⇒ Hash{String => String}
Delete a deal.
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 |
# File 'lib/test_sdk/deal/client.rb', line 273 def delete(deal_id:, group_id:, archive: nil, request_options: nil) response = @request_client.conn.delete do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "archive": archive }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{deal_id}/deal/#{group_id}" end JSON.parse(response.body) end |
#get(group_id:, deal_id:, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse
Retrieve a deal by its ID.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 |
# File 'lib/test_sdk/deal/client.rb', line 187 def get(group_id:, deal_id:, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/#{deal_id}" end NewDemoApiClient::DealWithFilesResponse.from_json(json_object: response.body) end |
#list(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse
Get all deals for a group.
95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/test_sdk/deal/client.rb', line 95 def list(group_id:, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "sort_by": sort_by, "sort_order": sort_order, "page": page, "page_size": page_size }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/all" end NewDemoApiClient::PaginatedResponseDealWithFilesResponse.from_json(json_object: response.body) end |
#search(group_id:, name: nil, round_name: nil, notes: nil, tags: nil, company_name: nil, company_domain: nil, ignore_archived: nil, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) ⇒ NewDemoApiClient::PaginatedResponseDealWithFilesResponse
Search deals within a group.
142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 |
# File 'lib/test_sdk/deal/client.rb', line 142 def search(group_id:, name: nil, round_name: nil, notes: nil, tags: nil, company_name: nil, company_domain: nil, ignore_archived: nil, sort_by: nil, sort_order: nil, page: nil, page_size: nil, request_options: nil) response = @request_client.conn.get do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact req.params = { **(&.additional_query_parameters || {}), "name": name, "round_name": round_name, "notes": notes, "tags": , "company_name": company_name, "company_domain": company_domain, "ignore_archived": ignore_archived, "sort_by": sort_by, "sort_order": sort_order, "page": page, "page_size": page_size }.compact unless .nil? || &.additional_body_parameters.nil? req.body = { **(&.additional_body_parameters || {}) }.compact end req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/search" end NewDemoApiClient::PaginatedResponseDealWithFilesResponse.from_json(json_object: response.body) end |
#update(group_id:, deal_id:, name: nil, round_name: nil, status: nil, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, company_id: nil, request_options: nil) ⇒ NewDemoApiClient::DealWithFilesResponse
Update a deal.
229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 |
# File 'lib/test_sdk/deal/client.rb', line 229 def update(group_id:, deal_id:, name: nil, round_name: nil, status: nil, notes: nil, priority: nil, round_amount: nil, round_target: nil, tags: nil, company_id: nil, request_options: nil) response = @request_client.conn.put do |req| req..timeout = .timeout_in_seconds unless &.timeout_in_seconds.nil? req.headers["Authorization"] = .token unless &.token.nil? req.headers = { **(req.headers || {}), **@request_client.get_headers, **(&.additional_headers || {}) }.compact unless .nil? || &.additional_query_parameters.nil? req.params = { **(&.additional_query_parameters || {}) }.compact end req.body = { **(&.additional_body_parameters || {}), name: name, round_name: round_name, status: status, notes: notes, priority: priority, round_amount: round_amount, round_target: round_target, tags: , company_id: company_id }.compact req.url "#{@request_client.get_url(request_options: )}/api/v1/group/#{group_id}/deal/#{deal_id}" end NewDemoApiClient::DealWithFilesResponse.from_json(json_object: response.body) end |