responsys-api 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (64) hide show
  1. checksums.yaml +8 -8
  2. data/.gitignore +1 -0
  3. data/Gemfile +1 -1
  4. data/README.md +82 -10
  5. data/lib/responsys/api/all.rb +17 -0
  6. data/lib/responsys/api/campaign.rb +26 -0
  7. data/lib/responsys/api/client.rb +70 -0
  8. data/lib/responsys/api/folder.rb +25 -0
  9. data/lib/responsys/api/list.rb +39 -0
  10. data/lib/responsys/api/object/all.rb +11 -0
  11. data/lib/responsys/api/object/email_format.rb +23 -0
  12. data/lib/responsys/api/object/field.rb +20 -0
  13. data/lib/responsys/api/object/field_type.rb +23 -0
  14. data/lib/responsys/api/object/interact_object.rb +18 -0
  15. data/lib/responsys/api/object/list_merge_rule.rb +41 -0
  16. data/lib/responsys/api/object/optional_data.rb +23 -0
  17. data/lib/responsys/api/object/query_column.rb +23 -0
  18. data/lib/responsys/api/object/recipient.rb +30 -0
  19. data/lib/responsys/api/object/recipient_data.rb +21 -0
  20. data/lib/responsys/api/object/record.rb +19 -0
  21. data/lib/responsys/api/object/record_data.rb +31 -0
  22. data/lib/responsys/api/session.rb +30 -0
  23. data/lib/responsys/api/table.rb +49 -0
  24. data/lib/responsys/configuration.rb +3 -3
  25. data/lib/responsys/exceptions/all.rb +1 -0
  26. data/lib/responsys/exceptions/parameter_exception.rb +7 -0
  27. data/lib/responsys/helper.rb +78 -2
  28. data/lib/responsys/i18n/en.yml +20 -0
  29. data/lib/responsys/member.rb +80 -0
  30. data/lib/responsys_api.rb +11 -4
  31. data/responsys-api.gemspec +12 -9
  32. data/spec/api/campaign_spec.rb +27 -0
  33. data/spec/api/client_spec.rb +107 -0
  34. data/spec/api/list_spec.rb +71 -0
  35. data/spec/api/object/recipient_data_spec.rb +43 -0
  36. data/spec/api/object/recipient_spec.rb +68 -0
  37. data/spec/api/object/record_data_spec.rb +28 -0
  38. data/spec/api/table_spec.rb +111 -0
  39. data/spec/fixtures/vcr_cassettes/api/campaign/login.yml +940 -0
  40. data/spec/fixtures/vcr_cassettes/api/client/expired_session.yml +1030 -0
  41. data/spec/fixtures/vcr_cassettes/api/list/login.yml +982 -0
  42. data/spec/fixtures/vcr_cassettes/api/list/merge.yml +134 -0
  43. data/spec/fixtures/vcr_cassettes/api/list/retrieve.yml +46 -0
  44. data/spec/fixtures/vcr_cassettes/api/list/retrieve_single.yml +133 -0
  45. data/spec/fixtures/vcr_cassettes/api/list/retrieve_single_single.yml +45 -0
  46. data/spec/fixtures/vcr_cassettes/api/profile_extension/login.yml +982 -0
  47. data/spec/fixtures/vcr_cassettes/api/profile_extension/merge_profile_extension_records.yml +46 -0
  48. data/spec/fixtures/vcr_cassettes/api/profile_extension/retrieve_profile_extension_records.yml +45 -0
  49. data/spec/fixtures/vcr_cassettes/api/table/create.yml +45 -0
  50. data/spec/fixtures/vcr_cassettes/api/table/create_with_pk.yml +45 -0
  51. data/spec/fixtures/vcr_cassettes/api/table/delete.yml +45 -0
  52. data/spec/fixtures/vcr_cassettes/api/table/delete_with_pk.yml +45 -0
  53. data/spec/fixtures/vcr_cassettes/member/present1.yml +982 -0
  54. data/spec/fixtures/vcr_cassettes/member/present2.yml +45 -0
  55. data/spec/fixtures/vcr_cassettes/member/present3.yml +48 -0
  56. data/spec/fixtures/vcr_cassettes/member/present4.yml +48 -0
  57. data/spec/fixtures/vcr_cassettes/member/present5.yml +48 -0
  58. data/spec/fixtures/vcr_cassettes/member/retrieve_profile_extension.yml +87 -0
  59. data/spec/member_spec.rb +136 -0
  60. data/spec/spec_helper.rb +28 -2
  61. metadata +136 -19
  62. data/lib/responsys/responsys_api.rb +0 -41
  63. data/lib/savon/savon_api.rb +0 -22
  64. data/spec/responsys_api_spec.rb +0 -4
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: responsys-api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Dan DeMeyere
@@ -11,7 +11,7 @@ authors:
11
11
  autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
