govdelivery-tms 0.8.0 → 0.8.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (67) hide show
  1. data/Gemfile +1 -1
  2. data/README.md +8 -8
  3. data/govdelivery-tms.gemspec +2 -2
  4. data/lib/{govdelivery-tms → govdelivery/tms}/base.rb +4 -4
  5. data/lib/{govdelivery-tms → govdelivery/tms}/client.rb +9 -9
  6. data/lib/{govdelivery-tms → govdelivery/tms}/collection_resource.rb +2 -2
  7. data/lib/{govdelivery-tms → govdelivery/tms}/connection.rb +4 -4
  8. data/lib/{govdelivery-tms → govdelivery/tms}/errors.rb +1 -1
  9. data/lib/govdelivery/tms/instance_resource.rb +219 -0
  10. data/lib/{govdelivery-tms → govdelivery/tms}/link_header.rb +0 -0
  11. data/lib/{govdelivery-tms → govdelivery/tms}/logger.rb +1 -1
  12. data/lib/{govdelivery-tms → govdelivery/tms}/mail/delivery_method.rb +11 -11
  13. data/lib/govdelivery/tms/resource/collections.rb +98 -0
  14. data/lib/{govdelivery-tms → govdelivery/tms}/resource/command.rb +7 -7
  15. data/lib/{govdelivery-tms → govdelivery/tms}/resource/command_action.rb +1 -1
  16. data/lib/{govdelivery-tms → govdelivery/tms}/resource/command_type.rb +1 -1
  17. data/lib/{govdelivery-tms → govdelivery/tms}/resource/email_message.rb +1 -1
  18. data/lib/{govdelivery-tms → govdelivery/tms}/resource/email_recipient.rb +1 -1
  19. data/lib/{govdelivery-tms → govdelivery/tms}/resource/email_recipient_click.rb +1 -1
  20. data/lib/{govdelivery-tms → govdelivery/tms}/resource/email_recipient_open.rb +1 -1
  21. data/lib/{govdelivery-tms → govdelivery/tms}/resource/email_template.rb +1 -1
  22. data/lib/{govdelivery-tms → govdelivery/tms}/resource/from_address.rb +1 -1
  23. data/lib/{govdelivery-tms → govdelivery/tms}/resource/inbound_sms_message.rb +1 -1
  24. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_acknowledgement.rb +1 -1
  25. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_alert.rb +1 -1
  26. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_category.rb +1 -1
  27. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_cog_profile.rb +1 -1
  28. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_event_code.rb +1 -1
  29. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_nwem_area.rb +1 -1
  30. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_nwem_authorization.rb +1 -1
  31. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_nwem_auxilary_data.rb +1 -1
  32. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_response_type.rb +1 -1
  33. data/lib/{govdelivery-tms → govdelivery/tms}/resource/ipaws_static_resource.rb +2 -2
  34. data/lib/{govdelivery-tms → govdelivery/tms}/resource/keyword.rb +1 -1
  35. data/lib/{govdelivery-tms → govdelivery/tms}/resource/recipient.rb +1 -1
  36. data/lib/{govdelivery-tms → govdelivery/tms}/resource/sms_message.rb +1 -1
  37. data/lib/{govdelivery-tms → govdelivery/tms}/resource/webhook.rb +1 -1
  38. data/lib/{govdelivery-tms → govdelivery/tms}/util/core_ext.rb +1 -1
  39. data/lib/{govdelivery-tms → govdelivery/tms}/util/hal_link_parser.rb +2 -2
  40. data/lib/govdelivery/tms/version.rb +5 -0
  41. data/lib/govdelivery-tms/instance_resource.rb +7 -7
  42. data/lib/govdelivery-tms.rb +38 -36
  43. data/spec/client_spec.rb +18 -18
  44. data/spec/command_types_spec.rb +6 -6
  45. data/spec/email_message_spec.rb +58 -58
  46. data/spec/email_template_spec.rb +39 -39
  47. data/spec/errors_spec.rb +3 -3
  48. data/spec/from_address_spec.rb +22 -22
  49. data/spec/inbound_sms_messages_spec.rb +5 -5
  50. data/spec/instance_resource_spec.rb +14 -14
  51. data/spec/ipaws_acknowledgement_spec.rb +6 -6
  52. data/spec/ipaws_alerts_spec.rb +31 -31
  53. data/spec/ipaws_cog_profile_spec.rb +26 -26
  54. data/spec/ipaws_event_codes_spec.rb +5 -5
  55. data/spec/ipaws_nwem_areas_spec.rb +22 -22
  56. data/spec/ipaws_nwem_authorization_spec.rb +6 -6
  57. data/spec/keyword_spec.rb +23 -23
  58. data/spec/keywords_spec.rb +5 -5
  59. data/spec/mail/delivery_method_spec.rb +19 -19
  60. data/spec/sms_message_spec.rb +29 -29
  61. data/spec/sms_messages_spec.rb +7 -7
  62. data/spec/spec_helper.rb +2 -3
  63. data/spec/tms_spec.rb +2 -2
  64. metadata +50 -41
  65. checksums.yaml +0 -15
  66. data/lib/govdelivery-tms/resource/collections.rb +0 -98
  67. data/lib/govdelivery-tms/version.rb +0 -3
