Class: Zaikio::Hub::CurrentOrganization
- Defined in:
- lib/zaikio/hub/current_organization.rb
Class Method Summary collapse
Instance Method Summary collapse
- #create_subscription(status: "active", plan_name: nil) ⇒ Object
- #fetch ⇒ Object
- #members ⇒ Object
- #reload ⇒ Object
Class Method Details
.find ⇒ Object
8 9 10 |
# File 'lib/zaikio/hub/current_organization.rb', line 8 def self.find all.find_one end |
.find_with_fallback(fallback) ⇒ Object
12 13 14 |
# File 'lib/zaikio/hub/current_organization.rb', line 12 def self.find_with_fallback(fallback) all.with_fallback(fallback).find_one end |
Instance Method Details
#create_subscription(status: "active", plan_name: nil) ⇒ Object
54 55 56 57 58 59 60 |
# File 'lib/zaikio/hub/current_organization.rb', line 54 def create_subscription(status: "active", plan_name: nil) return unless Zaikio::Hub.current_token_data.subject_type == "Organization" result = self.class.request(:post, "organization/subscription", subscription: { status: status, plan_name: plan_name }) Zaikio::Hub::Subscription.new(result.data) end |
#fetch ⇒ Object
42 43 44 |
# File 'lib/zaikio/hub/current_organization.rb', line 42 def fetch self.attributes = get end |
#members ⇒ Object
50 51 52 |
# File 'lib/zaikio/hub/current_organization.rb', line 50 def members memberships.with_fallback.map(&:person) end |
#reload ⇒ Object
46 47 48 |
# File 'lib/zaikio/hub/current_organization.rb', line 46 def reload self.attributes = self.class.find.attributes end |