Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class Contact
- attr_accessor :auth_token
- def initialize(contact_hash)
- ...
- end
- def edit(...)
- auth_token.can! :read, self
- end
- end
- token = AuthorizationToken.new(session)
- contact = SomeService.get_contact(...)
- contact.edit(...)
- # raise error because auth_token is not set
- contact.auth_token = token
- contact.edit(...)
- class QueryService
- def initialize(session)
- token = AuthorizationToken(session)
- end
- def get_contact
- contact = SomeService.get_contact(...)
- contact.token = token
- end
- end
- contact = QueryService.new(session).get_contact(...)
- contact.edit(...)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement