Class: Sydecar::Vendor
- Inherits:
-
Object
- Object
- Sydecar::Vendor
- Defined in:
- lib/sydecar/vendor.rb
Constant Summary collapse
- URL =
'/v1/vendors'
- CREATE_URL =
"#{URL}/create"
Class Method Summary collapse
- .create(body:) ⇒ Object
- .find(id:) ⇒ Object
-
.find_all(params: {}, body: {}) ⇒ Object
- String
-
sort: asc / desc [Integer] limit [Integer] offset [String] start_date (format: yyyy-mm-dd) [String] end_date (format: yyyy-mm-dd).
- .update(id:, body:) ⇒ Object
Class Method Details
.create(body:) ⇒ Object
10 11 12 |
# File 'lib/sydecar/vendor.rb', line 10 def create(body:) Connection.instance.post(CREATE_URL, body) end |
.find(id:) ⇒ Object
15 16 17 |
# File 'lib/sydecar/vendor.rb', line 15 def find(id:) Connection.instance.get("#{URL}/#{id}", { reveal_pii: true }) end |
.find_all(params: {}, body: {}) ⇒ Object
- String
-
sort: asc / desc
- Integer
-
limit
- Integer
-
offset
- String
-
start_date (format: yyyy-mm-dd)
- String
-
end_date (format: yyyy-mm-dd)
32 33 34 35 36 |
# File 'lib/sydecar/vendor.rb', line 32 def find_all(params: {}, body: {}) query = '?' query += URI.encode_www_form(params) Connection.instance.post("#{URL}#{query}", body) end |
.update(id:, body:) ⇒ Object
21 22 23 |
# File 'lib/sydecar/vendor.rb', line 21 def update(id:, body:) Connection.instance.patch("#{URL}/#{id}", body) end |