adobe-campaign 0.2.1 → 0.3.0

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
- SHA1:
3
- metadata.gz: 5f4387a7a8fb0c247eed487dbe31fd069a875ee7
4
- data.tar.gz: 54a9d8c8d15bd684a1342a4ab9b01714ebe083b5
2
+ SHA256:
3
+ metadata.gz: c8ac182bee85cebabd69917f493df1e1e9513ead5ccbc35531b9906b5c4361a4
4
+ data.tar.gz: 44bdc3355c3a2d97856618616cb2530a71260818e752ee41088ae9fdaea67274
5
5
  SHA512:
6
- metadata.gz: 6a455a064daaf63d007a10a2e81a553edc149c2938e5f62fc575505c2be4990aa32b4a8b04e6e1afd58f747ab95713fd9de4c92ffb48fb647be17412de3a7f0a
7
- data.tar.gz: 4ac95d4680e43c2f995e355e3e26b29a535333da39d9865f6ee0db2d731381ea870b333222c621d05494bb57b2d96705cbabf80c72065a324283cfad64f092dc
6
+ metadata.gz: b8bc014c78607bc364af06b6d72e1ac6390cb2c0d7537fa5cd66c26246f7c2735b70924570b9f31ea61a8f5c62bc3965af307f44621df4f16bd7db54d8474617
7
+ data.tar.gz: 3827a3145cc60befa2ce55d4c2c420f1f40170a0c188ee626a9ef6b7602a9fbe332f60958c46157bd490a1dbe4058fe2ffffb54e58ffd60fc426ac8cf81f9b70
data/.gitignore CHANGED
@@ -9,3 +9,7 @@
9
9
  /tmp/
10
10
  /cache/
11
11
  /vendor/
12
+ *.gem
13
+ .idea/
14
+ .tool-versions
15
+
data/.rubocop.yml CHANGED
@@ -3,12 +3,13 @@ AllCops:
3
3
  - Rakefile
4
4
  - config.ru
5
5
  - lib/tasks/**/*.rake
6
+ - lib/**/*.rb
6
7
  Exclude:
7
8
  - vendor/**/*
8
9
  - bin/**/*
9
10
 
10
11
  UseCache: true
11
- CacheRootDirectory: 'cache/'
12
+ CacheRootDirectory: "cache/"
12
13
  TargetRubyVersion: 2.3
13
14
 
14
15
  Rails:
data/.ruby-version CHANGED
@@ -1 +1 @@
1
- 2.3.1
1
+ 2.6.5
data/Rakefile CHANGED
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'bundler/gem_tasks'
3
4
  require 'rspec/core/rake_task'
4
5
 
@@ -1,6 +1,6 @@
1
- # coding: utf-8
2
1
  # frozen_string_literal: true
3
- lib = File.expand_path('../lib', __FILE__)
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
4
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
5
  require 'adobe/campaign/version'
6
6
 
@@ -18,13 +18,14 @@ Gem::Specification.new do |spec|
18
18
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
19
19
  spec.require_paths = ['lib']
20
20
 
21
- spec.add_runtime_dependency 'rails', '>= 3.1'
22
21
  spec.add_runtime_dependency 'activesupport', '>= 3.1.0'
23
- spec.add_runtime_dependency 'rest-client', '>= 1.6.0'
24
22
  spec.add_runtime_dependency 'jwt', '~> 1.0'
23
+ spec.add_runtime_dependency 'rails', '>= 3.1'
24
+ spec.add_runtime_dependency 'rest-client', '>= 1.6.0'
25
25
 
26
26
  spec.add_development_dependency 'bundler', '~> 1.11'
27
- spec.add_development_dependency 'rake', '~> 10.0'
28
- spec.add_development_dependency 'rspec', '~> 3.0'
29
27
  spec.add_development_dependency 'guard-rubocop'
28
+ spec.add_development_dependency 'rake', '>= 12.3.3'
29
+ spec.add_development_dependency 'rspec', '~> 3.0'
30
+ spec.add_development_dependency 'rubocop', '~> 0.71.0'
30
31
  end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  require 'rest-client'
3
4
 
4
5
  require 'adobe/campaign/version'
