icalia-sdk-event-core 0.3.2 → 0.3.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4203edefd2dcbdc0ef3bba3588d4da30686dfe5f0b009121907ac29cb8381df4
4
- data.tar.gz: d3f61bb45612489b83d581e004d6fe51d4cb5a4280d728d62ae6d590f94a5df0
3
+ metadata.gz: 2c7c6141a1c2fedf778f47affa3ed4d1d30bd4cdd3f5fc0e787eb9fbd4b1c910
4
+ data.tar.gz: 8ad575734a2ba41aa7bce627c50fd6b5094ab255e45395491f32ac4e1fa239ae
5
5
  SHA512:
6
- metadata.gz: 8761c73557e1a23729b9b62ae2ff2bc8f1be0c5d65cfa2e21d584e92093199bab4cc447a0623ee7c8f75b1b3213c849ae51cee0728bdc466887e77b8ecba86ea
7
- data.tar.gz: 509fa5cb88d80e7ab5ff040afa31616147161c1be30856d6d0b7ec46eff7a91d3eb10f97db6e663cf6a31e3fbc9727f81420216cabb633b8de7b008b74d6e0ba
6
+ metadata.gz: ec1aeadce6a11f6d50e097408eef39c4d1299f2bc074cfd820a97d8bca85c14ba95c05dca9e9238998290afb265d877c823a5d4220d485114b87fe797db7aed6
7
+ data.tar.gz: c9ba0254b8ca5846909de97fe5ea2447027a759858ac386d6f5f5991f43169c06d7dd6a29fdc19e80d4e7f57a5b03237f572e1a20cb2f474fbb20bc4e7e71d8b
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Icalia
4
+ class AuthorizationEvent < ModelBase
5
+ attr_reader :action, :timestamp
6
+
7
+ has_one :token
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Icalia
4
+ class OAuthAccessToken < ModelBase
5
+ attr_reader :scopes, :created_at, :expires_at
6
+
7
+ has_one :application, :resource_owner
8
+ end
9
+ end
@@ -26,6 +26,9 @@ module Icalia
26
26
 
27
27
  autoload :CodeMergeRequest, "#{models_path}/code_merge_request"
28
28
 
29
+ autoload :OAuthAccessToken, "#{models_path}/oauth_access_token"
30
+ autoload :AuthorizationEvent, "#{models_path}/authorization_event"
31
+
29
32
  # Event Models:
30
33
  event_models_path = "#{models_path}/events"
31
34
  autoload :MembershipEvent, "#{event_models_path}/membership_event"
@@ -7,10 +7,9 @@ module Icalia::Event
7
7
  # Icalia OAuth Access Token event
8
8
  class DeserializableOauthAccessTokenEvent < DeserializableResource
9
9
  include DeserializableResourceAction
10
- include DeserializableResourceCreationTimestamp
11
10
 
12
11
  has_one :token do |_rel, id, type|
13
- Hash[token_id: id, token_type: classify_type(type)]
12
+ Hash[token: get_stand_in(id: id, type: classify_type(type))]
14
13
  end
15
14
  end
16
15
  end
@@ -5,20 +5,27 @@ module Icalia::Event
5
5
  #
6
6
  # This class is responsible for converting a JSONAPI.org representation of an
7
7
  # Icalia OAuth Access Token
8
- class DeserializableOauthAccessToken < DeserializableResource
8
+ class DeserializableOAuthAccessToken < DeserializableResource
9
9
  include DeserializableResourceCreationTimestamp
10
10
 
11
11
  attributes :scopes
12
12
 
13
- attribute(:'expires-at') { |value| Hash[expires_at: value] }
14
- attribute(:'revoked-at') { |value| Hash[revoked_at: value] }
13
+ attribute :'expires-at' do |value|
14
+ parsed_value = !!value ? Time.parse(value) : nil
15
+ Hash[expires_at: parsed_value]
16
+ end
17
+
18
+ attribute :'revoked-at' do |value|
19
+ parsed_value = !!value ? Time.parse(value) : nil
20
+ Hash[revoked_at: parsed_value]
21
+ end
15
22
 
16
23
  has_one :application do |_rel, id, type|
17
- Hash[application_id: id, application_type: classify_type(type)]
24
+ Hash[application: get_stand_in(id: id, type: classify_type(type))]
18
25
  end
19
-
26
+
20
27
  has_one :'resource-owner' do |_rel, id, type|
21
- Hash[resource_owner_id: id, resource_owner_type: classify_type(type)]
28
+ Hash[resource_owner: get_stand_in(id: id, type: classify_type(type))]
22
29
  end