@@ -1,6 +1,6 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TMS::IpawsNwemAreas do
3
+ describe GovDelivery::TMS::IpawsNwemAreas do
4
4
 
5
5
  it 'gets IPAWS NWEM areas from client' do
6
6
  client = double(:client)
@@ -26,33 +26,33 @@ describe TMS::IpawsNwemAreas do
26
26
  "zoneName"=>"Arlington/Falls Church/Alexandria"
27
27
  }
28
28
  ]
29
- nwem_areas = TMS::IpawsNwemAreas.new(client, '/ipaws/nwem_areas')
29
+ nwem_areas = GovDelivery::TMS::IpawsNwemAreas.new(client, '/ipaws/nwem_areas')
30
30
 
31
- nwem_areas.client.should_receive('get').with(nwem_areas.href).and_return(
32
- double('response', :status => 200, :body => response_body, :headers => {})
31
+ expect(nwem_areas.client).to receive('get').with(nwem_areas.href).and_return(
32
+ double('response', status: 200, body: response_body, headers: {})
33
33
  )
34
- nwem_areas.get.should == nwem_areas
35
- nwem_areas.collection.size.should == 2
34
+ expect(nwem_areas.get).to eq(nwem_areas)
35
+ expect(nwem_areas.collection.size).to eq(2)
36
36
 
37
37
  nwem_area = nwem_areas.collection[0]
38
- nwem_area.countyFipsCd.should == '51013'
39
- nwem_area.countyName.should == 'Arlington'
40
- nwem_area.geoType.should == 'C'
41
- nwem_area.stateCd.should == 'VA'
42
- nwem_area.stateFips.should == '51'
43
- nwem_area.stateName.should == 'Virginia'
44
- nwem_area.zoneCd.should == '054'
45
- nwem_area.zoneName.should == 'Arlington/Falls Church/Alexandria'
38
+ expect(nwem_area.countyFipsCd).to eq('51013')
39
+ expect(nwem_area.countyName).to eq('Arlington')
40
+ expect(nwem_area.geoType).to eq('C')
41
+ expect(nwem_area.stateCd).to eq('VA')
42
+ expect(nwem_area.stateFips).to eq('51')
43
+ expect(nwem_area.stateName).to eq('Virginia')
44
+ expect(nwem_area.zoneCd).to eq('054')
45
+ expect(nwem_area.zoneName).to eq('Arlington/Falls Church/Alexandria')
46
46
 
47
47
  nwem_area = nwem_areas.collection[1]
48
- nwem_area.countyFipsCd.should == '51510'
49
- nwem_area.countyName.should == 'City of Alexandria'
50
- nwem_area.geoType.should == 'C'
51
- nwem_area.stateCd.should == 'VA'
52
- nwem_area.stateFips.should == '51'
53
- nwem_area.stateName.should == 'Virginia'
54
- nwem_area.zoneCd.should == '054'
55
- nwem_area.zoneName.should == 'Arlington/Falls Church/Alexandria'
48
+ expect(nwem_area.countyFipsCd).to eq('51510')
49
+ expect(nwem_area.countyName).to eq('City of Alexandria')
50
+ expect(nwem_area.geoType).to eq('C')
51
+ expect(nwem_area.stateCd).to eq('VA')
52
+ expect(nwem_area.stateFips).to eq('51')
53
+ expect(nwem_area.stateName).to eq('Virginia')
54
+ expect(nwem_area.zoneCd).to eq('054')
55
+ expect(nwem_area.zoneName).to eq('Arlington/Falls Church/Alexandria')
56
56
  end
57
57
 
58
58
  end
@@ -1,16 +1,16 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TMS::IpawsNwemAuthorization do
3
+ describe GovDelivery::TMS::IpawsNwemAuthorization do
4
4
 
5
5
  it 'gets IPAWS NWEM Authorization from client' do
6
6
  client = double(:client)
7
7
  response_body = { "cogid" => "true" }
8
- nwem_authorization = TMS::IpawsNwemAuthorization.new(client, '/ipaws/nwem_authorization', {})
9
- nwem_authorization.client.should_receive('get').with(nwem_authorization.href).and_return(
10
- double('response', :status => 200, :body => response_body)
8
+ nwem_authorization = GovDelivery::TMS::IpawsNwemAuthorization.new(client, '/ipaws/nwem_authorization', {})
9
+ expect(nwem_authorization.client).to receive('get').with(nwem_authorization.href).and_return(
10
+ double('response', status: 200, body: response_body)
11
11
  )
12
- nwem_authorization.get.should == nwem_authorization
13
- nwem_authorization.cogid.should == "true"
12
+ expect(nwem_authorization.get).to eq(nwem_authorization)
13
+ expect(nwem_authorization.cogid).to eq("true")
14
14
  end
15
15
 
16
16
  end
data/spec/keyword_spec.rb CHANGED
@@ -1,31 +1,31 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TMS::Keyword do
3
+ describe GovDelivery::TMS::Keyword do
4
4
  context "creating a new keyword" do
5
5
  let(:client) do
6
6
  double('client')
7
7
  end
8
8
  before do
9
- @keyword = TMS::Keyword.new(client, nil, {:name => 'LOL', :response_text => 'very funny!'})
9
+ @keyword = GovDelivery::TMS::Keyword.new(client, nil, {name: 'LOL', response_text: 'very funny!'})
10
10
  end
11
11
  it 'should initialize with attrs' do
12
- @keyword.name.should == 'LOL'
13
- @keyword.response_text.should == 'very funny!'
12
+ expect(@keyword.name).to eq('LOL')
13
+ expect(@keyword.response_text).to eq('very funny!')
14
14
  end
15
15
  it 'should post successfully' do
16
- response = {:name => 'lol'}
17
- @keyword.client.should_receive('post').with(@keyword).and_return(double('response', :status => 201, :body => response))
16
+ response = {name: 'lol'}
17
+ expect(@keyword.client).to receive('post').with(@keyword).and_return(double('response', status: 201, body: response))
18
18
  @keyword.post
19
- @keyword.name.should == 'lol'
20
- @keyword.response_text.should == 'very funny!'
19
+ expect(@keyword.name).to eq('lol')
20
+ expect(@keyword.response_text).to eq('very funny!')
21
21
  end
22
22
  it 'should handle errors' do
23
- response = {'errors' => {:name => "can't be nil"}}
24
- @keyword.client.should_receive('post').with(@keyword).and_return(double('response', :status => 422, :body => response))
23
+ response = {'errors' => {name: "can't be nil"}}
24
+ expect(@keyword.client).to receive('post').with(@keyword).and_return(double('response', status: 422, body: response))
25
25
  @keyword.post
26
- @keyword.name.should == 'LOL'
27
- @keyword.response_text.should == 'very funny!'
28
- @keyword.errors.should == {:name => "can't be nil"}
26
+ expect(@keyword.name).to eq('LOL')
27
+ expect(@keyword.response_text).to eq('very funny!')
28
+ expect(@keyword.errors).to eq({name: "can't be nil"})
29
29
  end
30
30
  end
31
31
 
@@ -35,25 +35,25 @@ describe TMS::Keyword do
35
35
  end
36
36
  before do
37
37
  # blank hash prevents the client from doing a GET in the initialize method
38
- @keyword = TMS::Keyword.new(client, '/keywords/99', {})
38
+ @keyword = GovDelivery::TMS::Keyword.new(client, '/keywords/99', {})
39
39
  end
40
40
  it 'should GET cleanly' do
41
- response = {:name => 'FOO', :response_text => 'hello'}
42
- @keyword.client.should_receive('get').with(@keyword.href).and_return(double('response', :status => 200, :body => response))
41
+ response = {name: 'FOO', response_text: 'hello'}
42
+ expect(@keyword.client).to receive('get').with(@keyword.href).and_return(double('response', status: 200, body: response))
43
43
  @keyword.get
44
- @keyword.name.should == 'FOO'
45
- @keyword.response_text.should == 'hello'
44
+ expect(@keyword.name).to eq('FOO')
45
+ expect(@keyword.response_text).to eq('hello')
46
46
  end
47
47
  it 'should PUT cleanly' do
48
48
  @keyword.name = "GOVLIE"
49
- response = {:name => 'govlie', :response_text => nil}
50
- @keyword.client.should_receive('put').with(@keyword).and_return(double('response', :status => 200, :body => response))
49
+ response = {name: 'govlie', response_text: nil}
50
+ expect(@keyword.client).to receive('put').with(@keyword).and_return(double('response', status: 200, body: response))
51
51
  @keyword.put
52
- @keyword.name.should == 'govlie'
53
- @keyword.response_text.should be_nil
52
+ expect(@keyword.name).to eq('govlie')
53
+ expect(@keyword.response_text).to be_nil
54
54
  end
55
55
  it 'should DELETE cleanly' do
56
- @keyword.client.should_receive('delete').with(@keyword.href).and_return(double('response', :status => 200, :body => ''))
56
+ expect(@keyword.client).to receive('delete').with(@keyword.href).and_return(double('response', status: 200, body: ''))
57
57
  @keyword.delete
58
58
  end
59
59
  end
@@ -1,21 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TMS::Keywords do
3
+ describe GovDelivery::TMS::Keywords do
4
4
  context "loading keywords" do
5
5
  let(:client) do
6
6
  double('client')
7
7
  end
8
8
  before do
9
- @keywords = TMS::Keywords.new(client, '/keywords')
9
+ @keywords = GovDelivery::TMS::Keywords.new(client, '/keywords')
10
10
  end
11
11
  it 'should GET ok' do
12
12
  body = [
13
- {"name"=>"services", "_links"=>{"self"=>"/keywords/1"}},
13
+ {"name"=>"services", "_links"=>{"self"=>"/keywords/1"}},
14
14
  {"name"=>"subscribe", "_links"=>{"self"=>"/keywords/2"}}
15
15
  ]
16
- @keywords.client.should_receive(:get).and_return(double('response', :body => body, :status => 200, :headers => {}))
16
+ expect(@keywords.client).to receive(:get).and_return(double('response', body: body, status: 200, headers: {}))
17
17
  @keywords.get
18
- @keywords.collection.length.should == 2
18
+ expect(@keywords.collection.length).to eq(2)
19
19
  end
20
20
  end
21
21
  end
@@ -1,11 +1,11 @@
1
1
  require 'spec_helper'
2
2
  require 'mail'
3
- require 'govdelivery-tms/mail/delivery_method'
4
- describe TMS::Mail::DeliveryMethod do
5
- subject { TMS::Mail::DeliveryMethod.new({}) }
6
- let(:client) { double('TMS::Client') }
3
+ require 'govdelivery/tms/mail/delivery_method'
4
+ describe GovDelivery::TMS::Mail::DeliveryMethod do
5
+ subject { GovDelivery::TMS::Mail::DeliveryMethod.new({}) }
6
+ let(:client) { double('GovDelivery::TMS::Client') }
7
7
  let(:email_messages) { double('email_messages') }
8
- let(:tms_message) { double('tms_message', :recipients => double(:build => TMS::Recipient.new('href'))) }
8
+ let(:tms_message) { double('tms_message', recipients: double(build: GovDelivery::TMS::Recipient.new('href'))) }
9
9
 
10
10
  it 'should work with a basic Mail::Message' do
11
11
  mail = Mail.new do
@@ -14,14 +14,14 @@ describe TMS::Mail::DeliveryMethod do
14
14
  to '"A Nice Fellow" <tyler@sink.govdelivery.com>'
15
15
  body '<blink>HI</blink>'
16
16
  end
17
- client.stub(:email_messages).and_return(email_messages)
18
- subject.stub(:client).and_return(client)
19
- email_messages.should_receive(:build).with(
20
- :from_name => mail[:from].display_names.first,
21
- :subject => mail.subject,
22
- :body => '<blink>HI</blink>'
17
+ allow(client).to receive(:email_messages).and_return(email_messages)
18
+ allow(subject).to receive(:client).and_return(client)
19
+ expect(email_messages).to receive(:build).with(
20
+ from_name: mail[:from].display_names.first,
21
+ subject: mail.subject,
22
+ body: '<blink>HI</blink>'
23
23
  ).and_return(tms_message)
24
- tms_message.should_receive(:post!).and_return(true)
24
+ expect(tms_message).to receive(:post!).and_return(true)
25
25
 
26
26
  subject.deliver!(mail)
27
27
  end
@@ -37,14 +37,14 @@ describe TMS::Mail::DeliveryMethod do
37
37
  body '<blink>HTML</blink>'
38
38
  end
39
39
  end
40
- client.stub(:email_messages).and_return(email_messages)
41
- subject.stub(:client).and_return(client)
42
- email_messages.should_receive(:build).with(
43
- :from_name => mail[:from].display_names.first,
44
- :subject => mail.subject,
45
- :body => '<blink>HTML</blink>'
40
+ allow(client).to receive(:email_messages).and_return(email_messages)
41
+ allow(subject).to receive(:client).and_return(client)
42
+ expect(email_messages).to receive(:build).with(
43
+ from_name: mail[:from].display_names.first,
44
+ subject: mail.subject,
45
+ body: '<blink>HTML</blink>'
46
46
  ).and_return(tms_message)
47
- tms_message.should_receive(:post!).and_return(true)
47
+ expect(tms_message).to receive(:post!).and_return(true)
48
48
 
49
49
  subject.deliver!(mail)
50
50
  end
@@ -1,44 +1,44 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TMS::SmsMessage do
3
+ describe GovDelivery::TMS::SmsMessage do
4
4
  context "creating a new message" do
5
5
  let(:client) do
6
6
  double('client')
7
7
  end
8
8
  before do
9
- @message = TMS::SmsMessage.new(client, nil, {:body => '12345678', :created_at => 'BAAAAAD'})
9
+ @message = GovDelivery::TMS::SmsMessage.new(client, nil, {body: '12345678', created_at: 'BAAAAAD'})
10
10
  end
11
11
  it 'should not render readonly attrs in json hash' do
12
- @message.to_json[:body].should == '12345678'
13
- @message.to_json[:created_at].should == nil
12
+ expect(@message.to_json[:body]).to eq('12345678')
13
+ expect(@message.to_json[:created_at]).to eq(nil)
14
14
  end
15
15
  it 'should initialize with attrs and collections' do
16
- @message.body.should == '12345678'
17
- @message.recipients.class.should == TMS::Recipients
16
+ expect(@message.body).to eq('12345678')
17
+ expect(@message.recipients.class).to eq(GovDelivery::TMS::Recipients)
18
18
  end
19
19
  it 'should post successfully' do
20
- response = { :body => 'processed',
21
- :recipients => [{:phone => '22345678'}],
22
- :failed => [{:phone => '22345678'}],
23
- :sent => [{:phone => '22345678'}],
24
- :created_at => 'time'}
25
- @message.client.should_receive('post').with(@message).and_return(double('response', :status => 201, :body => response))
20
+ response = { body: 'processed',
21
+ recipients: [{phone: '22345678'}],
22
+ failed: [{phone: '22345678'}],
23
+ sent: [{phone: '22345678'}],
24
+ created_at: 'time'}
25
+ expect(@message.client).to receive('post').with(@message).and_return(double('response', status: 201, body: response))
26
26
  @message.post
27
- @message.body.should == 'processed'
28
- @message.created_at.should == 'time'
29
- @message.recipients.class.should == TMS::Recipients
30
- @message.recipients.collection.first.class.should == TMS::Recipient
31
- @message.sent.class.should == TMS::Recipients
32
- @message.sent.collection.first.class.should == TMS::Recipient
33
- @message.failed.class.should == TMS::Recipients
34
- @message.failed.collection.first.class.should == TMS::Recipient
27
+ expect(@message.body).to eq('processed')
28
+ expect(@message.created_at).to eq('time')
29
+ expect(@message.recipients.class).to eq(GovDelivery::TMS::Recipients)
30
+ expect(@message.recipients.collection.first.class).to eq(GovDelivery::TMS::Recipient)
31
+ expect(@message.sent.class).to eq(GovDelivery::TMS::Recipients)
32
+ expect(@message.sent.collection.first.class).to eq(GovDelivery::TMS::Recipient)
33
+ expect(@message.failed.class).to eq(GovDelivery::TMS::Recipients)
34
+ expect(@message.failed.collection.first.class).to eq(GovDelivery::TMS::Recipient)
35
35
  end
36
36
  it 'should handle errors' do
37
- response = {'errors' => {:body => "can't be nil"}}
38
- @message.client.should_receive('post').with(@message).and_return(double('response', :status => 422, :body => response))
37
+ response = {'errors' => {body: "can't be nil"}}
38
+ expect(@message.client).to receive('post').with(@message).and_return(double('response', status: 422, body: response))
39
39
  @message.post
40
- @message.body.should == '12345678'
41
- @message.errors.should == {:body => "can't be nil"}
40
+ expect(@message.body).to eq('12345678')
41
+ expect(@message.errors).to eq({body: "can't be nil"})
42
42
  end
43
43
  end
44
44
 
@@ -48,14 +48,14 @@ describe TMS::SmsMessage do
48
48
  end
49
49
  before do
50
50
  # blank hash prevents the client from doing a GET in the initialize method
51
- @message = TMS::SmsMessage.new(client, '/messages/99', {})
51
+ @message = GovDelivery::TMS::SmsMessage.new(client, '/messages/99', {})
52
52
  end
53
53
  it 'should GET cleanly' do
54
- response = {:body => 'processed', :recipients => [{:phone => '22345678'}], :created_at => 'time'}
55
- @message.client.should_receive('get').with(@message.href).and_return(double('response', :status => 200, :body => response))
54
+ response = {body: 'processed', recipients: [{phone: '22345678'}], created_at: 'time'}
55
+ expect(@message.client).to receive('get').with(@message.href).and_return(double('response', status: 200, body: response))
56
56
  @message.get
57
- @message.body.should == 'processed'
58
- @message.created_at.should == 'time'
57
+ expect(@message.body).to eq('processed')
58
+ expect(@message.created_at).to eq('time')
59
59
  end
60
60
  end
61
61
 
@@ -1,21 +1,21 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TMS::SmsMessages do
3
+ describe GovDelivery::TMS::SmsMessages do
4
4
  context "creating a new messages list" do
5
5
  let(:client) do
6
6
  double('client')
7
7
  end
8
8
  before do
9
- @messages = TMS::SmsMessages.new(client, '/messages')
9
+ @messages = GovDelivery::TMS::SmsMessages.new(client, '/messages')
10
10
  end
11
11
  it 'should GET itself' do
12
- body = [{:short_body => 'hi ho', :created_at => 'a while ago'}, {:short_body => 'feel me flow', :created_at => 'longer ago'}]
13
- @messages.client.should_receive(:get).and_return(double('response', :body => body, :status => 200, :headers => {'link' => "</messages/page/2>; rel=\"next\",</messages/page/11>; rel=\"last\""}))
12
+ body = [{short_body: 'hi ho', created_at: 'a while ago'}, {short_body: 'feel me flow', created_at: 'longer ago'}]
13
+ expect(@messages.client).to receive(:get).and_return(double('response', body: body, status: 200, headers: {'link' => "</messages/page/2>; rel=\"next\",</messages/page/11>; rel=\"last\""}))
14
14
 
15
15
  @messages.get
16
- @messages.collection.length.should == 2
17
- @messages.next.href.should == '/messages/page/2'
18
- @messages.last.href.should == '/messages/page/11'
16
+ expect(@messages.collection.length).to eq(2)
17
+ expect(@messages.next.href).to eq('/messages/page/2')
18
+ expect(@messages.last.href).to eq('/messages/page/11')
19
19
  end
20
20
  end
21
21
  end
data/spec/spec_helper.rb CHANGED
@@ -1,12 +1,12 @@
1
1
  $: << File.expand_path("../lib", __FILE__)
2
2
  require 'govdelivery-tms'
3
3
 
4
- class TMS::Horse
4
+ class GovDelivery::TMS::Horse
5
5
  def initialize(client, href)
6
6
  end
7
7
  end
8
8
 
9
- class TMS::Rabbits
9
+ class GovDelivery::TMS::Rabbits
10
10
  def initialize(client, href)
11
11
  end
12
12
  end
@@ -19,7 +19,6 @@ end
19
19
  # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
20
20
  require 'rspec/its'
21
21
  RSpec.configure do |config|
22
- config.treat_symbols_as_metadata_keys_with_true_values = true
23
22
  config.run_all_when_everything_filtered = true
24
23
  config.filter_run :focus
25
24
 
data/spec/tms_spec.rb CHANGED
@@ -1,7 +1,7 @@
1
1
  require 'spec_helper'
2
2
 
3
- describe TMS, "version" do
3
+ describe GovDelivery::TMS, "version" do
4
4
  it "should exist" do
5
- TMS::VERSION.should be_an_instance_of(String)
5
+ expect(GovDelivery::TMS::VERSION).to be_an_instance_of(String)
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,8 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: govdelivery-tms
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.8.1
5
+ prerelease:
5
6
  platform: ruby
6
7
  authors:
7
8
  - GovDelivery
@@ -13,6 +14,7 @@ dependencies:
13
14
  - !ruby/object:Gem::Dependency
14
15
  name: activesupport
15
16
  requirement: !ruby/object:Gem::Requirement
17
+ none: false
16
18
  requirements:
17
19
  - - ! '>='
18
20
  - !ruby/object:Gem::Version
@@ -20,6 +22,7 @@ dependencies:
20
22
  type: :runtime
21
23
  prerelease: false
22
24
  version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
23
26
  requirements:
24
27
  - - ! '>='
25
28
  - !ruby/object:Gem::Version
@@ -27,6 +30,7 @@ dependencies:
27
30
  - !ruby/object:Gem::Dependency
28
31
  name: faraday
29
32
  requirement: !ruby/object:Gem::Requirement
33
+ none: false
30
34
  requirements:
31
35
  - - ! '>='
32
36
  - !ruby/object:Gem::Version
@@ -34,6 +38,7 @@ dependencies:
34
38
  type: :runtime
35
39
  prerelease: false
36
40
  version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
37
42
  requirements:
38
43
  - - ! '>='
39
44
  - !ruby/object:Gem::Version
@@ -41,6 +46,7 @@ dependencies:
41
46
  - !ruby/object:Gem::Dependency
42
47
  name: faraday_middleware
43
48
  requirement: !ruby/object:Gem::Requirement
49
+ none: false
44
50
  requirements:
45
51
  - - ! '>='
46
52
  - !ruby/object:Gem::Version
@@ -48,6 +54,7 @@ dependencies:
48
54
  type: :runtime
49
55
  prerelease: false
50
56
  version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
51
58
  requirements:
52
59
  - - ! '>='
53
60
  - !ruby/object:Gem::Version
@@ -65,44 +72,45 @@ files:
65
72
  - README.md
66
73
  - Rakefile
67
74
  - govdelivery-tms.gemspec
68
- - lib/govdelivery-tms.rb
69
- - lib/govdelivery-tms/base.rb
70
- - lib/govdelivery-tms/client.rb
71
- - lib/govdelivery-tms/collection_resource.rb
72
- - lib/govdelivery-tms/connection.rb
73
- - lib/govdelivery-tms/errors.rb
75
+ - lib/govdelivery/tms/base.rb
76
+ - lib/govdelivery/tms/client.rb
77
+ - lib/govdelivery/tms/collection_resource.rb
78
+ - lib/govdelivery/tms/connection.rb
79
+ - lib/govdelivery/tms/errors.rb
80
+ - lib/govdelivery/tms/instance_resource.rb
81
+ - lib/govdelivery/tms/link_header.rb
82
+ - lib/govdelivery/tms/logger.rb
83
+ - lib/govdelivery/tms/mail/delivery_method.rb
84
+ - lib/govdelivery/tms/resource/collections.rb
85
+ - lib/govdelivery/tms/resource/command.rb
86
+ - lib/govdelivery/tms/resource/command_action.rb
87
+ - lib/govdelivery/tms/resource/command_type.rb
88
+ - lib/govdelivery/tms/resource/email_message.rb
89
+ - lib/govdelivery/tms/resource/email_recipient.rb
90
+ - lib/govdelivery/tms/resource/email_recipient_click.rb
91
+ - lib/govdelivery/tms/resource/email_recipient_open.rb
92
+ - lib/govdelivery/tms/resource/email_template.rb
93
+ - lib/govdelivery/tms/resource/from_address.rb
94
+ - lib/govdelivery/tms/resource/inbound_sms_message.rb
95
+ - lib/govdelivery/tms/resource/ipaws_acknowledgement.rb
96
+ - lib/govdelivery/tms/resource/ipaws_alert.rb
97
+ - lib/govdelivery/tms/resource/ipaws_category.rb
98
+ - lib/govdelivery/tms/resource/ipaws_cog_profile.rb
99
+ - lib/govdelivery/tms/resource/ipaws_event_code.rb
100
+ - lib/govdelivery/tms/resource/ipaws_nwem_area.rb
101
+ - lib/govdelivery/tms/resource/ipaws_nwem_authorization.rb
102
+ - lib/govdelivery/tms/resource/ipaws_nwem_auxilary_data.rb
103
+ - lib/govdelivery/tms/resource/ipaws_response_type.rb
104
+ - lib/govdelivery/tms/resource/ipaws_static_resource.rb
105
+ - lib/govdelivery/tms/resource/keyword.rb
106
+ - lib/govdelivery/tms/resource/recipient.rb
107
+ - lib/govdelivery/tms/resource/sms_message.rb
108
+ - lib/govdelivery/tms/resource/webhook.rb
109
+ - lib/govdelivery/tms/util/core_ext.rb
110
+ - lib/govdelivery/tms/util/hal_link_parser.rb
111
+ - lib/govdelivery/tms/version.rb
74
112
  - lib/govdelivery-tms/instance_resource.rb
75
- - lib/govdelivery-tms/link_header.rb
76
- - lib/govdelivery-tms/logger.rb
77
- - lib/govdelivery-tms/mail/delivery_method.rb
78
- - lib/govdelivery-tms/resource/collections.rb
79
- - lib/govdelivery-tms/resource/command.rb
80
- - lib/govdelivery-tms/resource/command_action.rb
81
- - lib/govdelivery-tms/resource/command_type.rb
82
- - lib/govdelivery-tms/resource/email_message.rb
83
- - lib/govdelivery-tms/resource/email_recipient.rb
84
- - lib/govdelivery-tms/resource/email_recipient_click.rb
85
- - lib/govdelivery-tms/resource/email_recipient_open.rb
86
- - lib/govdelivery-tms/resource/email_template.rb
87
- - lib/govdelivery-tms/resource/from_address.rb
88
- - lib/govdelivery-tms/resource/inbound_sms_message.rb
89
- - lib/govdelivery-tms/resource/ipaws_acknowledgement.rb
90
- - lib/govdelivery-tms/resource/ipaws_alert.rb
91
- - lib/govdelivery-tms/resource/ipaws_category.rb
92
- - lib/govdelivery-tms/resource/ipaws_cog_profile.rb
93
- - lib/govdelivery-tms/resource/ipaws_event_code.rb
94
- - lib/govdelivery-tms/resource/ipaws_nwem_area.rb
95
- - lib/govdelivery-tms/resource/ipaws_nwem_authorization.rb
96
- - lib/govdelivery-tms/resource/ipaws_nwem_auxilary_data.rb
97
- - lib/govdelivery-tms/resource/ipaws_response_type.rb
98
- - lib/govdelivery-tms/resource/ipaws_static_resource.rb
99
- - lib/govdelivery-tms/resource/keyword.rb
100
- - lib/govdelivery-tms/resource/recipient.rb
101
- - lib/govdelivery-tms/resource/sms_message.rb
102
- - lib/govdelivery-tms/resource/webhook.rb
103
- - lib/govdelivery-tms/util/core_ext.rb
104
- - lib/govdelivery-tms/util/hal_link_parser.rb
105
- - lib/govdelivery-tms/version.rb
113
+ - lib/govdelivery-tms.rb
106
114
  - spec/client_spec.rb
107
115
  - spec/command_types_spec.rb
108
116
  - spec/email_message_spec.rb
@@ -126,26 +134,27 @@ files:
126
134
  - spec/tms_spec.rb
127
135
  homepage: http://govdelivery.com
128
136
  licenses: []
129
- metadata: {}
130
137
  post_install_message:
131
138
  rdoc_options: []
132
139
  require_paths:
133
140
  - lib
134
141
  required_ruby_version: !ruby/object:Gem::Requirement
142
+ none: false
135
143
  requirements:
136
144
  - - ! '>='
137
145
  - !ruby/object:Gem::Version
138
146
  version: '0'
139
147
  required_rubygems_version: !ruby/object:Gem::Requirement
148
+ none: false
140
149
  requirements:
141
150
  - - ! '>='
142
151
  - !ruby/object:Gem::Version
143
152
  version: '0'
144
153
  requirements: []
145
154
  rubyforge_project:
146
- rubygems_version: 2.4.5
155
+ rubygems_version: 1.8.25
147
156
  signing_key:
148
- specification_version: 4
157
+ specification_version: 3
149
158
  summary: A ruby client to interact with the GovDelivery TMS REST API.
150
159
  test_files:
151
160
  - spec/client_spec.rb
checksums.yaml DELETED
@@ -1,15 +0,0 @@
1
- ---
2
- !binary "U0hBMQ==":
3
- metadata.gz: !binary |-
4
- ZWUwNjNlYmFmOTc5Y2I4ODIwYmZhNTVkOWU0MGUzMzJjOTZiYzA1ZA==
5
- data.tar.gz: !binary |-
6
- NWNmYzNlYjRlOWI4NjVmYmUzOTQzNzBkMDViNTExNTIwZWNhNDRiMw==
7
- SHA512:
8
- metadata.gz: !binary |-
9
- NjJiNTAxMGVhZGY4ZTY0M2JmNGIwNzkwZDY1NWMxYzA2NDBiYzI4ZGE4MjBh
10
- Njg5OTUyODgzNDJmMzE2MTUxNWNmNjM5Y2M3MjBmYTQ0MmJhMzA1M2Q2MmQ5
11
- MzNhZmY5MTU5YTRhM2MwM2FkYzVlYTVlYmMzZjVlNmM5ZmE2MWY=
12
- data.tar.gz: !binary |-
13
- OTAzZDMxMDdkMjI2NDBjNDQxYzk1NzA2YzA5ZmJiYjI3YTQ1YWJmMzJjMGVj
14
- NjI4ZjExMmQzYzg5MTNiODE2YTVmMGNhYTZkYmU2NzE4ZWQ1NWFjMDU0YjRi
15
- NzkxZDMyMzM4ZDI2YmU4NzE2OTE5YzY4NmFlN2VjOTA5ZmM1Yjc=