textmagic-ruby 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +15 -0
- data/.gitignore +11 -0
- data/.rspec +2 -0
- data/.travis.yml +4 -0
- data/Gemfile +9 -0
- data/LICENSE.txt +21 -0
- data/Makefile +8 -0
- data/README.md +41 -0
- data/Rakefile +10 -0
- data/conf/cacert.pem +3988 -0
- data/examples/bulk_examples.rb +24 -0
- data/examples/chat_examples.rb +30 -0
- data/examples/contact_examples.rb +116 -0
- data/examples/custom_field_examples.rb +78 -0
- data/examples/invoice_examples.rb +26 -0
- data/examples/list_examples.rb +98 -0
- data/examples/message_examples.rb +75 -0
- data/examples/number_examples.rb +72 -0
- data/examples/reply_examples.rb +32 -0
- data/examples/schedule_examples.rb +44 -0
- data/examples/senderid_examples.rb +52 -0
- data/examples/session_examples.rb +51 -0
- data/examples/subaccount_examples.rb +53 -0
- data/examples/template_examples.rb +61 -0
- data/examples/unsubscriber_examples.rb +56 -0
- data/examples/user_examples.rb +105 -0
- data/lib/textmagic-ruby.rb +31 -0
- data/lib/textmagic-ruby/rest/bulks.rb +89 -0
- data/lib/textmagic-ruby/rest/chats.rb +147 -0
- data/lib/textmagic-ruby/rest/client.rb +128 -0
- data/lib/textmagic-ruby/rest/contacts.rb +174 -0
- data/lib/textmagic-ruby/rest/custom_fields.rb +120 -0
- data/lib/textmagic-ruby/rest/errors.rb +14 -0
- data/lib/textmagic-ruby/rest/instance_resource.rb +33 -0
- data/lib/textmagic-ruby/rest/invoices.rb +73 -0
- data/lib/textmagic-ruby/rest/list_resource.rb +64 -0
- data/lib/textmagic-ruby/rest/lists.rb +166 -0
- data/lib/textmagic-ruby/rest/messages.rb +172 -0
- data/lib/textmagic-ruby/rest/numbers.rb +164 -0
- data/lib/textmagic-ruby/rest/paginate_resource.rb +20 -0
- data/lib/textmagic-ruby/rest/replies.rb +85 -0
- data/lib/textmagic-ruby/rest/scheduleds.rb +91 -0
- data/lib/textmagic-ruby/rest/senderids.rb +114 -0
- data/lib/textmagic-ruby/rest/sessions.rb +109 -0
- data/lib/textmagic-ruby/rest/subaccounts.rb +135 -0
- data/lib/textmagic-ruby/rest/templates.rb +107 -0
- data/lib/textmagic-ruby/rest/unsubscribers.rb +85 -0
- data/lib/textmagic-ruby/rest/users.rb +202 -0
- data/lib/textmagic-ruby/rest/utils.rb +48 -0
- data/lib/textmagic-ruby/rest/version.rb +5 -0
- data/spec/rest/client_spec.rb +57 -0
- data/spec/rest/contact_spec.rb +36 -0
- data/spec/rest/custom_fields_spec.rb +36 -0
- data/spec/rest/instance_resource_spec.rb +17 -0
- data/spec/rest/invoice_spec.rb +56 -0
- data/spec/rest/lists_spec.rb +35 -0
- data/spec/rest/message_spec.rb +40 -0
- data/spec/rest/numbers_spec.rb +66 -0
- data/spec/rest/reply_spec.rb +43 -0
- data/spec/rest/scheduled_spec.rb +43 -0
- data/spec/rest/senderid_spec.rb +39 -0
- data/spec/rest/session_spec.rb +43 -0
- data/spec/rest/subaccount_spec.rb +39 -0
- data/spec/rest/template_spec.rb +36 -0
- data/spec/rest/unsubscriber_spec.rb +40 -0
- data/spec/rest/user_spec.rb +92 -0
- data/spec/rest/utils_spec.rb +57 -0
- data/spec/spec_helper.rb +15 -0
- data/textmagic-ruby.gemspec +30 -0
- metadata +165 -0
@@ -0,0 +1,17 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::InstanceResource do
|
4
|
+
|
5
|
+
it 'should set up path and client' do
|
6
|
+
resource = Textmagic::REST::InstanceResource.new('mock/path', 'mockClient')
|
7
|
+
expect(resource.instance_variable_get('@path')).to eq('mock/path')
|
8
|
+
expect(resource.instance_variable_get('@client')).to eq('mockClient')
|
9
|
+
end
|
10
|
+
|
11
|
+
it 'should set up instance properties if passed' do
|
12
|
+
params = { :firstName => 'James' }
|
13
|
+
resource = Textmagic::REST::InstanceResource.new('path', 'client', params)
|
14
|
+
expect(resource.first_name).to eq('James')
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Invoice do
|
4
|
+
before do
|
5
|
+
@invoice = Textmagic::REST::Invoice.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@invoice.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@invoice.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@invoice).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should raise RuntimeError if try to call refresh method' do
|
20
|
+
expect{@invoice.refresh}.to raise_error(RuntimeError)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
describe Textmagic::REST::Invoices do
|
26
|
+
before do
|
27
|
+
@invoices = Textmagic::REST::Invoices.new 'mockPath', 'mockClient'
|
28
|
+
end
|
29
|
+
|
30
|
+
[:list, :get, :update, :create, :delete].each do |method|
|
31
|
+
it "should have method #{method}" do
|
32
|
+
expect(@invoices).to respond_to(method)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'should raise RuntimeError if try to call update method' do
|
37
|
+
expect{@invoices.update(1, {})}.to raise_error(RuntimeError)
|
38
|
+
end
|
39
|
+
|
40
|
+
it 'should raise RuntimeError if try to call delete method' do
|
41
|
+
expect{@invoices.delete(1)}.to raise_error(RuntimeError)
|
42
|
+
end
|
43
|
+
|
44
|
+
it 'should raise RuntimeError if try to call get method' do
|
45
|
+
expect{@invoices.get(1)}.to raise_error(RuntimeError)
|
46
|
+
end
|
47
|
+
|
48
|
+
it 'should raise RuntimeError if try to call create method' do
|
49
|
+
expect{@invoices.create({})}.to raise_error(RuntimeError)
|
50
|
+
end
|
51
|
+
|
52
|
+
it 'sets up a client and path' do
|
53
|
+
expect(@invoices.instance_variable_get(:@client)).to eq('mockClient')
|
54
|
+
expect(@invoices.instance_variable_get(:@path)).to eq('mockPath')
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::List do
|
4
|
+
before do
|
5
|
+
@list = Textmagic::REST::List.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@list.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@list.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@list).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Textmagic::REST::Lists do
|
21
|
+
before do
|
22
|
+
@lists = Textmagic::REST::Lists.new 'mockPath', 'mockClient'
|
23
|
+
end
|
24
|
+
|
25
|
+
[:list, :get, :update, :create, :delete, :contacts, :delete_contacts, :put_contacts].each do |method|
|
26
|
+
it "should have method #{method}" do
|
27
|
+
expect(@lists).to respond_to(method)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'sets up a client and path' do
|
32
|
+
expect(@lists.instance_variable_get(:@client)).to eq('mockClient')
|
33
|
+
expect(@lists.instance_variable_get(:@path)).to eq('mockPath')
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Message do
|
4
|
+
before do
|
5
|
+
@message = Textmagic::REST::Message.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@message.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@message.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@message).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe Textmagic::REST::Messages do
|
22
|
+
before do
|
23
|
+
@messages = Textmagic::REST::Messages.new 'mockPath', 'mockClient'
|
24
|
+
end
|
25
|
+
|
26
|
+
[:list, :get, :update, :create, :delete, :price].each do |method|
|
27
|
+
it "should have method #{method}" do
|
28
|
+
expect(@messages).to respond_to(method)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'should raise RuntimeError if try to call update method' do
|
33
|
+
expect{@messages.update(1, {})}.to raise_error(RuntimeError)
|
34
|
+
end
|
35
|
+
|
36
|
+
it 'sets up a client and path' do
|
37
|
+
expect(@messages.instance_variable_get(:@client)).to eq('mockClient')
|
38
|
+
expect(@messages.instance_variable_get(:@path)).to eq('mockPath')
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,66 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Number do
|
4
|
+
before do
|
5
|
+
@number = Textmagic::REST::Number.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@number.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@number.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@number).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
it 'should raise RuntimeError if try to call refresh method' do
|
20
|
+
expect{@number.refresh}.to raise_error(RuntimeError)
|
21
|
+
end
|
22
|
+
|
23
|
+
end
|
24
|
+
|
25
|
+
describe Textmagic::REST::AvailableNumber do
|
26
|
+
before do
|
27
|
+
@number = Textmagic::REST::AvailableNumber.new 'mockPath', 'mockClient'
|
28
|
+
end
|
29
|
+
|
30
|
+
it 'sets up a client and path' do
|
31
|
+
expect(@number.instance_variable_get(:@client)).to eq('mockClient')
|
32
|
+
expect(@number.instance_variable_get(:@path)).to eq('mockPath')
|
33
|
+
end
|
34
|
+
|
35
|
+
[:refresh].each do |method|
|
36
|
+
it "should have method #{method}" do
|
37
|
+
expect(@number).to respond_to(method)
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
it 'should raise RuntimeError if try to call refresh method' do
|
42
|
+
expect{@number.refresh}.to raise_error(RuntimeError)
|
43
|
+
end
|
44
|
+
|
45
|
+
end
|
46
|
+
|
47
|
+
describe Textmagic::REST::Numbers do
|
48
|
+
before do
|
49
|
+
@numbers = Textmagic::REST::Numbers.new 'mockPath', 'mockClient'
|
50
|
+
end
|
51
|
+
|
52
|
+
[:list, :get, :update, :create, :buy, :delete, :available].each do |method|
|
53
|
+
it "should have method #{method}" do
|
54
|
+
expect(@numbers).to respond_to(method)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
it 'should raise RuntimeError if try to call update method' do
|
59
|
+
expect{@numbers.update(1, {})}.to raise_error(RuntimeError)
|
60
|
+
end
|
61
|
+
|
62
|
+
it 'sets up a client and path' do
|
63
|
+
expect(@numbers.instance_variable_get(:@client)).to eq('mockClient')
|
64
|
+
expect(@numbers.instance_variable_get(:@path)).to eq('mockPath')
|
65
|
+
end
|
66
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Reply do
|
4
|
+
before do
|
5
|
+
@reply = Textmagic::REST::Reply.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@reply.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@reply.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@reply).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Textmagic::REST::Replies do
|
21
|
+
before do
|
22
|
+
@replies = Textmagic::REST::Replies.new 'mockPath', 'mockClient'
|
23
|
+
end
|
24
|
+
|
25
|
+
[:list, :get, :update, :create, :delete].each do |method|
|
26
|
+
it "should have method #{method}" do
|
27
|
+
expect(@replies).to respond_to(method)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should raise RuntimeError if try to call update method' do
|
32
|
+
expect{@replies.update(1, {})}.to raise_error(RuntimeError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should raise RuntimeError if try to call create method' do
|
36
|
+
expect{@replies.create({})}.to raise_error(RuntimeError)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'sets up a client and path' do
|
40
|
+
expect(@replies.instance_variable_get(:@client)).to eq('mockClient')
|
41
|
+
expect(@replies.instance_variable_get(:@path)).to eq('mockPath')
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Schedule do
|
4
|
+
before do
|
5
|
+
@schedule = Textmagic::REST::Schedule.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@schedule.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@schedule.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@schedule).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Textmagic::REST::Schedules do
|
21
|
+
before do
|
22
|
+
@schedules = Textmagic::REST::Schedules.new 'mockPath', 'mockClient'
|
23
|
+
end
|
24
|
+
|
25
|
+
[:list, :get, :update, :create, :delete].each do |method|
|
26
|
+
it "should have method #{method}" do
|
27
|
+
expect(@schedules).to respond_to(method)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should raise RuntimeError if try to call update method' do
|
32
|
+
expect{@schedules.update(1, {})}.to raise_error(RuntimeError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should raise RuntimeError if try to call create method' do
|
36
|
+
expect{@schedules.create({})}.to raise_error(RuntimeError)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'sets up a client and path' do
|
40
|
+
expect(@schedules.instance_variable_get(:@client)).to eq('mockClient')
|
41
|
+
expect(@schedules.instance_variable_get(:@path)).to eq('mockPath')
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Senderid do
|
4
|
+
before do
|
5
|
+
@senderid = Textmagic::REST::Senderid.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@senderid.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@senderid.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@senderid).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Textmagic::REST::Senderids do
|
21
|
+
before do
|
22
|
+
@senderids = Textmagic::REST::Senderids.new 'mockPath', 'mockClient'
|
23
|
+
end
|
24
|
+
|
25
|
+
[:list, :get, :update, :create, :delete].each do |method|
|
26
|
+
it "should have method #{method}" do
|
27
|
+
expect(@senderids).to respond_to(method)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should raise RuntimeError if try to call update method' do
|
32
|
+
expect{@senderids.update(1, {})}.to raise_error(RuntimeError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'sets up a client and path' do
|
36
|
+
expect(@senderids.instance_variable_get(:@client)).to eq('mockClient')
|
37
|
+
expect(@senderids.instance_variable_get(:@path)).to eq('mockPath')
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Session do
|
4
|
+
before do
|
5
|
+
@session = Textmagic::REST::Session.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@session.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@session.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@session).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Textmagic::REST::Sessions do
|
21
|
+
before do
|
22
|
+
@sessions = Textmagic::REST::Sessions.new 'mockPath', 'mockClient'
|
23
|
+
end
|
24
|
+
|
25
|
+
[:list, :get, :update, :create, :delete, :messages].each do |method|
|
26
|
+
it "should have method #{method}" do
|
27
|
+
expect(@sessions).to respond_to(method)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should raise RuntimeError if try to call update method' do
|
32
|
+
expect{@sessions.update(1, {})}.to raise_error(RuntimeError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'should raise RuntimeError if try to call create method' do
|
36
|
+
expect{@sessions.create({})}.to raise_error(RuntimeError)
|
37
|
+
end
|
38
|
+
|
39
|
+
it 'sets up a client and path' do
|
40
|
+
expect(@sessions.instance_variable_get(:@client)).to eq('mockClient')
|
41
|
+
expect(@sessions.instance_variable_get(:@path)).to eq('mockPath')
|
42
|
+
end
|
43
|
+
end
|
@@ -0,0 +1,39 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Subaccount do
|
4
|
+
before do
|
5
|
+
@subaccount = Textmagic::REST::Subaccount.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@subaccount.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@subaccount.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@subaccount).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
describe Textmagic::REST::Subaccounts do
|
21
|
+
before do
|
22
|
+
@subaccounts = Textmagic::REST::Subaccounts.new 'mockPath', 'mockClient'
|
23
|
+
end
|
24
|
+
|
25
|
+
[:list, :get, :update, :create, :delete, :send_invite].each do |method|
|
26
|
+
it "should have method #{method}" do
|
27
|
+
expect(@subaccounts).to respond_to(method)
|
28
|
+
end
|
29
|
+
end
|
30
|
+
|
31
|
+
it 'should raise RuntimeError if try to call update method' do
|
32
|
+
expect{@subaccounts.update(1, {})}.to raise_error(RuntimeError)
|
33
|
+
end
|
34
|
+
|
35
|
+
it 'sets up a client and path' do
|
36
|
+
expect(@subaccounts.instance_variable_get(:@client)).to eq('mockClient')
|
37
|
+
expect(@subaccounts.instance_variable_get(:@path)).to eq('mockPath')
|
38
|
+
end
|
39
|
+
end
|
@@ -0,0 +1,36 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Textmagic::REST::Template do
|
4
|
+
before do
|
5
|
+
@template = Textmagic::REST::Template.new 'mockPath', 'mockClient'
|
6
|
+
end
|
7
|
+
|
8
|
+
it 'sets up a client and path' do
|
9
|
+
expect(@template.instance_variable_get(:@client)).to eq('mockClient')
|
10
|
+
expect(@template.instance_variable_get(:@path)).to eq('mockPath')
|
11
|
+
end
|
12
|
+
|
13
|
+
[:refresh].each do |method|
|
14
|
+
it "should have method #{method}" do
|
15
|
+
expect(@template).to respond_to(method)
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
end
|
20
|
+
|
21
|
+
describe Textmagic::REST::Templates do
|
22
|
+
before do
|
23
|
+
@templates = Textmagic::REST::Templates.new 'mockPath', 'mockClient'
|
24
|
+
end
|
25
|
+
|
26
|
+
[:list, :get, :update, :create, :delete].each do |method|
|
27
|
+
it "should have method #{method}" do
|
28
|
+
expect(@templates).to respond_to(method)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
|
32
|
+
it 'sets up a client and path' do
|
33
|
+
expect(@templates.instance_variable_get(:@client)).to eq('mockClient')
|
34
|
+
expect(@templates.instance_variable_get(:@path)).to eq('mockPath')
|
35
|
+
end
|
36
|
+
end
|