bill_forward 1.2014.296 → 1.2015.183

Sign up to get free protection for your applications and to get access to all the features.
Files changed (77) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +29 -27
  3. data/.idea/compiler.xml +23 -23
  4. data/.idea/copyright/profiles_settings.xml +2 -2
  5. data/.idea/encodings.xml +5 -5
  6. data/.idea/inspectionProfiles/Project_Default.xml +10 -10
  7. data/.idea/inspectionProfiles/profiles_settings.xml +6 -6
  8. data/.idea/misc.xml +23 -23
  9. data/.idea/modules.xml +9 -9
  10. data/.idea/scopes/scope_settings.xml +4 -4
  11. data/.idea/vcs.xml +7 -7
  12. data/.rspec +1 -1
  13. data/Gemfile +13 -9
  14. data/LICENSE.md +22 -22
  15. data/README.md +285 -227
  16. data/Rakefile +73 -73
  17. data/bill_forward.gemspec +28 -29
  18. data/bill_forward.iml +28 -28
  19. data/lib/bill_forward/billing_entity.rb +295 -262
  20. data/lib/bill_forward/client.rb +350 -355
  21. data/lib/bill_forward/entities/account.rb +18 -18
  22. data/lib/bill_forward/entities/amendments/issue_invoice_amendment.rb +10 -0
  23. data/lib/bill_forward/entities/amendments/product_rate_plan_migration_amendment.rb +18 -0
  24. data/lib/bill_forward/entities/api_configuration.rb +12 -0
  25. data/lib/bill_forward/entities/invoice.rb +29 -3
  26. data/lib/bill_forward/entities/invoice_parts/taxation_link.rb +5 -5
  27. data/lib/bill_forward/entities/organisation.rb +36 -36
  28. data/lib/bill_forward/entities/payment_method.rb +4 -4
  29. data/lib/bill_forward/entities/payment_method_subscription_link.rb +5 -5
  30. data/lib/bill_forward/entities/pricing_component.rb +21 -21
  31. data/lib/bill_forward/entities/pricing_component_tier.rb +5 -5
  32. data/lib/bill_forward/entities/pricing_component_value.rb +5 -5
  33. data/lib/bill_forward/entities/pricing_component_value_migration_amendment_mapping.rb +31 -0
  34. data/lib/bill_forward/entities/product.rb +5 -5
  35. data/lib/bill_forward/entities/product_rate_plan.rb +43 -19
  36. data/lib/bill_forward/entities/profile.rb +14 -14
  37. data/lib/bill_forward/entities/refund.rb +5 -0
  38. data/lib/bill_forward/entities/role.rb +3 -3
  39. data/lib/bill_forward/entities/stripe_ach_token.rb +9 -0
  40. data/lib/bill_forward/entities/subscription.rb +83 -53
  41. data/lib/bill_forward/entities/subscription_charge.rb +14 -0
  42. data/lib/bill_forward/insertable_entity.rb +21 -31
  43. data/lib/bill_forward/mutable_entity.rb +26 -46
  44. data/lib/bill_forward/resource_path.rb +10 -10
  45. data/lib/bill_forward/type_check.rb +20 -20
  46. data/lib/bill_forward/version.rb +4 -4
  47. data/lib/bill_forward.rb +17 -17
  48. data/scratch/Gemfile +9 -0
  49. data/scratch/scratch.example.rb +8 -0
  50. data/spec/component/account_spec.rb +199 -199
  51. data/spec/component/billing_entity_spec.rb +152 -152
  52. data/spec/functional/account_spec.rb +24 -24
  53. data/spec/functional/bad_citizen/account_spec.rb +102 -102
  54. data/spec/functional/bad_citizen/credit_note_spec.rb +14 -13
  55. data/spec/functional/bad_citizen/payment_method_spec.rb +1 -1
  56. data/spec/functional/bad_citizen/product_rate_plan_migration_amendment_spec.rb +379 -0
  57. data/spec/functional/bad_citizen/product_rate_plan_spec.rb +103 -47
  58. data/spec/functional/bad_citizen/product_spec.rb +16 -9
  59. data/spec/functional/bad_citizen/situational/authorize_net_token_spec.rb +4 -0
  60. data/spec/functional/bad_citizen/situational/malordered_entity_spec.rb +1 -1
  61. data/spec/functional/bad_citizen/situational/payment_method_spec.rb +6 -1
  62. data/spec/functional/bad_citizen/situational/subscription_chargeable_spec.rb +96 -65
  63. data/spec/functional/bad_citizen/subscription_spec.rb +99 -60
  64. data/spec/functional/bad_citizen/subscription_with_credit_spec.rb +121 -91
  65. data/spec/functional/bad_citizen/unit_of_measure_spec.rb +14 -7
  66. data/spec/functional/client_spec.rb +23 -23
  67. data/spec/functional/organisation_spec.rb +27 -27
  68. data/spec/setup_test_constants.rb +72 -72
  69. data/spec/spec_helper.rb +10 -10
  70. data/spec/syntax/account_spec.rb +23 -23
  71. data/spec/syntax/billing_entity_spec.rb +92 -92
  72. data/tools/RSpec hardcoded.sublime-build +16 -0
  73. data/tools/RSpec.sublime-build +13 -0
  74. data/tools/Ruby legacy.sublime-build +7 -0
  75. data/tools/local_bundle_build.sh +8 -0
  76. data/tools/local_bundle_install.sh +9 -0
  77. metadata +30 -85
