Class: Square::Vendors::Client
- Inherits:
-
Object
- Object
- Square::Vendors::Client
- Defined in:
- lib/square/vendors/client.rb
Instance Method Summary collapse
-
#batch_create(request_options: {}, **params) ⇒ Square::Types::BatchCreateVendorsResponse
Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
-
#batch_get(request_options: {}, **params) ⇒ Square::Types::BatchGetVendorsResponse
Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs.
-
#batch_update(request_options: {}, **params) ⇒ Square::Types::BatchUpdateVendorsResponse
Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller.
-
#create(request_options: {}, **params) ⇒ Square::Types::CreateVendorResponse
Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller.
-
#get(request_options: {}, **params) ⇒ Square::Types::GetVendorResponse
Retrieves the vendor of a specified [Vendor](entity:Vendor) ID.
- #initialize(client:) ⇒ Square::Vendors::Client constructor
-
#search(request_options: {}, **params) ⇒ Square::Types::SearchVendorsResponse
Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter.
-
#update(request_options: {}, **params) ⇒ Square::Types::UpdateVendorResponse
Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller.
Constructor Details
#initialize(client:) ⇒ Square::Vendors::Client
7 8 9 |
# File 'lib/square/vendors/client.rb', line 7 def initialize(client:) @client = client end |
Instance Method Details
#batch_create(request_options: {}, **params) ⇒ Square::Types::BatchCreateVendorsResponse
Creates one or more [Vendor](entity:Vendor) objects to represent suppliers to a seller.
14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/square/vendors/client.rb', line 14 def batch_create(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/vendors/bulk-create", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::BatchCreateVendorsResponse.load(_response.body) end raise _response.body end |
#batch_get(request_options: {}, **params) ⇒ Square::Types::BatchGetVendorsResponse
Retrieves one or more vendors of specified [Vendor](entity:Vendor) IDs.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/square/vendors/client.rb', line 32 def batch_get(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/vendors/bulk-retrieve", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::BatchGetVendorsResponse.load(_response.body) end raise _response.body end |
#batch_update(request_options: {}, **params) ⇒ Square::Types::BatchUpdateVendorsResponse
Updates one or more of existing [Vendor](entity:Vendor) objects as suppliers to a seller.
50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/square/vendors/client.rb', line 50 def batch_update(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "PUT", path: "v2/vendors/bulk-update", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::BatchUpdateVendorsResponse.load(_response.body) end raise _response.body end |
#create(request_options: {}, **params) ⇒ Square::Types::CreateVendorResponse
Creates a single [Vendor](entity:Vendor) object to represent a supplier to a seller.
68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/square/vendors/client.rb', line 68 def create(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/vendors/create", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::CreateVendorResponse.load(_response.body) end raise _response.body end |
#get(request_options: {}, **params) ⇒ Square::Types::GetVendorResponse
Retrieves the vendor of a specified [Vendor](entity:Vendor) ID.
104 105 106 107 108 109 110 111 112 113 114 115 116 |
# File 'lib/square/vendors/client.rb', line 104 def get(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "GET", path: "v2/vendors/#{params[:vendor_id]}" ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::GetVendorResponse.load(_response.body) end raise _response.body end |
#search(request_options: {}, **params) ⇒ Square::Types::SearchVendorsResponse
Searches for vendors using a filter against supported [Vendor](entity:Vendor) properties and a supported sorter.
86 87 88 89 90 91 92 93 94 95 96 97 98 99 |
# File 'lib/square/vendors/client.rb', line 86 def search(request_options: {}, **params) _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "POST", path: "v2/vendors/search", body: params ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::SearchVendorsResponse.load(_response.body) end raise _response.body end |
#update(request_options: {}, **params) ⇒ Square::Types::UpdateVendorResponse
Updates an existing [Vendor](entity:Vendor) object as a supplier to a seller.
121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 |
# File 'lib/square/vendors/client.rb', line 121 def update(request_options: {}, **params) _path_param_names = ["vendor_id"] _request = Square::Internal::JSON::Request.new( base_url: [:base_url] || Square::Environment::SANDBOX, method: "PUT", path: "v2/vendors/#{params[:vendor_id]}", body: params.except(*_path_param_names) ) _response = @client.send(_request) if _response.code >= "200" && _response.code < "300" return Square::Types::UpdateVendorResponse.load(_response.body) end raise _response.body end |