- date: 2014-08-08 00:00:00.000000000 Z
14
+ date: 2014-09-02 00:00:00.000000000 Z
15
15
  dependencies:
16
16
  - !ruby/object:Gem::Dependency
17
17
  name: rubyntlm
@@ -19,28 +19,42 @@ dependencies:
19
19
  requirements:
20
20
  - - ~>
21
21
  - !ruby/object:Gem::Version
22
- version: 0.4.0
22
+ version: '0.4'
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
26
26
  requirements:
27
27
  - - ~>
28
28
  - !ruby/object:Gem::Version
29
- version: 0.4.0
29
+ version: '0.4'
30
30
  - !ruby/object:Gem::Dependency
31
31
  name: savon
32
32
  requirement: !ruby/object:Gem::Requirement
33
33
  requirements:
34
34
  - - ~>
35
35
  - !ruby/object:Gem::Version
36
- version: 2.6.0
36
+ version: '2.6'
37
37
  type: :runtime
38
38
  prerelease: false
39
39
  version_requirements: !ruby/object:Gem::Requirement
40
40
  requirements:
41
41
  - - ~>
42
42
  - !ruby/object:Gem::Version
43
- version: 2.6.0
43
+ version: '2.6'
44
+ - !ruby/object:Gem::Dependency
45
+ name: i18n
46
+ requirement: !ruby/object:Gem::Requirement
47
+ requirements:
48
+ - - ~>
49
+ - !ruby/object:Gem::Version
50
+ version: '0.6'
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - ~>
56
+ - !ruby/object:Gem::Version
57
+ version: '0.6'
44
58
  - !ruby/object:Gem::Dependency
45
59
  name: bundler
46
60
  requirement: !ruby/object:Gem::Requirement
@@ -59,34 +73,62 @@ dependencies:
59
73
  name: rake
60
74
  requirement: !ruby/object:Gem::Requirement
61
75
  requirements:
62
- - - ! '>='
76
+ - - ~>
63
77
  - !ruby/object:Gem::Version
64
- version: '0'
78
+ version: '10.3'
65
79
  type: :development
66
80
  prerelease: false
67
81
  version_requirements: !ruby/object:Gem::Requirement
68
82
  requirements:
69
- - - ! '>='
83
+ - - ~>
70
84
  - !ruby/object:Gem::Version
71
- version: '0'
85
+ version: '10.3'
72
86
  - !ruby/object:Gem::Dependency
73
87
  name: rspec
74
88
  requirement: !ruby/object:Gem::Requirement
75
89
  requirements:
76
- - - '='
90
+ - - ~>
77
91
  - !ruby/object:Gem::Version
78
- version: 3.0.0
92
+ version: '3.0'
79
93
  type: :development
80
94
  prerelease: false
81
95
  version_requirements: !ruby/object:Gem::Requirement
82
96
  requirements:
83
- - - '='
97
+ - - ~>
98
+ - !ruby/object:Gem::Version
99
+ version: '3.0'
100
+ - !ruby/object:Gem::Dependency
101
+ name: vcr
102
+ requirement: !ruby/object:Gem::Requirement
103
+ requirements:
104
+ - - ~>
105
+ - !ruby/object:Gem::Version
106
+ version: '2.5'
107
+ type: :development
108
+ prerelease: false
109
+ version_requirements: !ruby/object:Gem::Requirement
110
+ requirements:
111
+ - - ~>
112
+ - !ruby/object:Gem::Version
113
+ version: '2.5'
114
+ - !ruby/object:Gem::Dependency
115
+ name: webmock
116
+ requirement: !ruby/object:Gem::Requirement
117
+ requirements:
118
+ - - ~>
119
+ - !ruby/object:Gem::Version
120
+ version: '1.9'
121
+ type: :development
122
+ prerelease: false
123
+ version_requirements: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ~>
84
126
  - !ruby/object:Gem::Version
85
- version: 3.0.0
127
+ version: '1.9'
86
128
  description: A gem to integrate with the Responsys SOAP API
