Class: Rallio::OwnershipsBase
- Defined in:
- lib/rallio/ownerships_base.rb
Direct Known Subclasses
Class Method Summary collapse
-
.create(user_id:, payload:) ⇒ Rallio::FranchisorOwnership, Rallio::AccountOwnership
Create new ownership.
-
.destroy(user_id:, object_id:) ⇒ Object
Destroy ownership for user.
-
.for(access_token:) ⇒ Object
Ownerships for access_token and url segment defined in class.
Methods inherited from Base
Class Method Details
.create(user_id:, payload:) ⇒ Rallio::FranchisorOwnership, Rallio::AccountOwnership
Create new ownership.
20 21 22 23 |
# File 'lib/rallio/ownerships_base.rb', line 20 def self.create(user_id:, payload:) response = self.post("/users/#{user_id}/#{url_segment}", headers: app_credentials, body: payload) new response.parsed_response["#{response_key}"] end |
.destroy(user_id:, object_id:) ⇒ Object
Destroy ownership for user.
30 31 32 |
# File 'lib/rallio/ownerships_base.rb', line 30 def self.destroy(user_id:, object_id:) self.delete("/users/#{user_id}/#{url_segment}/#{object_id}", headers: app_credentials) end |
.for(access_token:) ⇒ Object
Ownerships for access_token and url segment defined in class.
6 7 8 9 10 |
# File 'lib/rallio/ownerships_base.rb', line 6 def self.for(access_token:) headers = { 'Authorization' => "Bearer #{access_token}" } response = self.get("/#{url_segment}", headers: headers) response.parsed_response["#{url_segment}"].map { |a| new(a) } end |