@@ -7,6 +8,7 @@ require 'adobe/campaign/railtie' if defined? ::Rails::Railtie
7
8
  require 'adobe/campaign/base'
8
9
  require 'adobe/campaign/profile'
9
10
  require 'adobe/campaign/service'
11
+ require 'adobe/campaign/language'
10
12
 
11
13
  module Adobe
12
14
  module Campaign
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Adobe
3
4
  module Campaign
4
5
  class Base
@@ -49,6 +50,7 @@ module Adobe
49
50
 
50
51
  def load_access_token
51
52
  return @access_token if @access_token && @access_token_expires > Time.zone.now
53
+
52
54
  as_url = "https://#{Adobe::Campaign.configuration.ims_host}/ims/exchange/jwt"
53
55
  as_payload = {
54
56
  client_id: Adobe::Campaign.configuration.api_key,
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Adobe
3
4
  module Campaign
4
5
  class << self
@@ -0,0 +1,194 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Adobe
4
+ module Campaign
5
+ class Language
6
+ def self.map_code(language_code)
7
+ return language_code if language_code.empty?
8
+
9
+ code = normalize language_code
10
+
11
+ return code if ADOBE_LANGUAGE_CODES.include?(code)
12
+
13
+ if code.include?(ADOBE_DELIMITER)
14
+ map_code code.rpartition(ADOBE_DELIMITER).first
15
+ else
16
+ ADOBE_LANGUAGE_CODES.find { |s| s.start_with? code }
17
+ end
18
+ end
19
+
20
+ def self.normalize(language_code)
21
+ code = language_code
22
+ code = code.downcase
23
+ code.gsub(ISO_DELIMITER, ADOBE_DELIMITER)
24
+ end
25
+
26
+ ISO_DELIMITER = '-'
27
+ ADOBE_DELIMITER = '_'
28
+
29
+ #
30
+ # Found at https://cru.campaign.adobe.com/view/home
31
+ # Profiles tab, search, find, and edit a profile, Preferred Lanaguage
32
+ #
33
+ ADOBE_LANGUAGE_CODES = %w[
34
+ af_za
35
+ sq_al
36
+ sq_mk
37
+ sq_xk
38
+ ar_dz
39
+ ar_bh
40
+ ar_eg
41
+ ar_iq
42
+ ar_il
43
+ ar_jo
44
+ ar_kw
45
+ ar_lb
46
+ ar_ly
47
+ ar_ma
48
+ ar_om
49
+ ar_qa
50
+ ar_sa
51
+ ar_sy
52
+ ar_tn
53
+ ar_ae
54
+ ar_ye
55
+ hy_am
56
+ az_az
57
+ eu_es
58
+ be_by
59
+ bs_ba
60
+ bg_bg
61
+ ca_es
62
+ zh_cn
63
+ zh_sg
64
+ zh_hk
65
+ zh_mo
66
+ zh_tw
67
+ hr_hr
68
+ cs_cz
69
+ da_dk
70
+ nl_be
71
+ nl_nl
72
+ en_us
73
+ en_au
74
+ en_bz
75
+ en_ca
76
+ en_cb
77
+ en_dk
78
+ en_gg
79
+ en_in
80
+ en_ie
81
+ en_il
82
+ en_im
83
+ en_je
84
+ en_jm
85
+ en_kw
86
+ en_my
87
+ en_nz
88
+ en_om
89
+ en_ph
90
+ en_qa
91
+ en_sa
92
+ en_sg
93
+ en_za
94
+ en_tt
95
+ en_ae
96
+ en_gb
97
+ en_zw
98
+ et_ee
99
+ fo_fo
100
+ fa_ir
101
+ fi_fi
102
+ fr_be
103
+ fr_ca
104
+ fr_fr
105
+ fr_lu
106
+ fr_mc
107
+ fr_ch
108
+ gl_es
109
+ ka_ge
110
+ de_at
111
+ de_be
112
+ de_de
113
+ de_it
114
+ de_li
115
+ de_lu
116
+ de_ch
117
+ el_cy
118
+ el_gr
119
+ gu_in
120
+ he_il
121
+ hi_in
122
+ hu_hu
123
+ is_is
124
+ id_id
125
+ it_it
126
+ it_ch
127
+ ja_jp
128
+ kn_in
129
+ kk_kz
130
+ ko_kr
131
+ ky_kz
132
+ lv_lv
133
+ lt_lt
134
+ mk_mk
135
+ ms_bn
136
+ ms_my
137
+ mr_in
138
+ mn_mn
139
+ nb_no
140
+ nn_no
141
+ no_no
142
+ pl_pl
143
+ pt_br
144
+ pt_pt
145
+ pa_in
146
+ ro_md
147
+ ro_ro
148
+ ru_by
149
+ ru_kz
150
+ ru_ru
151
+ ru_ua
152
+ sa_in
153
+ sr_ba
154
+ sr_rs
155
+ sr_xk
156
+ sk_sk
157
+ sl_si
158
+ es_ar
159
+ es_bo
160
+ es_cl
161
+ es_co
162
+ es_cr
163
+ es_do
164
+ es_ec
165
+ es_sv
166
+ es_gt
167
+ es_hn
168
+ es_mx
169
+ es_ni
170
+ es_pa
171
+ es_py
172
+ es_pe
173
+ es_pr
174
+ es_es
175
+ es_uy
176
+ es_ve
177
+ sw_ke
178
+ sv_fi
179
+ sv_se
180
+ ta_in
181
+ tt_ru
182
+ te_in
183
+ th_th
184
+ tr_cy
185
+ tr_tr
186
+ uk_ua
187
+ ur_in
188
+ ur_pk
189
+ uz_uz
190
+ vi_vn
191
+ ].freeze
192
+ end
193
+ end
194
+ end
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Adobe
3
4
  module Campaign
4
5
  class Profile < Adobe::Campaign::Base
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Adobe
3
4
  module Campaign
4
5
  class Railtie < Rails::Railtie
@@ -1,4 +1,5 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Adobe
3
4
  module Campaign
4
5
  class Service < Adobe::Campaign::Base
@@ -1,6 +1,7 @@
1
1
  # frozen_string_literal: true
2
+
2
3
  module Adobe
3
4
  module Campaign
4
- VERSION = '0.2.1'
5
+ VERSION = '0.3.0'
5
6
  end
6
7
  end
data/lib/tasks/adobe.rake CHANGED
@@ -1,8 +1,9 @@
1
1
  # frozen_string_literal: true
2
- # rubocop:disable Metrics/BlockLength
2
+
3
3
  require 'jwt'
4
4
  require 'adobe/campaign'
5
5
 
6
+ # rubocop:disable Metrics/BlockLength
6
7
  namespace :adobe do
7
8
  desc 'Generate a long-life JWT for exchanging with the adobelogic server'
8
9
  task :generate_jwt do
@@ -36,3 +37,4 @@ namespace :adobe do
36
37
  puts "It will expire: #{10.years.from_now}"
37
38
  end
38
39
  end
40
+ # rubocop:enable Metrics/BlockLength
metadata CHANGED
@@ -1,43 +1,57 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: adobe-campaign
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Spencer Oberstadt
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-08-31 00:00:00.000000000 Z
11
+ date: 2020-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
- name: rails
14
+ name: activesupport
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: 3.1.0
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: '3.1'
26
+ version: 3.1.0
27
27
  - !ruby/object:Gem::Dependency
28
- name: activesupport
28
+ name: jwt
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.0'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rails
29
43
  requirement: !ruby/object:Gem::Requirement
30
44
  requirements:
31
45
  - - ">="
32
46
  - !ruby/object:Gem::Version
33
- version: 3.1.0
47
+ version: '3.1'
34
48
  type: :runtime
35
49
  prerelease: false
36
50
  version_requirements: !ruby/object:Gem::Requirement
37
51
  requirements:
38
52
  - - ">="
39
53
  - !ruby/object:Gem::Version
40
- version: 3.1.0
54
+ version: '3.1'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: rest-client
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -53,47 +67,47 @@ dependencies:
53
67
  - !ruby/object:Gem::Version
54
68
  version: 1.6.0
55
69
  - !ruby/object:Gem::Dependency
56
- name: jwt
70
+ name: bundler
57
71
  requirement: !ruby/object:Gem::Requirement
58
72
  requirements:
59
73
  - - "~>"
60
74
  - !ruby/object:Gem::Version
61
- version: '1.0'
62
- type: :runtime
75
+ version: '1.11'
76
+ type: :development
63
77
  prerelease: false
64
78
  version_requirements: !ruby/object:Gem::Requirement
65
79
  requirements:
66
80
  - - "~>"
67
81
  - !ruby/object:Gem::Version
68
- version: '1.0'
82
+ version: '1.11'
69
83
  - !ruby/object:Gem::Dependency
70
- name: bundler
84
+ name: guard-rubocop
71
85
  requirement: !ruby/object:Gem::Requirement
72
86
  requirements:
73
- - - "~>"
87
+ - - ">="
74
88
  - !ruby/object:Gem::Version
75
- version: '1.11'
89
+ version: '0'
76
90
  type: :development
77
91
  prerelease: false
78
92
  version_requirements: !ruby/object:Gem::Requirement
79
93
  requirements:
80
- - - "~>"
94
+ - - ">="
81
95
  - !ruby/object:Gem::Version
82
- version: '1.11'
96
+ version: '0'
83
97
  - !ruby/object:Gem::Dependency
84
98
  name: rake
85
99
  requirement: !ruby/object:Gem::Requirement
86
100
  requirements:
87
- - - "~>"
101
+ - - ">="
88
102
  - !ruby/object:Gem::Version
89
- version: '10.0'
103
+ version: 12.3.3
90
104
  type: :development
91
105
  prerelease: false
92
106
  version_requirements: !ruby/object:Gem::Requirement
93
107
  requirements:
94
- - - "~>"
108
+ - - ">="
95
109
  - !ruby/object:Gem::Version
96
- version: '10.0'
110
+ version: 12.3.3
97
111
  - !ruby/object:Gem::Dependency
98
112
  name: rspec
99
113
  requirement: !ruby/object:Gem::Requirement
@@ -109,19 +123,19 @@ dependencies:
109
123
  - !ruby/object:Gem::Version
110
124
  version: '3.0'
111
125
  - !ruby/object:Gem::Dependency
112
- name: guard-rubocop
126
+ name: rubocop
113
127
  requirement: !ruby/object:Gem::Requirement
114
128
  requirements:
115
- - - ">="
129
+ - - "~>"
116
130
  - !ruby/object:Gem::Version
117
- version: '0'
131
+ version: 0.71.0
118
132
  type: :development
119
133
  prerelease: false
120
134
  version_requirements: !ruby/object:Gem::Requirement
121
135
  requirements:
122
- - - ">="
136
+ - - "~>"
123
137
  - !ruby/object:Gem::Version
124
- version: '0'
138
+ version: 0.71.0
125
139
  description:
126
140
  email:
127
141
  - soberstadt@gmail.com
@@ -138,15 +152,13 @@ files:
138
152
  - Guardfile
139
153
  - README.md
140
154
  - Rakefile
141
- - adobe-campaign-0.1.0.1.gem
142
- - adobe-campaign-0.1.1.gem
143
- - adobe-campaign-0.2.0.gem
144
155
  - adobe-campaign.gemspec
145
156
  - bin/console
146
157
  - bin/setup
147
158
  - lib/adobe/campaign.rb
148
159
  - lib/adobe/campaign/base.rb
149
160
  - lib/adobe/campaign/configuration.rb
161
+ - lib/adobe/campaign/language.rb
150
162
  - lib/adobe/campaign/profile.rb
151
163
  - lib/adobe/campaign/railtie.rb
152
164
  - lib/adobe/campaign/service.rb
@@ -170,8 +182,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
170
182
  - !ruby/object:Gem::Version
171
183
  version: '0'
172
184
  requirements: []
173
- rubyforge_project:
174
- rubygems_version: 2.6.8
185
+ rubygems_version: 3.0.3
175
186
  signing_key:
176
187
  specification_version: 4
177
188
  summary: A ruby wrapper for connecting your Rails app with Adobe Campaign.
Binary file
Binary file
Binary file