87
129
  email:
88
130
  - dan@thredup.com
89
- - florain.lorrain@thredup.com
131
+ - florian.lorrain@thredup.com
90
132
  - morgan@thredup.com
91
133
  - michael.rocco@thredup.com
92
134
  executables: []
@@ -99,13 +141,61 @@ files:
99
141
  - LICENSE.txt
100
142
  - README.md
101
143
  - Rakefile
144
+ - lib/responsys/api/all.rb
145
+ - lib/responsys/api/campaign.rb
146
+ - lib/responsys/api/client.rb
147
+ - lib/responsys/api/folder.rb
148
+ - lib/responsys/api/list.rb
149
+ - lib/responsys/api/object/all.rb
150
+ - lib/responsys/api/object/email_format.rb
151
+ - lib/responsys/api/object/field.rb
152
+ - lib/responsys/api/object/field_type.rb
153
+ - lib/responsys/api/object/interact_object.rb
154
+ - lib/responsys/api/object/list_merge_rule.rb
155
+ - lib/responsys/api/object/optional_data.rb
156
+ - lib/responsys/api/object/query_column.rb
157
+ - lib/responsys/api/object/recipient.rb
158
+ - lib/responsys/api/object/recipient_data.rb
159
+ - lib/responsys/api/object/record.rb
160
+ - lib/responsys/api/object/record_data.rb
161
+ - lib/responsys/api/session.rb
162
+ - lib/responsys/api/table.rb
102
163
  - lib/responsys/configuration.rb
164
+ - lib/responsys/exceptions/all.rb
165
+ - lib/responsys/exceptions/parameter_exception.rb
103
166
  - lib/responsys/helper.rb
104
- - lib/responsys/responsys_api.rb
167
+ - lib/responsys/i18n/en.yml
168
+ - lib/responsys/member.rb
105
169
  - lib/responsys_api.rb
106
- - lib/savon/savon_api.rb
107
170
  - responsys-api.gemspec
108
- - spec/responsys_api_spec.rb
171
+ - spec/api/campaign_spec.rb
172
+ - spec/api/client_spec.rb
173
+ - spec/api/list_spec.rb
174
+ - spec/api/object/recipient_data_spec.rb
175
+ - spec/api/object/recipient_spec.rb
176
+ - spec/api/object/record_data_spec.rb
177
+ - spec/api/table_spec.rb
178
+ - spec/fixtures/vcr_cassettes/api/campaign/login.yml
179
+ - spec/fixtures/vcr_cassettes/api/client/expired_session.yml
180
+ - spec/fixtures/vcr_cassettes/api/list/login.yml
181
+ - spec/fixtures/vcr_cassettes/api/list/merge.yml
182
+ - spec/fixtures/vcr_cassettes/api/list/retrieve.yml
183
+ - spec/fixtures/vcr_cassettes/api/list/retrieve_single.yml
184
+ - spec/fixtures/vcr_cassettes/api/list/retrieve_single_single.yml
185
+ - spec/fixtures/vcr_cassettes/api/profile_extension/login.yml
186
+ - spec/fixtures/vcr_cassettes/api/profile_extension/merge_profile_extension_records.yml
187
+ - spec/fixtures/vcr_cassettes/api/profile_extension/retrieve_profile_extension_records.yml
188
+ - spec/fixtures/vcr_cassettes/api/table/create.yml
189
+ - spec/fixtures/vcr_cassettes/api/table/create_with_pk.yml
190
+ - spec/fixtures/vcr_cassettes/api/table/delete.yml
191
+ - spec/fixtures/vcr_cassettes/api/table/delete_with_pk.yml
192
+ - spec/fixtures/vcr_cassettes/member/present1.yml
193
+ - spec/fixtures/vcr_cassettes/member/present2.yml
194
+ - spec/fixtures/vcr_cassettes/member/present3.yml
195
+ - spec/fixtures/vcr_cassettes/member/present4.yml
196
+ - spec/fixtures/vcr_cassettes/member/present5.yml
197
+ - spec/fixtures/vcr_cassettes/member/retrieve_profile_extension.yml
198
+ - spec/member_spec.rb
109
199
  - spec/spec_helper.rb
110
200
  homepage: https://github.com/dandemeyere/responsys-api
111
201
  licenses:
@@ -132,5 +222,32 @@ signing_key:
132
222
  specification_version: 4
133
223
  summary: Write a proper summary
