File tree 1 file changed +9
-11
lines changed
1 file changed +9
-11
lines changed Original file line number Diff line number Diff line change @@ -8,6 +8,7 @@ class ConstantContact2 < OmniAuth::Strategies::OAuth2
8
8
9
9
DEFAULT_RESPONSE_TYPE = 'code'
10
10
DEFAULT_GRANT = 'authorization_code'
11
+ API_PATH = 'https://api.constantcontact.com/v2'
11
12
12
13
option :name , "constantcontact"
13
14
@@ -37,24 +38,21 @@ def token_params
37
38
end
38
39
39
40
info do
40
- entries = raw_info [ 'feed' ] [ 'entry' ]
41
- if entries . kind_of? ( Array )
42
- {
43
- :email_entries => entries . map { |x |x [ "content" ] [ "Email" ] [ "EmailAddress" ] }
44
- }
45
- else
46
- {
47
- :email => entries [ "content" ] [ "Email" ] [ "EmailAddress" ]
48
- }
49
- end
41
+ {
42
+ email : raw_info [ 'email' ]
43
+ }
50
44
end
51
45
52
46
extra do
53
47
{ 'raw_info' => raw_info }
54
48
end
55
49
56
50
def raw_info
57
- @raw_info ||= MultiXml . parse ( access_token . get ( "https://api.constantcontact.com/ws/customers/#{ request . params [ 'username' ] . strip } /settings/emailaddresses" ) . body )
51
+ options = {
52
+ params : { api_key : client . id } ,
53
+ headers : { 'Authorization' => "Bearer #{ access_token . token } " }
54
+ }
55
+ @raw_info ||= JSON . parse ( access_token . get ( "#{ API_PATH } /account/info" , options ) . body )
58
56
end
59
57
end
60
58
end
You can’t perform that action at this time.
0 commit comments