Class: ProoflinkConnect::Activity
- Inherits:
-
Object
- Object
- ProoflinkConnect::Activity
- Defined in:
- lib/prooflink_connect/activity.rb
Class Method Summary collapse
-
.log(params) ⇒ Object
ProoflinkConnect::Activity.log({ activity_type: ‘some_identifier’, name: ‘some_name’, value: ‘1’, user: ‘jon’, last_name: ‘doe’, email: ‘[email protected]’, identity_provider: ‘prooflink’, extra_info: ‘1234’ }).
Class Method Details
.log(params) ⇒ Object
ProoflinkConnect::Activity.log(
activity_type: {identifier: 'some_identifier', name: 'some_name', value: '1',
user: 'jon', last_name: 'doe', email: '[email protected]', identity_provider: 'prooflink',
extra_info: '1234'
})
21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/prooflink_connect/activity.rb', line 21 def self.log(params) oauth_access_token = ProoflinkConnect.config.oauth_access_token client = OAuth2::Client.new(nil, nil, {:site => ProoflinkConnect.config.base_uri}) access_token = OAuth2::AccessToken.new(client, oauth_access_token, :header_format => "OAuth %s") begin response = access_token.post 'api/v2/activities', :body => {:activity => params} return MultiJson.decode(response.body) rescue OAuth2::Error => error return MultiJson.decode(error.response.body) end end |