mautic 1.0.3 → 1.0.5

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: 4be984905747a5913cd7271d2f0f8b2475a22cf6
4
- data.tar.gz: 14020973bd047ea58c470d3270f1b3000ded51f4
3
+ metadata.gz: d61af0eb918446c6edf125b168fd769dca21e6bf
4
+ data.tar.gz: 6e3707b229934a703d7065feaf6596c71e0a500c
5
5
  SHA512:
6
- metadata.gz: 4f116539c9dc6a253e3373bf91c06bcc88600c120237bbb376769b1b3c2c6fb8711e6ed4dc9e828c53dbd2115bfd6166528b1c4726c2ded28dfde27d23b4713a
7
- data.tar.gz: 65cf3ee03b29e4561ea9828f5f3ee1a6b78a0d71d7124642512e64af12315378bfd9369c705c9d1201334c9d231cdbc815dbd411f9d223c51304bfb5ee0e7b7b
6
+ metadata.gz: 0da6bcb99a484a7a4a2d2ecbb17a563a06f04687e44faf9f596f55bbad4e9dbe92029284f90ec6d60e1005cb117e6da8251e76afac1f5394ce92bc2d4f35a28e
7
+ data.tar.gz: 92d3a2903427d32d74a15fb523b60ffab5ef4563119ddf0405ec7d5c567102bb7947eeda4b7c1d77258c183280eb308eca512b88f2e482eec84a6ad515050d93
@@ -5,8 +5,8 @@ module Mautic
5
5
  def client
6
6
  @client ||= OAuth2::Client.new(client_id, secret, {
7
7
  site: url,
8
- authorize_url: '/oauth/v2/authorize',
9
- token_url: '/oauth/v2/token',
8
+ authorize_url: 'oauth/v2/authorize',
9
+ token_url: 'oauth/v2/token',
10
10
  raise_errors: false
11
11
  })
12
12
  end
@@ -46,4 +46,4 @@ module Mautic
46
46
 
47
47
  end
48
48
  end
49
- end
49
+ end
@@ -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 = '1.0.3'
2
+ VERSION = '1.0.5'
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: 1.0.3
4
+ version: 1.0.5
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-03-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails
@@ -171,7 +171,6 @@ files:
171
171
  - app/helpers/mautic/application_helper.rb
172
172
  - app/jobs/mautic/application_job.rb
173
173
  - app/mailers/mautic/application_mailer.rb
174
- - app/models/application_record.rb
175
174
  - app/models/mautic/application_record.rb
176
175
  - app/models/mautic/connection.rb
177
176
  - app/models/mautic/connections/oauth2.rb
@@ -1,3 +0,0 @@
1
- class ApplicationRecord < ActiveRecord::Base
2
- self.abstract_class = true
3
- end