Module: Zaikio::Hub
- Defined in:
- lib/zaikio/hub.rb,
lib/zaikio/hub/app.rb,
lib/zaikio/hub/base.rb,
lib/zaikio/hub/role.rb,
lib/zaikio/hub/site.rb,
lib/zaikio/hub/asset.rb,
lib/zaikio/hub/client.rb,
lib/zaikio/hub/person.rb,
lib/zaikio/hub/vendor.rb,
lib/zaikio/hub/address.rb,
lib/zaikio/hub/machine.rb,
lib/zaikio/hub/version.rb,
lib/zaikio/hub/connection.rb,
lib/zaikio/hub/membership.rb,
lib/zaikio/hub/specialist.rb,
lib/zaikio/hub/token_data.rb,
lib/zaikio/hub/vendor_app.rb,
lib/zaikio/hub/access_token.rb,
lib/zaikio/hub/availability.rb,
lib/zaikio/hub/organization.rb,
lib/zaikio/hub/subscription.rb,
lib/zaikio/hub/test_account.rb,
lib/zaikio/hub/configuration.rb,
lib/zaikio/hub/current_person.rb,
lib/zaikio/hub/current_organization.rb,
lib/zaikio/hub/revoked_access_token.rb,
lib/zaikio/hub/basic_auth_middleware.rb,
lib/zaikio/hub/business_relationship.rb,
lib/zaikio/hub/organization_membership.rb,
lib/zaikio/hub/subscription_invitation.rb
Defined Under Namespace
Modules: Asset
Classes: AccessToken, Address, App, Availability, Base, BasicAuthMiddleware, BusinessRelationship, Client, Configuration, Connection, CurrentOrganization, CurrentPerson, Machine, Membership, Organization, OrganizationMembership, Person, RequestWrapper, RevokedAccessToken, Role, Site, Specialist, Subscription, SubscriptionInvitation, TestAccount, TokenData, Vendor, VendorApp
Constant Summary
collapse
- VERSION =
"0.19.0".freeze
Class Attribute Summary collapse
Class Method Summary
collapse
Class Attribute Details
.configuration ⇒ Object
Returns the value of attribute configuration.
39
40
41
|
# File 'lib/zaikio/hub.rb', line 39
def configuration
@configuration
end
|
Class Method Details
43
44
45
46
47
48
49
50
|
# File 'lib/zaikio/hub.rb', line 43
def configure
self.connection = nil
self.configuration ||= Configuration.new
yield(configuration)
Base.connection = create_connection
I18n.load_path += Dir["#{File.expand_path('../../config/locales', __dir__)}/*.yml"]
end
|
.create_connection ⇒ Object
75
76
77
78
79
|
# File 'lib/zaikio/hub.rb', line 75
def create_connection
self.connection = Zaikio::Client.create_connection(configuration).tap do |c|
c.use BasicAuthMiddleware
end
end
|
.create_token_data(payload) ⇒ Object
81
82
83
|
# File 'lib/zaikio/hub.rb', line 81
def create_token_data(payload)
TokenData.from(payload)
end
|
.current_token_data ⇒ Object
63
64
65
66
67
68
69
70
71
72
73
|
# File 'lib/zaikio/hub.rb', line 63
def current_token_data
return unless Zaikio::Client::Helpers::AuthorizationMiddleware.token
payload = JWT.decode(
Zaikio::Client::Helpers::AuthorizationMiddleware.token,
nil,
false
).first
create_token_data(payload)
end
|
.with_basic_auth(login, password) ⇒ Object
.with_token(token, &block) ⇒ Object
52
53
54
|
# File 'lib/zaikio/hub.rb', line 52
def with_token(token, &block)
Zaikio::Client.with_token(token, &block)
end
|