ofsys 0.0.3 → 0.0.4

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: f999d360b1138a8187c4c4692ddd0f3bb57e5aff
4
- data.tar.gz: bef1207e4b668e54f1aacec44d687e558b7608bf
3
+ metadata.gz: 572d32bee53f2323a2cf639b7f97d67bd7e86dc2
4
+ data.tar.gz: 14ad19ce04ce9d0c5f415c62c936b3093168dd36
5
5
  SHA512:
6
- metadata.gz: 241eeb2fe1c96bbee9cea8780f9bfd217603627fed69b0b5cdbd0cd2f5657f20309d01e05723c2b4627245df02521b6adaecdfb6f2ecfe7eeae261abacdd30ac
7
- data.tar.gz: 68e8c432d75459da5784b9648eac16c5abc81cf8c69b6062ac931489bd293803529036fe7cdb6711d6dc6f935b2f4503164351924c48daf981d5e866e60b0700
6
+ metadata.gz: 9da3b4c6039f4333cf7675f7ad0a5eee7e783acfbc4bfa352b585f9b3446e635a23561c67ea6ddef9bdab5cd6c1849a7600f3972b227ba804aa569b37f87f8de
7
+ data.tar.gz: 0281fb29afd7c8161ce84884997357fb16c23330e485b5159b130fc84340776ac9a3f7906fb5f2bfc90220c76924382c12297c3ae5422a103bf49d367cbe3b5d
data/README.md ADDED
@@ -0,0 +1,26 @@
1
+ [![Build Status](https://travis-ci.org/aishek/ofsys.png)](https://travis-ci.org/aishek/ofsys)
2
+ [![Code Climate](https://codeclimate.com/github/aishek/ofsys.png)](https://codeclimate.com/github/aishek/ofsys)
3
+ [![Coverage Status](https://coveralls.io/repos/aishek/ofsys/badge.png)](https://coveralls.io/r/aishek/ofsys)
4
+ [![Dependency Status](https://gemnasium.com/aishek/ofsys.png)](https://gemnasium.com/aishek/ofsys)
5
+ [![Gem Version](https://badge.fury.io/rb/ofsys.png)](http://badge.fury.io/rb/ofsys)
6
+
7
+ Ofsys
8
+ ====================
9
+
10
+ ## Note on Patches / Pull Requests
11
+
12
+ * Fork the project.
13
+ * Make your feature addition or bug fix.
14
+ * Send me a pull request. Bonus points for topic branches.
15
+
16
+ ## License
17
+
18
+ ofsys is free software, and may be redistributed under the terms specified in the LICENSE file.
19
+
20
+ ## Credits
21
+
22
+ Gem ofsys is maintained by [Cifronomika](http://cifronomika.ru/).
23
+
24
+ Contributors:
25
+
26
+ * [Alexandr Borisov](https://github.com/aishek)
@@ -0,0 +1,7 @@
1
+ module Ofsys
2
+ module Request
3
+ class RelationalTablesDelete < Ofsys::Request::Base
4
+ ENDPOINT = "#{ENDPOINT_BASE}/relationaltables.ashx?method=Delete".freeze
5
+ end
6
+ end
7
+ end
@@ -0,0 +1,7 @@
1
+ module Ofsys
2
+ module Request
3
+ class RelationalTablesMerge < Ofsys::Request::Base
4
+ ENDPOINT = "#{ENDPOINT_BASE}/relationaltables.ashx?method=Merge".freeze
5
+ end
6
+ end
7
+ end
data/lib/ofsys/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Ofsys
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
@@ -12,7 +12,7 @@ describe Ofsys::Request::ContactsDelete do
12
12
  Name: 'f_EMail'
13
13
  },
14
14
  TypeOperator: 'Equal',
15
- ComparisonValue: 'aishek@gmail.com'
15
+ ComparisonValue: 'user@example.com'
16
16
  },
17
17
  MaxRows: 1
18
18
  }
@@ -9,10 +9,10 @@ describe Ofsys::Request::ContactsMerge do
9
9
  Records: [
10
10
  {
11
11
  ID: {
12
- key_f_EMail: 'aishek@gmail.com'
12
+ key_f_EMail: 'user@example.com'
13
13
  },
14
14
  Data: {
15
- f_EMail: 'aishek@gmail.com'
15
+ f_EMail: 'user@example.com'
16
16
  }
17
17
  }
18
18
  ],
@@ -37,25 +37,22 @@ describe Ofsys::Request::ContactsMerge do
37
37
  'UpdatedRecords' => 1,
38
38
  'Records' => [
39
39
  {
40
- 'IdRecord' => 15,
41
40
  'Status' => 'Updated',
42
41
  'ValidationResult' => 'OK',
43
42
  'Message' => nil,
44
43
  'ID' => {
45
- 'key_f_EMail' => 'aishek@gmail.com'
44
+ 'key_f_EMail' => 'user@example.com'
46
45
  },
47
46
  'Data' => nil,
48
47
  'Record' => nil
49
48
  }
50
- ],
51
- 'idRequest' => 18945355,
52
- 'Trace' => "Beginning request (04:15:25)\r\n\tchecking OFSYS User authentication: False\r\n\tchecking Dialog Insight administrator: False\r\nTargeted service: Contacts.Merge\r\nDeserializing JSON...\r\nDeserializing JSON completed\r\nValidating parameters...\r\nRecords count: 1\r\nRecords candidates for insert: 1\r\nRecords candidates for update: 1\r\nValidating parameterscompleted with success\r\nExecuting method...\r\n\tRecords bulked: 1\r\n\tRecords matched by PK: 1\r\n\tRecords dupes, source versus source: 0\r\n\tRecords dupes, source versus target: 0\r\n\tRecords updated: 1\r\n\tRecords created: 0\r\n\tEMails changed: 0\r\n\tOptins field changed: no flag involved\r\nExecuting method completed with success"
49
+ ]
53
50
  }
54
51
  end
55
52
 
56
53
  it 'performs correct request with passed data' do
57
54
  VCR.use_cassette('contacts_merge') do
58
- expect(described_class.new.perform(data)).to eq(result)
55
+ expect(described_class.new.perform(data)).to include_partial_hash(result)
59
56
  end
60
57
  end
61
58
  end
@@ -0,0 +1,55 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://ofsys.com/webservices/ofc4/contacts.ashx?method=Merge
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"Records":[{"ID":{"key_f_EMail":"user@example.com"},"Data":{"f_EMail":"user@example.com"}}],"MergeOptions":{"AllowInsert":true,"AllowUpdate":true,"SkipDuplicateRecords":false,"SkipUnmatchedRecords":false,"ReturnRecordsOnSuccess":false,"ReturnRecordsOnError":false,"FieldOptions":null},"AuthKey":{"Key":"aQTxvqkkYtWt2Q39edLWE0EdzeNWzxH8","idKey":"13103"},"idProject":"5781"}'
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - private
23
+ Content-Length:
24
+ - '1121'
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Server:
28
+ - Microsoft-IIS/8.5
29
+ X-Powered-By:
30
+ - ASP.NET
31
+ X-Ua-Compatible:
32
+ - IE=Edge
33
+ Date:
34
+ - Tue, 09 Dec 2014 08:54:14 GMT
35
+ body:
36
+ encoding: UTF-8
37
+ string: "{\r\n \"Success\": true,\r\n \"ErrorCode\": null,\r\n \"ErrorMessage\":
38
+ null,\r\n \"CreatedRecords\": 0,\r\n \"UpdatedRecords\": 1,\r\n \"Records\":
39
+ [\r\n {\r\n \"IdRecord\": 2,\r\n \"Status\": \"Updated\",\r\n
40
+ \ \"ValidationResult\": \"OK\",\r\n \"Message\": null,\r\n \"ID\":
41
+ {\r\n \"key_f_EMail\": \"user@example.com\"\r\n },\r\n \"Data\":
42
+ null,\r\n \"Record\": null\r\n }\r\n ],\r\n \"idRequest\": 21378949,\r\n
43
+ \ \"Trace\": \"Beginning request (03:54:15)\\r\\n\\tchecking OFSYS User authentication:
44
+ False\\r\\n\\tchecking Dialog Insight administrator: False\\r\\nTargeted service:
45
+ Contacts.Merge\\r\\nDeserializing JSON...\\r\\nDeserializing JSON completed\\r\\nValidating
46
+ parameters...\\r\\nRecords count: 1\\r\\nRecords candidates for insert: 1\\r\\nRecords
47
+ candidates for update: 1\\r\\nValidating parameterscompleted with success\\r\\nExecuting
48
+ method...\\r\\n\\tRecords bulked: 1\\r\\n\\tRecords matched by PK: 1\\r\\n\\tRecords
49
+ dupes, source versus source: 0\\r\\n\\tRecords dupes, source versus target:
50
+ 0\\r\\n\\tRecords updated: 1\\r\\n\\tRecords created: 0\\r\\n\\tEMails changed:
51
+ 0\\r\\n\\tOptins field changed: no flag involved\\r\\nExecuting method completed
52
+ with success\"\r\n}"
53
+ http_version:
54
+ recorded_at: Tue, 09 Dec 2014 08:54:16 GMT
55
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,46 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: post
5
+ uri: https://ofsys.com/webservices/ofc4/sendings.ashx?method=SendSingle
6
+ body:
7
+ encoding: UTF-8
8
+ string: '{"idMessage":639093,"contactFilter":{"Mode":"Clauses","TableClauses":[{"TableCode":"Contact","Clause":{"$type":"FieldClause","Field":{"TableCode":"Contact","Name":"f_EMail"},"TypeOperator":"Equal","ComparisonValue":"user@example.com"}}]},"AuthKey":{"Key":"aQTxvqkkYtWt2Q39edLWE0EdzeNWzxH8","idKey":"13103"},"idProject":"5781"}'
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Cache-Control:
22
+ - private
23
+ Content-Length:
24
+ - '502'
25
+ Content-Type:
26
+ - application/json; charset=utf-8
27
+ Server:
28
+ - Microsoft-IIS/8.5
29
+ X-Powered-By:
30
+ - ASP.NET
31
+ X-Ua-Compatible:
32
+ - IE=Edge
33
+ Date:
34
+ - Tue, 09 Dec 2014 09:41:20 GMT
35
+ body:
36
+ encoding: UTF-8
37
+ string: "{\r\n \"Success\": true,\r\n \"ErrorCode\": null,\r\n \"ErrorMessage\":
38
+ null,\r\n \"AffectedContacts\": 1,\r\n \"idRequest\": 21390791,\r\n \"Trace\":
39
+ \"Beginning request (04:41:21)\\r\\n\\tchecking OFSYS User authentication:
40
+ False\\r\\n\\tchecking Dialog Insight administrator: False\\r\\nTargeted service:
41
+ Sendings.SendSingle\\r\\nDeserializing JSON...\\r\\nDeserializing JSON completed\\r\\nValidating
42
+ parameters...\\r\\nValidating parameterscompleted with success\\r\\nExecuting
43
+ method...\\r\\nExecuting method completed with success\"\r\n}"
44
+ http_version:
45
+ recorded_at: Tue, 09 Dec 2014 09:41:21 GMT
46
+ recorded_with: VCR 2.9.3
@@ -6,7 +6,7 @@ describe Ofsys::Request::SendingsSendSingle do
6
6
 
7
7
  let(:data) do
8
8
  {
9
- idMessage: 538731,
9
+ idMessage: 639093,
10
10
  contactFilter: {
11
11
  Mode: 'Clauses',
12
12
  TableClauses: [
@@ -19,7 +19,7 @@ describe Ofsys::Request::SendingsSendSingle do
19
19
  Name: 'f_EMail'
20
20
  },
21
21
  TypeOperator: 'Equal',
22
- ComparisonValue: 'ab+45@cifronomika.ru'
22
+ ComparisonValue: 'user@example.com'
23
23
  }
24
24
  }
25
25
  ]
@@ -32,15 +32,13 @@ describe Ofsys::Request::SendingsSendSingle do
32
32
  'Success' => true,
33
33
  'ErrorCode' => nil,
34
34
  'ErrorMessage' => nil,
35
- 'AffectedContacts' => 1,
36
- 'idRequest' => 18947426,
37
- 'Trace' => "Beginning request (04:30:24)\r\n\tchecking OFSYS User authentication: False\r\n\tchecking Dialog Insight administrator: False\r\nTargeted service: Sendings.SendSingle\r\nDeserializing JSON...\r\nDeserializing JSON completed\r\nValidating parameters...\r\nValidating parameterscompleted with success\r\nExecuting method...\r\nExecuting method completed with success"
35
+ 'AffectedContacts' => 1
38
36
  }
39
37
  end
40
38
 
41
39
  it 'performs correct request with passed data' do
42
40
  VCR.use_cassette('sendings_send_single') do
43
- expect(described_class.new.perform(data)).to eq(result)
41
+ expect(described_class.new.perform(data)).to include_partial_hash(result)
44
42
  end
45
43
  end
46
44
  end
data/spec/spec_helper.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  ENV['RAILS_ENV'] ||= 'test'
2
+ require 'rspec-partial-hash'
2
3
 
3
4
  require 'ofsys'
4
5
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ofsys
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
  - Alexandr Borisov
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-12-07 00:00:00.000000000 Z
12
+ date: 2014-12-09 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: yajl-ruby
@@ -25,6 +25,20 @@ dependencies:
25
25
  - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
+ - !ruby/object:Gem::Dependency
29
+ name: activesupport
30
+ requirement: !ruby/object:Gem::Requirement
31
+ requirements:
32
+ - - ">="
33
+ - !ruby/object:Gem::Version
34
+ version: '0'
35
+ type: :development
36
+ prerelease: false
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - ">="
40
+ - !ruby/object:Gem::Version
41
+ version: '0'
28
42
  - !ruby/object:Gem::Dependency
29
43
  name: rspec
30
44
  requirement: !ruby/object:Gem::Requirement
@@ -39,6 +53,20 @@ dependencies:
39
53
  - - ">="
40
54
  - !ruby/object:Gem::Version
41
55
  version: '0'
56
+ - !ruby/object:Gem::Dependency
57
+ name: rspec-partial-hash
58
+ requirement: !ruby/object:Gem::Requirement
59
+ requirements:
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '0'
63
+ type: :development
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - ">="
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
42
70
  - !ruby/object:Gem::Dependency
43
71
  name: webmock
44
72
  requirement: !ruby/object:Gem::Requirement
@@ -103,6 +131,7 @@ executables: []
103
131
  extensions: []
104
132
  extra_rdoc_files: []
105
133
  files:
134
+ - README.md
106
135
  - Rakefile
107
136
  - lib/ofsys.rb
108
137
  - lib/ofsys/config.rb
@@ -110,11 +139,15 @@ files:
110
139
  - lib/ofsys/request/base.rb
111
140
  - lib/ofsys/request/contacts_delete.rb
112
141
  - lib/ofsys/request/contacts_merge.rb
142
+ - lib/ofsys/request/relational_tables_delete.rb
143
+ - lib/ofsys/request/relational_tables_merge.rb
113
144
  - lib/ofsys/request/sendings_send_single.rb
114
145
  - lib/ofsys/version.rb
115
146
  - spec/config_spec.rb
116
147
  - spec/contacts_delete_spec.rb
117
148
  - spec/contacts_merge_spec.rb
149
+ - spec/fixtures/vcr_cassettes/contacts_merge.yml
150
+ - spec/fixtures/vcr_cassettes/sendings_send_single.yml
118
151
  - spec/send_single_spec.rb
119
152
  - spec/spec_helper.rb
120
153
  - spec/support/configure_helper.rb
@@ -144,6 +177,8 @@ specification_version: 4
144
177
  summary: Provides interface for ofsys.com (inteligentemails.com) service API
145
178
  test_files:
146
179
  - spec/contacts_delete_spec.rb
180
+ - spec/fixtures/vcr_cassettes/contacts_merge.yml
181
+ - spec/fixtures/vcr_cassettes/sendings_send_single.yml
147
182
  - spec/config_spec.rb
148
183
  - spec/spec_helper.rb
149
184
  - spec/support/configure_helper.rb