23
30
  end
24
31
  end
@@ -91,7 +91,7 @@ module Icalia::Event
91
91
  end
92
92
 
93
93
  def deserialize_object_data(object_data)
94
- object_class_name = object_data['type'].underscore.classify
94
+ object_class_name = object_data['type'].underscore.classify.gsub(/Oauth/, 'OAuth')
95
95
  object_class = "::Icalia::#{object_class_name}".safe_constantize
96
96
  return unless object_class
97
97
 
@@ -28,12 +28,12 @@ module Icalia
28
28
  autoload :DeserializableOrganizationEvent,
29
29
  "#{serialization_path}/deserializable_organization_event"
30
30
 
31
+ autoload :DeserializableAuthorizationEvent,
32
+ "#{serialization_path}/deserializable_authorization_event"
33
+
31
34
  autoload :DeserializableCodeMergeRequestEvent,
32
35
  "#{serialization_path}/deserializable_code_merge_request_event"
33
36
 
34
- autoload :DeserializableOauthAccessTokenEvent,
35
- "#{serialization_path}/deserializable_oauth_access_token_event"
36
-
37
37
  # Deserializable Objects
38
38
  autoload :DeserializableResource,
39
39
  "#{serialization_path}/deserializable_resource"
@@ -50,7 +50,7 @@ module Icalia
50
50
  autoload :DeserializablePerson,
51
51
  "#{serialization_path}/deserializable_person"
52
52
 
53
- autoload :DeserializableOauthAccessToken,
53
+ autoload :DeserializableOAuthAccessToken,
54
54
  "#{serialization_path}/deserializable_oauth_access_token"
55
55
 
56
56
  autoload :DeserializableOauthApplication,
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Icalia
4
4
  module Event
5
- CORE_VERSION = '0.3.2'
5
+ CORE_VERSION = '0.3.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: icalia-sdk-event-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.2
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Roberto Quintanilla
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-02-08 00:00:00.000000000 Z
11
+ date: 2020-02-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: jsonapi-deserializable
@@ -90,6 +90,7 @@ extra_rdoc_files: []
90
90
  files:
91
91
  - lib/icalia-sdk-event-core.rb
92
92
  - lib/icalia-sdk-event-core/models.rb
93
+ - lib/icalia-sdk-event-core/models/authorization_event.rb
93
94
  - lib/icalia-sdk-event-core/models/cloud_identity.rb
94
95
  - lib/icalia-sdk-event-core/models/code_commit.rb
95
96
  - lib/icalia-sdk-event-core/models/code_merge_request.rb
@@ -103,12 +104,14 @@ files:
103
104
  - lib/icalia-sdk-event-core/models/model_base.rb
104
105
  - lib/icalia-sdk-event-core/models/model_collection_proxy.rb
105
106
  - lib/icalia-sdk-event-core/models/model_proxy.rb
107
+ - lib/icalia-sdk-event-core/models/oauth_access_token.rb
106
108
  - lib/icalia-sdk-event-core/models/organization.rb
107
109
  - lib/icalia-sdk-event-core/models/person.rb
108
110
  - lib/icalia-sdk-event-core/models/resource_action.rb
109
111
  - lib/icalia-sdk-event-core/models/resource_identity.rb
110
112
  - lib/icalia-sdk-event-core/models/resource_timestamps.rb
111
113
  - lib/icalia-sdk-event-core/serialization.rb
114
+ - lib/icalia-sdk-event-core/serialization/deserializable_authorization_event.rb
112
115
  - lib/icalia-sdk-event-core/serialization/deserializable_cloud_identity.rb
113
116
  - lib/icalia-sdk-event-core/serialization/deserializable_code_check_run.rb
114
117
  - lib/icalia-sdk-event-core/serialization/deserializable_code_check_run_event.rb
@@ -125,7 +128,6 @@ files:
125
128
  - lib/icalia-sdk-event-core/serialization/deserializable_membership.rb
126
129
  - lib/icalia-sdk-event-core/serialization/deserializable_membership_event.rb
127
130
  - lib/icalia-sdk-event-core/serialization/deserializable_oauth_access_token.rb
128
- - lib/icalia-sdk-event-core/serialization/deserializable_oauth_access_token_event.rb
129
131
  - lib/icalia-sdk-event-core/serialization/deserializable_oauth_application.rb
130
132
  - lib/icalia-sdk-event-core/serialization/deserializable_organization.rb
131
133
  - lib/icalia-sdk-event-core/serialization/deserializable_organization_event.rb