134
224
  test_files:
135
- - spec/responsys_api_spec.rb
225
+ - spec/api/campaign_spec.rb
226
+ - spec/api/client_spec.rb
227
+ - spec/api/list_spec.rb
228
+ - spec/api/object/recipient_data_spec.rb
229
+ - spec/api/object/recipient_spec.rb
230
+ - spec/api/object/record_data_spec.rb
231
+ - spec/api/table_spec.rb
232
+ - spec/fixtures/vcr_cassettes/api/campaign/login.yml
233
+ - spec/fixtures/vcr_cassettes/api/client/expired_session.yml
234
+ - spec/fixtures/vcr_cassettes/api/list/login.yml
235
+ - spec/fixtures/vcr_cassettes/api/list/merge.yml
236
+ - spec/fixtures/vcr_cassettes/api/list/retrieve.yml
237
+ - spec/fixtures/vcr_cassettes/api/list/retrieve_single.yml
238
+ - spec/fixtures/vcr_cassettes/api/list/retrieve_single_single.yml
239
+ - spec/fixtures/vcr_cassettes/api/profile_extension/login.yml
240
+ - spec/fixtures/vcr_cassettes/api/profile_extension/merge_profile_extension_records.yml
241
+ - spec/fixtures/vcr_cassettes/api/profile_extension/retrieve_profile_extension_records.yml
242
+ - spec/fixtures/vcr_cassettes/api/table/create.yml
243
+ - spec/fixtures/vcr_cassettes/api/table/create_with_pk.yml
244
+ - spec/fixtures/vcr_cassettes/api/table/delete.yml
245
+ - spec/fixtures/vcr_cassettes/api/table/delete_with_pk.yml
246
+ - spec/fixtures/vcr_cassettes/member/present1.yml
247
+ - spec/fixtures/vcr_cassettes/member/present2.yml
248
+ - spec/fixtures/vcr_cassettes/member/present3.yml
249
+ - spec/fixtures/vcr_cassettes/member/present4.yml
250
+ - spec/fixtures/vcr_cassettes/member/present5.yml
251
+ - spec/fixtures/vcr_cassettes/member/retrieve_profile_extension.yml
252
+ - spec/member_spec.rb
136
253
  - spec/spec_helper.rb
@@ -1,41 +0,0 @@
1
- require 'savon'
2
-
3
- class ResponsysApi
4
- attr_accessor :credentials, :client, :session_id, :jsession_id, :header
5
-
6
- def initialize
7
- settings = ResponsysApi.configuration.settings
8
- @credentials = {
9
- "tns:username" => settings[:username],
10
- "tns:password" => settings[:password]
11
- }
12
- @client = SavonApi.new(settings[:wsdl])
13
- login
14
- end
15
-
16
- def login
17
- response = client.run("login", credentials)
18
- establish_session_id(response)
19
- establish_jsession_id(response)
20
- set_session_credentials
21
- end
22
-
23
- def api_method(action, message = nil)
24
- response = client.run_with_credentials(action, message, jsession_id, header)
25
- ResponsysApi::Helper.format_response(response, action)
26
- end
27
-
28
- private
29
-
30
- def establish_session_id(login_response)
31
- @session_id = login_response.body[:login_response][:result][:session_id]
32
- end
33
-
34
- def establish_jsession_id(login_response)
35
- @jsession_id = login_response.http.cookies[0]
36
- end
37
-
38
- def set_session_credentials
39
- @header = { "SessionHeader" => { "tns:sessionId" => session_id } }
40
- end
41
- end
@@ -1,22 +0,0 @@
1
- class SavonApi
2
- attr_accessor :client
3
-
4
- def initialize(wsdl)
5
- # @client = Savon.client(log_level: :debug, log: false, pretty_print_xml: true, wsdl: wsdl)
6
-
7
- # should use this, the call above is only to help debug
8
- @client = Savon.client(wsdl: wsdl)
9
- end
10
-
11
- def run(method, message)
12
- @client.call(method.to_sym, message: message)
13
- end
14
-
15
- def run_with_credentials(method, message, cookie, header)
16
- @client.call(method.to_sym, message: message, cookies: cookie, soap_header: header)
17
- end
18
-
19
- def available_operations
20
- @client.operations
21
- end
22
- end
@@ -1,4 +0,0 @@
1
- require 'spec_helper.rb'
2
-
3
- describe ResponsysApi do
4
- end