Class: Square::VendorsApi
- Defined in:
- lib/square/api/vendors_api.rb
Overview
VendorsApi
Instance Attribute Summary
Attributes inherited from BaseApi
Instance Method Summary collapse
-
#bulk_create_vendors(body:) ⇒ ApiResponse
Creates one or more [Vendor]($m/Vendor) objects to represent suppliers to a seller.
-
#bulk_retrieve_vendors(body:) ⇒ ApiResponse
Retrieves one or more vendors of specified [Vendor]($m/Vendor) IDs.
-
#bulk_update_vendors(body:) ⇒ ApiResponse
Updates one or more of existing [Vendor]($m/Vendor) objects as suppliers to a seller.
-
#create_vendor(body:) ⇒ ApiResponse
Creates a single [Vendor]($m/Vendor) object to represent a supplier to a seller.
-
#retrieve_vendor(vendor_id:) ⇒ ApiResponse
Retrieves the vendor of a specified [Vendor]($m/Vendor) ID.
-
#search_vendors(body:) ⇒ ApiResponse
Searches for vendors using a filter against supported [Vendor]($m/Vendor) properties and a supported sorter.
-
#update_vendor(body:, vendor_id:) ⇒ ApiResponse
Updates an existing [Vendor]($m/Vendor) object as a supplier to a seller.
Methods inherited from BaseApi
#initialize, #new_api_call_builder, #new_parameter, #new_request_builder, #new_response_handler, user_agent, user_agent_parameters
Constructor Details
This class inherits a constructor from Square::BaseApi
Instance Method Details
#bulk_create_vendors(body:) ⇒ ApiResponse
Creates one or more [Vendor]($m/Vendor) objects to represent suppliers to a seller. containing the fields to POST for the request. See the corresponding object definition for field details.
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/square/api/vendors_api.rb', line 10 def bulk_create_vendors(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/vendors/bulk-create', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#bulk_retrieve_vendors(body:) ⇒ ApiResponse
Retrieves one or more vendors of specified [Vendor]($m/Vendor) IDs. containing the fields to POST for the request. See the corresponding object definition for field details.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 |
# File 'lib/square/api/vendors_api.rb', line 32 def bulk_retrieve_vendors(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/vendors/bulk-retrieve', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#bulk_update_vendors(body:) ⇒ ApiResponse
Updates one or more of existing [Vendor]($m/Vendor) objects as suppliers to a seller. containing the fields to POST for the request. See the corresponding object definition for field details.
55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/square/api/vendors_api.rb', line 55 def bulk_update_vendors(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/vendors/bulk-update', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#create_vendor(body:) ⇒ ApiResponse
Creates a single [Vendor]($m/Vendor) object to represent a supplier to a seller. the fields to POST for the request. See the corresponding object definition for field details.
78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/square/api/vendors_api.rb', line 78 def create_vendor(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/vendors/create', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#retrieve_vendor(vendor_id:) ⇒ ApiResponse
Retrieves the vendor of a specified [Vendor]($m/Vendor) ID. [Vendor](entity:Vendor) to retrieve.
122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/square/api/vendors_api.rb', line 122 def retrieve_vendor(vendor_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::GET, '/v2/vendors/{vendor_id}', 'default') .template_param(new_parameter(vendor_id, key: 'vendor_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#search_vendors(body:) ⇒ ApiResponse
Searches for vendors using a filter against supported [Vendor]($m/Vendor) properties and a supported sorter. containing the fields to POST for the request. See the corresponding object definition for field details.
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/square/api/vendors_api.rb', line 101 def search_vendors(body:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::POST, '/v2/vendors/search', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |
#update_vendor(body:, vendor_id:) ⇒ ApiResponse
Updates an existing [Vendor]($m/Vendor) object as a supplier to a seller. the fields to POST for the request. See the corresponding object definition for field details.
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/square/api/vendors_api.rb', line 144 def update_vendor(body:, vendor_id:) new_api_call_builder .request(new_request_builder(HttpMethodEnum::PUT, '/v2/vendors/{vendor_id}', 'default') .header_param(new_parameter('application/json', key: 'Content-Type')) .body_param(new_parameter(body)) .template_param(new_parameter(vendor_id, key: 'vendor_id') .should_encode(true)) .header_param(new_parameter('application/json', key: 'accept')) .body_serializer(proc do |param| param.to_json unless param.nil? end) .auth(Single.new('global'))) .response(new_response_handler .deserializer(APIHelper.method(:json_deserialize)) .is_api_response(true) .convertor(ApiResponse.method(:create))) .execute end |