@@ -1,32 +1,22 @@
1
- module BillForward
2
- class InsertableEntity < BillingEntity
3
- def initialize(*args)
4
- raise AbstractInstantiateError.new('This abstract class cannot be instantiated!') if self.class == InsertableEntity
5
- super
6
- end
7
-
8
- class << self
9
- # Asks API to create a real instance of specified entity,
10
- # based on provided model.
11
- # @param options=nil [self] the Entity to create
12
- #
13
- # @return [self] The created Entity
14
- def create(entity = nil)
15
- entity = self.new if entity.nil?
16
- TypeCheck.verifyObj(self, entity, 'entity')
17
-
18
- serial = entity.serialize
19
- client = entity._client
20
-
21
- route = entity.class.resource_path.path
22
- endpoint = ''
23
- url_full = "#{route}/#{endpoint}"
24
-
25
- response = client.post_first(url_full, serial)
26
-
27
- created_entity = self.new(response, client)
28
- created_entity
29
- end
30
- end
31
- end
1
+ module BillForward
2
+ class InsertableEntity < BillingEntity
3
+ def initialize(*args)
4
+ raise AbstractInstantiateError.new('This abstract class cannot be instantiated!') if self.class == InsertableEntity
5
+ super
6
+ end
7
+
8
+ class << self
9
+ # Asks API to create a real instance of specified entity,
10
+ # based on provided model.
11
+ # @param options=nil [self] the Entity to create
12
+ #
13
+ # @return [self] The created Entity
14
+ def create(entity = nil)
15
+ entity = self.new if entity.nil?
16
+ TypeCheck.verifyObj(self, entity, 'entity')
17
+
18
+ self.request_first('post', '', entity, nil, entity._client)
19
+ end
20
+ end
21
+ end
32
22
  end
