mautic 0.1.4 → 0.1.6

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
  SHA1:
3
- metadata.gz: c77ac23dffbdf501bf3193b5da058a6664aa887a
4
- data.tar.gz: 5e70349a9999dae0f43725e6b2b0028eec68f858
3
+ metadata.gz: ae603a459a430f1c56f626d53b5e124d8b8c8c7c
4
+ data.tar.gz: 2fe7b84ed8f84132d9de88d087f3c19be9289d14
5
5
  SHA512:
6
- metadata.gz: 403f7b5fefaffc8efd92088b916342051750d234a011d7f57e6bba1fa5a37d500f04cb2467146170e06ed34c6535e2bfad6cd93b7f6ef00641d17be7c0d4c2dc
7
- data.tar.gz: 91744d8458f445803d0b43021183e1cd9339c739bce7b7382e13edfd906270f96b3dc4dd01499486db02a1b9e571d623900de5e1483d9c01364be2b3d1b227a5
6
+ metadata.gz: f8e55980f0f3f508459e071848fdb177b90a084eb7931b6c0e34a9b9fddd57ebe34c3a08aae02a2a96d247ede0dd161610c7e565b9d316823653f4f7b6746058
7
+ data.tar.gz: 5505b22d15af7b959b536a1ec00e437051a4a49ac1281593bee90e3bc64cb52b9013886cd9981d5835574c07ad293d70895477649efdb105d454087e0600d78d
data/lib/mautic/model.rb CHANGED
@@ -15,6 +15,14 @@ module Mautic
15
15
 
16
16
  end
17
17
 
18
+ class Attribute < OpenStruct
19
+
20
+ def name
21
+ @alias
22
+ end
23
+
24
+ end
25
+
18
26
  class << self
19
27
 
20
28
  def endpoint
@@ -30,7 +38,7 @@ module Mautic
30
38
  def initialize(connection, hash=nil)
31
39
  @connection = connection
32
40
  @table = MauticHash.new
33
- self.attributes = { created_at: hash['dateAdded']&.to_time, updated_at: hash['dateModified']&.to_time } if hash
41
+ self.attributes = { id: hash['id'], created_at: hash['dateAdded']&.to_time, updated_at: hash['dateModified']&.to_time } if hash
34
42
  assign_attributes(hash)
35
43
  clear_changes
36
44
  end
@@ -100,10 +108,24 @@ module Mautic
100
108
  end
101
109
 
102
110
  def assign_attributes(source = nil)
111
+ @mautic_attributes = []
103
112
  source ||= {}
104
113
  data = {}
114
+
105
115
  if (fields = source['fields'])
106
- data.merge!(fields['all']) if fields['all']
116
+ if fields['all']
117
+ @mautic_attributes = fields['all'].collect do |key, value|
118
+ data[key] = value
119
+ Attribute.new(alias: key, value: value)
120
+ end
121
+ else
122
+ fields.each do |_group, pairs|
123
+ pairs.each do |key, attrs|
124
+ @mautic_attributes << (a = Attribute.new(attrs))
125
+ data[key] = a.value
126
+ end
127
+ end
128
+ end
107
129
  elsif source
108
130
  data = source
109
131
  end
@@ -111,4 +133,4 @@ module Mautic
111
133
  end
112
134
 
113
135
  end
114
- end
136
+ end
@@ -1,3 +1,3 @@
1
1
  module Mautic
2
- VERSION = '0.1.4'
2
+ VERSION = '0.1.6'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: mautic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lukáš Pokorný
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-12-08 00:00:00.000000000 Z
11
+ date: 2018-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -191,7 +191,6 @@ files:
191
191
  - app/helpers/mautic/application_helper.rb
192
192
  - app/jobs/mautic/application_job.rb
193
193
  - app/mailers/mautic/application_mailer.rb
194
- - app/models/application_record.rb
195
194
  - app/models/mautic/application_record.rb
196
195
  - app/models/mautic/connection.rb
197
196
  - app/models/mautic/connections/oauth2.rb
@@ -235,7 +234,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
235
234
  version: '0'
236
235
  requirements: []
237
236
  rubyforge_project:
238
- rubygems_version: 2.6.13
237
+ rubygems_version: 2.6.14
239
238
  signing_key:
240
239
  specification_version: 4
241
240
  summary: Ruby on Rails Mautic integration
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end