@@ -1,47 +1,27 @@
1
- module BillForward
2
- class MutableEntity < InsertableEntity
3
- def initialize(*args)
4
- raise AbstractInstantiateError.new('This abstract class cannot be instantiated!') if self.class == MutableEntity
5
- super
6
- end
7
-
8
- # Asks API to update existing instance of this entity,
9
- # based on current model.
10
- #
11
- # @return [self] The updated Entity
12
- def save()
13
- serial = serialize
14
- client = _client
15
-
16
- route = self.class.resource_path.path
17
- endpoint = ''
18
- url_full = "#{route}/#{endpoint}"
19
-
20
- response = client.put_first(url_full, serial)
21
-
22
- updated_entity = self.class.new(response, client)
23
- updated_entity
24
- end
25
-
26
- # Asks API to retire existing instance of this entity.
27
- # @note Many BillForward entities do not support RETIRE
28
- # @note As-yet untested
29
- #
30
- # @return [self] The retired Entity
31
- def delete()
32
- serial = serialize
33
- client = _client
34
-
35
- id = serial.id
36
-
37
- route = self.class.resource_path.path
38
- endpoint = ''
39
- url_full = "#{route}/#{endpoint}#{id}"
40
-
41
- response = client.retire_first(url_full)
42
-
43
- retired_entity = self.class.new(response, client)
44
- retired_entity
45
- end
46
- end
1
+ module BillForward
2
+ class MutableEntity < InsertableEntity
3
+ def initialize(*args)
4
+ raise AbstractInstantiateError.new('This abstract class cannot be instantiated!') if self.class == MutableEntity
5
+ super
6
+ end
7
+
8
+ # Asks API to update existing instance of this entity,
9
+ # based on current model.
10
+ #
11
+ # @return [self] The updated Entity
12
+ def save()
13
+ self.class.request_first('put', '', self, nil, _client)
14
+ end
15
+
16
+ # Asks API to retire existing instance of this entity.
17
+ # @note Many BillForward entities do not support RETIRE
18
+ # @note As-yet untested
19
+ #
20
+ # @return [self] The retired Entity
21
+ def delete()
22
+ self.class.request_first('delete', '', nil, _client)
23
+ end
24
+
25
+ alias_method :retire, :delete
26
+ end
47
27
  end
@@ -1,11 +1,11 @@
1
- module BillForward
2
- class ResourcePath
3
- attr_reader :path
4
- attr_reader :entity_name
5
-
6
- def initialize(path, entity_name)
7
- @path = path
8
- @entity_name = entity_name
9
- end
10
- end
1
+ module BillForward
2
+ class ResourcePath
3
+ attr_reader :path
4
+ attr_reader :entity_name
5
+
6
+ def initialize(path, entity_name)
7
+ @path = path
8
+ @entity_name = entity_name
9
+ end
10
+ end
11
11
  end
@@ -1,21 +1,21 @@
1
- module BillForward
2
- class TypeCheck
3
- # ensure that the provided object extends the expected class
4
- def self.verifyObj(expectedClass, obj, argName)
5
- expectedClassName = expectedClass.name
6
- actualClassName = obj.class.name
7
- raise TypeError.new("Expected instance of '#{expectedClassName}' at argument '#{argName}'. "+
8
- "Instead received: '#{actualClassName}'") unless obj.kind_of?(expectedClass) || obj.kind_of?(RSpec::Mocks::Double)
9
- end
10
- # ensure that the provided class extends the expected class
11
- def self.verifyClass(expectedClass, actualClass, argName)
12
- expectedClassName = expectedClass.name
13
- actualClassName = actualClass.name
14
- raise TypeError.new("Expected instance of '#{expectedClassName}' at argument '#{argName}'. "+
15
- "Instead received: '#{actualClassName}'") unless actualClass<=expectedClass || actualClass<=RSpec::Mocks::Double
16
- end
17
- end
18
-
19
- class AbstractInstantiateError < StandardError
20
- end
1
+ module BillForward
2
+ class TypeCheck
3
+ # ensure that the provided object extends the expected class
4
+ def self.verifyObj(expectedClass, obj, argName)
5
+ expectedClassName = expectedClass.name
6
+ actualClassName = obj.class.name
7
+ raise TypeError.new("Expected instance of '#{expectedClassName}' at argument '#{argName}'. "+
8
+ "Instead received: '#{actualClassName}'") unless obj.kind_of?(expectedClass) || (defined?(RSpec) && obj.kind_of?(RSpec::Mocks::Double))
9
+ end
10
+ # ensure that the provided class extends the expected class
11
+ def self.verifyClass(expectedClass, actualClass, argName)
12
+ expectedClassName = expectedClass.name
13
+ actualClassName = actualClass.name
14
+ raise TypeError.new("Expected instance of '#{expectedClassName}' at argument '#{argName}'. "+
15
+ "Instead received: '#{actualClassName}'") unless actualClass<=expectedClass || (defined?(RSpec) && actualClass<=RSpec::Mocks::Double)
16
+ end
17
+ end
18
+
19
+ class AbstractInstantiateError < StandardError
20
+ end
21
21
  end
@@ -1,4 +1,4 @@
1
- module BillForward
2
- # in an rspec run, the gemspec and bill_forward.rb loader will both visit this
3
- VERSION = "1.2014.296" unless const_defined?(:VERSION)
4
- end
1
+ module BillForward
2
+ # in an rspec run, the gemspec and bill_forward.rb loader will both visit this
3
+ VERSION = "1.2015.183" unless const_defined?(:VERSION)
4
+ end
data/lib/bill_forward.rb CHANGED
@@ -1,18 +1,18 @@
1
- require 'rest-client'
2
- require 'json'
3
- # used for escaping query parameters
4
- require 'erb'
5
-
6
- # Rails extensions
7
- # 'indifferent hashes' are used to enable string access to entities unserialized with symbol keys
8
- require 'active_support/core_ext/hash/indifferent_access'
9
- # we need ordered hashes because API requires '@type' to be first key in object
10
- require 'active_support/ordered_hash'
11
- # provides 'blank?' function
12
- require 'active_support/core_ext/string'
13
-
14
- # requirer that negotiates dependency order, relative pathing
15
- require 'require_all'
16
-
17
- # require all ruby files in relative directory 'bill_forward' and all its subdirectories
1
+ require 'rest-client'
2
+ require 'json'
3
+ # used for escaping query parameters
4
+ require 'erb'
5
+
6
+ # Rails extensions
7
+ # 'indifferent hashes' are used to enable string access to entities unserialized with symbol keys
8
+ require 'active_support/core_ext/hash/indifferent_access'
9
+ # we need ordered hashes because API requires '@type' to be first key in object
10
+ require 'active_support/ordered_hash'
11
+ # provides 'blank?' function
12
+ require 'active_support/core_ext/string'
13
+
14
+ # requirer that negotiates dependency order, relative pathing
15
+ require 'require_all'
16
+
17
+ # require all ruby files in relative directory 'bill_forward' and all its subdirectories
18
18
  require_rel 'bill_forward'
data/scratch/Gemfile ADDED
@@ -0,0 +1,9 @@
1
+ if Gem::Version.new(RUBY_VERSION) < Gem::Version.new('1.9.3')
2
+ gem 'i18n', '< 0.7'
3
+ gem 'rest-client', '~> 1.6.8'
4
+ gem 'activesupport', '~> 3.2'
5
+ else
6
+ gem 'activesupport'
7
+ end
8
+
9
+ gem 'bill_forward', :path => '../'
@@ -0,0 +1,8 @@
1
+ require 'bundler/setup'
2
+ require 'bill_forward'
3
+
4
+ my_client = BillForward::Client.new(
5
+ :host => "API URL goes here",
6
+ :api_token => "API token goes here"
7
+ )
8
+ BillForward::Client.default_client = my_client
@@ -1,200 +1,200 @@
1
- require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
-
3
- describe BillForward::Account do
4
- before :all do
5
- @client = BillForwardTest::TEST_CLIENT
6
- BillForward::Client.default_client = @client
7
- end
8
- before :each do
9
- # skip OAuth request
10
- allow_any_instance_of(BillForward::Client).to receive(:get_token).and_return('fake token')
11
- end
12
- describe '::get_by_id' do
13
- context 'where account does not exist' do
14
- let(:RestClient) { double :RestClient }
15
- it "gets empty list" do
16
- response = double
17
- allow(response).to receive(:to_str).and_return(canned_noresults)
18
- allow(RestClient::Request).to receive(:execute).and_return(response)
19
-
20
- expect{BillForward::Account.get_by_id 'anything'}.to raise_error(IndexError)
21
- end
22
- end
23
- context 'where account exists' do
24
- it "gets the account" do
25
- account_id = '74DA7D63-EAEB-431B-9745-76F9109FD842'
26
-
27
- response = double
28
- allow(response).to receive(:to_str).and_return(canned_account_get)
29
- allow(RestClient::Request).to receive(:execute).and_return(response)
30
-
31
- account = BillForward::Account.get_by_id account_id
32
-
33
- expect(account.id).to eq(account_id)
34
- end
35
- end
36
- end
37
- describe '::create' do
38
- context 'upon creating minimal account' do
39
- let(:RestClient) { double :RestClient }
40
- it "can get property" do
41
- response = double
42
- allow(response).to receive(:to_str).and_return(canned_account_create_minimal)
43
- allow(RestClient::Request).to receive(:execute).and_return(response)
44
-
45
- created_account = BillForward::Account.create
46
- expect(created_account['@type']).to eq(BillForward::Account.resource_path.entity_name)
47
- end
48
- end
49
- context 'upon creating account with profile' do
50
- let(:RestClient) { double :RestClient }
51
- email = 'always@testing.is.moe'
52
- before :each do
53
- profile = BillForward::Profile.new({
54
- 'email' => email,
55
- 'firstName' => 'Test',
56
- })
57
- account = BillForward::Account.new({
58
- 'profile' => profile
59
- })
60
- response = double
61
- allow(response).to receive(:to_str).and_return(canned_account_create_with_profile)
62
- allow(RestClient::Request).to receive(:execute).and_return(response)
63
-
64
- @created_account = BillForward::Account.create account
65
- end
66
- subject (:account) { @created_account }
67
- it "can get property" do
68
- expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
69
- end
70
- it "has profile" do
71
- profile = account.profile
72
- expect(profile.email).to eq(email)
73
- end
74
- end
75
- end
76
- end
77
-
78
- def canned_noresults
79
- '{
80
- "executionTime": 1070093,
81
- "results": []
82
- }'
83
- end
84
-
85
- def canned_account_create_with_profile
86
- '{
87
- "results": [
88
- {
89
- "profile": {
90
- "accountID": "5037E4EF-9DD1-4BC3-8920-425D9159C41A",
91
- "updated": "2014-09-18T22:29:15.079Z",
92
- "email": "always@testing.is.moe",
93
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
94
- "id": "C7A63931-709D-4F1A-B8F9-B5EC0E6C2D29",
95
- "created": "2014-09-18T22:29:15.079Z",
96
- "addresses": [
97
-
98
- ],
99
- "firstName": "Test",
100
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60"
101
- },
102
- "updated": "2014-09-18T22:29:14.783Z",
103
- "deleted": false,
104
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
105
- "id": "5037E4EF-9DD1-4BC3-8920-425D9159C41A",
106
- "crmID": null,
107
- "created": "2014-09-18T22:29:14.783Z",
108
- "roles": [
109
-
110
- ],
111
- "paymentMethods": [
112
-
113
- ],
114
- "successfulSubscriptions": 0,
115
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
116
- "@type": "account"
117
- }
118
- ],
119
- "executionTime": 647946
120
- }'
121
- end
122
-
123
- def canned_account_create_minimal
124
- '{
125
- "results": [
126
- {
127
- "updated": "2014-09-18T18:27:22.258Z",
128
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
129
- "id": "904DAE81-B63C-4F25-86C5-E1A1CDCEEB88",
130
- "@type": "account",
131
- "deleted": false,
132
- "successfulSubscriptions": 0,
133
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
134
- "crmID": null,
135
- "paymentMethods": [
136
-
137
- ],
138
- "created": "2014-09-18T18:27:22.258Z",
139
- "roles": [
140
-
141
- ]
142
- }
143
- ],
144
- "executionTime": 492653
145
- }'
146
- end
147
-
148
- def canned_account_get
149
- '{
150
- "executionTime": 1070093,
151
- "results": [
152
- {
153
- "successfulSubscriptions": 0,
154
- "@type": "account",
155
- "roles": [
156
-
157
- ],
158
- "profile": {
159
- "firstName": "Test",
160
- "addresses": [
161
- {
162
- "landline": "02000000000",
163
- "addressLine3": "address line 3",
164
- "addressLine2": "address line 2",
165
- "addressLine1": "address line 1",
166
- "country": "United Kingdom",
167
- "deleted": false,
168
- "city": "London",
169
- "profileID": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
170
- "id": "34B5A980-A133-4B5F-9045-F1A41F20F2D6",
171
- "primaryAddress": true,
172
- "province": "London",
173
- "created": "2014-09-04T17:43:44Z",
174
- "postcode": "SW1 1AS",
175
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
176
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
177
- }
178
- ],
179
- "id": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
180
- "updated": "2014-09-04T17:43:44Z",
181
- "email": "always@testing.is.moe",
182
- "created": "2014-09-04T17:43:44Z",
183
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
184
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
185
- "accountID": "74DA7D63-EAEB-431B-9745-76F9109FD842"
186
- },
187
- "deleted": false,
188
- "crmID": null,
189
- "id": "74DA7D63-EAEB-431B-9745-76F9109FD842",
190
- "updated": "2014-09-04T17:43:43Z",
191
- "created": "2014-09-04T17:43:43Z",
192
- "paymentMethods": [
193
-
194
- ],
195
- "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
196
- "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
197
- }
198
- ]
199
- }'
1
+ require File.join(File.expand_path(File.dirname(__FILE__)), "..", "spec_helper")
2
+
3
+ describe BillForward::Account do
4
+ before :all do
5
+ @client = BillForwardTest::TEST_CLIENT
6
+ BillForward::Client.default_client = @client
7
+ end
8
+ before :each do
9
+ # skip OAuth request
10
+ allow_any_instance_of(BillForward::Client).to receive(:get_token).and_return('fake token')
11
+ end
12
+ describe '::get_by_id' do
13
+ context 'where account does not exist' do
14
+ let(:RestClient) { double :RestClient }
15
+ it "gets empty list" do
16
+ response = double
17
+ allow(response).to receive(:to_str).and_return(canned_noresults)
18
+ allow(RestClient::Request).to receive(:execute).and_return(response)
19
+
20
+ expect{BillForward::Account.get_by_id 'anything'}.to raise_error(IndexError)
21
+ end
22
+ end
23
+ context 'where account exists' do
24
+ it "gets the account" do
25
+ account_id = '74DA7D63-EAEB-431B-9745-76F9109FD842'
26
+
27
+ response = double
28
+ allow(response).to receive(:to_str).and_return(canned_account_get)
29
+ allow(RestClient::Request).to receive(:execute).and_return(response)
30
+
31
+ account = BillForward::Account.get_by_id account_id
32
+
33
+ expect(account.id).to eq(account_id)
34
+ end
35
+ end
36
+ end
37
+ describe '::create' do
38
+ context 'upon creating minimal account' do
39
+ let(:RestClient) { double :RestClient }
40
+ it "can get property" do
41
+ response = double
42
+ allow(response).to receive(:to_str).and_return(canned_account_create_minimal)
43
+ allow(RestClient::Request).to receive(:execute).and_return(response)
44
+
45
+ created_account = BillForward::Account.create
46
+ expect(created_account['@type']).to eq(BillForward::Account.resource_path.entity_name)
47
+ end
48
+ end
49
+ context 'upon creating account with profile' do
50
+ let(:RestClient) { double :RestClient }
51
+ email = 'always@testing.is.moe'
52
+ before :each do
53
+ profile = BillForward::Profile.new({
54
+ 'email' => email,
55
+ 'firstName' => 'Test',
56
+ })
57
+ account = BillForward::Account.new({
58
+ 'profile' => profile
59
+ })
60
+ response = double
61
+ allow(response).to receive(:to_str).and_return(canned_account_create_with_profile)
62
+ allow(RestClient::Request).to receive(:execute).and_return(response)
63
+
64
+ @created_account = BillForward::Account.create account
65
+ end
66
+ subject (:account) { @created_account }
67
+ it "can get property" do
68
+ expect(account['@type']).to eq(BillForward::Account.resource_path.entity_name)
69
+ end
70
+ it "has profile" do
71
+ profile = account.profile
72
+ expect(profile.email).to eq(email)
73
+ end
74
+ end
75
+ end
76
+ end
77
+
78
+ def canned_noresults
79
+ '{
80
+ "executionTime": 1070093,
81
+ "results": []
82
+ }'
83
+ end
84
+
85
+ def canned_account_create_with_profile
86
+ '{
87
+ "results": [
88
+ {
89
+ "profile": {
90
+ "accountID": "5037E4EF-9DD1-4BC3-8920-425D9159C41A",
91
+ "updated": "2014-09-18T22:29:15.079Z",
92
+ "email": "always@testing.is.moe",
93
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
94
+ "id": "C7A63931-709D-4F1A-B8F9-B5EC0E6C2D29",
95
+ "created": "2014-09-18T22:29:15.079Z",
96
+ "addresses": [
97
+
98
+ ],
99
+ "firstName": "Test",
100
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60"
101
+ },
102
+ "updated": "2014-09-18T22:29:14.783Z",
103
+ "deleted": false,
104
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
105
+ "id": "5037E4EF-9DD1-4BC3-8920-425D9159C41A",
106
+ "crmID": null,
107
+ "created": "2014-09-18T22:29:14.783Z",
108
+ "roles": [
109
+
110
+ ],
111
+ "paymentMethods": [
112
+
113
+ ],
114
+ "successfulSubscriptions": 0,
115
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
116
+ "@type": "account"
117
+ }
118
+ ],
119
+ "executionTime": 647946
120
+ }'
121
+ end
122
+
123
+ def canned_account_create_minimal
124
+ '{
125
+ "results": [
126
+ {
127
+ "updated": "2014-09-18T18:27:22.258Z",
128
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
129
+ "id": "904DAE81-B63C-4F25-86C5-E1A1CDCEEB88",
130
+ "@type": "account",
131
+ "deleted": false,
132
+ "successfulSubscriptions": 0,
133
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
134
+ "crmID": null,
135
+ "paymentMethods": [
136
+
137
+ ],
138
+ "created": "2014-09-18T18:27:22.258Z",
139
+ "roles": [
140
+
141
+ ]
142
+ }
143
+ ],
144
+ "executionTime": 492653
145
+ }'
146
+ end
147
+
148
+ def canned_account_get
149
+ '{
150
+ "executionTime": 1070093,
151
+ "results": [
152
+ {
153
+ "successfulSubscriptions": 0,
154
+ "@type": "account",
155
+ "roles": [
156
+
157
+ ],
158
+ "profile": {
159
+ "firstName": "Test",
160
+ "addresses": [
161
+ {
162
+ "landline": "02000000000",
163
+ "addressLine3": "address line 3",
164
+ "addressLine2": "address line 2",
165
+ "addressLine1": "address line 1",
166
+ "country": "United Kingdom",
167
+ "deleted": false,
168
+ "city": "London",
169
+ "profileID": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
170
+ "id": "34B5A980-A133-4B5F-9045-F1A41F20F2D6",
171
+ "primaryAddress": true,
172
+ "province": "London",
173
+ "created": "2014-09-04T17:43:44Z",
174
+ "postcode": "SW1 1AS",
175
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
176
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
177
+ }
178
+ ],
179
+ "id": "1B07A310-8B0F-4CFA-B2CF-48D206DC79C3",
180
+ "updated": "2014-09-04T17:43:44Z",
181
+ "email": "always@testing.is.moe",
182
+ "created": "2014-09-04T17:43:44Z",
183
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
184
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3",
185
+ "accountID": "74DA7D63-EAEB-431B-9745-76F9109FD842"
186
+ },
187
+ "deleted": false,
188
+ "crmID": null,
189
+ "id": "74DA7D63-EAEB-431B-9745-76F9109FD842",
190
+ "updated": "2014-09-04T17:43:43Z",
191
+ "created": "2014-09-04T17:43:43Z",
192
+ "paymentMethods": [
193
+
194
+ ],
195
+ "changedBy": "7872F2F4-ED96-4038-BC82-39F7DDFECE60",
196
+ "organizationID": "F60667D7-583A-4A01-B4DC-F74CC45ACAE3"
197
+ }
198
+ ]
199
+ }'
200
200
  end