bluevia 1.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.
@@ -0,0 +1,78 @@
1
+ #
2
+ # BlueVia is a global iniciative of Telefonica delivered by Movistar and O2.
3
+ # Please, check out www.bluevia.com and if you need more information
4
+ # contact us at mailto:support@bluevia.com
5
+
6
+ $:.unshift File.join(File.dirname(__FILE__),'..','lib')
7
+
8
+ require 'test/unit'
9
+ require 'bluevia'
10
+ require 'test_config'
11
+
12
+ #
13
+ # (c) Bluevia (mailto:support@bluevia.com)
14
+ #
15
+
16
+ class TestSms < Test::Unit::TestCase
17
+ include TestConfig
18
+
19
+ def setup
20
+ create_client(false, :Sms)
21
+ end
22
+
23
+ #
24
+ # Validates the SMS MO Get Received Message
25
+ #
26
+ def t_test_get_received_sms
27
+ create_sms_mo
28
+ get_received_sms(TestConfig::SandBox::SMS_REGISTRATION_ID, 1)
29
+ end
30
+
31
+ #
32
+ # Validates the SMS MO Get Received Message
33
+ #
34
+ def t_test_get_received_sms_multiple
35
+ (1..5).each{
36
+ create_sms_mo
37
+ }
38
+ get_received_sms(TestConfig::SandBox::SMS_REGISTRATION_ID, 5)
39
+ end
40
+ #
41
+ # Validates the SMS MO Get Received Message with an invalid Registration ID
42
+ #
43
+ def t_test_get_received_sms_fails
44
+ get_received_sms_fails
45
+ end
46
+
47
+ private
48
+
49
+ def get_correlator_id
50
+ (0...10).map{ ('a'..'z').to_a[rand(26)] }.join
51
+ end
52
+
53
+ def create_sms_mo
54
+ @service.send_sms(TestConfig::SandBox::SMS_SPECIAL_NUMBER,
55
+ TestConfig::SandBox::TOKEN,
56
+ "#{TestConfig::SandBox::SMS_SPECIAL_KEYWORD} Yet another SMS Text")
57
+ end
58
+
59
+
60
+
61
+ def get_received_sms(registration_id, number = 0)
62
+ info = @service.get_received_sms(registration_id)
63
+ p info.length
64
+ assert_equal info.length >= number, true
65
+ ["originAddress", "dateTime", "destinationAddress", "message"].each {
66
+ |key|
67
+ assert_equal info[0].include?(key), true
68
+ }
69
+ p info[0]["message"]
70
+ end
71
+
72
+ def get_received_sms_fails
73
+ assert_raise RuntimeError do
74
+ @service.get_received_sms("352342641")
75
+ end
76
+ end
77
+
78
+ end
metadata ADDED
@@ -0,0 +1,137 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bluevia
3
+ version: !ruby/object:Gem::Version
4
+ version: "1.0"
5
+ platform: ruby
6
+ authors:
7
+ - Bluevia
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2010-12-15 00:00:00 +01:00
13
+ default_executable:
14
+ dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: httpclient
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 2.1.5.2
24
+ version:
25
+ - !ruby/object:Gem::Dependency
26
+ name: oauth
27
+ type: :runtime
28
+ version_requirement:
29
+ version_requirements: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - ">="
32
+ - !ruby/object:Gem::Version
33
+ version: 0.4.1
34
+ version:
35
+ - !ruby/object:Gem::Dependency
36
+ name: json_pure
37
+ type: :runtime
38
+ version_requirement:
39
+ version_requirements: !ruby/object:Gem::Requirement
40
+ requirements:
41
+ - - ">="
42
+ - !ruby/object:Gem::Version
43
+ version: 1.4.3
44
+ version:
45
+ - !ruby/object:Gem::Dependency
46
+ name: nokogiri
47
+ type: :runtime
48
+ version_requirement:
49
+ version_requirements: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - ">="
52
+ - !ruby/object:Gem::Version
53
+ version: 1.4.2
54
+ version:
55
+ - !ruby/object:Gem::Dependency
56
+ name: test-unit
57
+ type: :development
58
+ version_requirement:
59
+ version_requirements: !ruby/object:Gem::Requirement
60
+ requirements:
61
+ - - "="
62
+ - !ruby/object:Gem::Version
63
+ version: 2.1.0
64
+ version:
65
+ description: Ruby SDK for BlueVia allows you to use the BueVia public API from your Ruby application using just few lines of code.
66
+ email: support@bluevia.com
67
+ executables: []
68
+
69
+ extensions: []
70
+
71
+ extra_rdoc_files:
72
+ - README
73
+ - LICENSE.LGPLv3
74
+ - License_Bluevia.txt
75
+ files:
76
+ - lib/bluevia.rb
77
+ - lib/bluevia
78
+ - lib/multipartable.rb
79
+ - lib/bluevia/sms.rb
80
+ - lib/bluevia/bluevia_logger.rb
81
+ - lib/bluevia/errors
82
+ - lib/bluevia/ext
83
+ - lib/bluevia/response.rb
84
+ - lib/bluevia/advertising.rb
85
+ - lib/bluevia/schemas
86
+ - lib/bluevia/schemas.rb
87
+ - lib/bluevia/directory.rb
88
+ - lib/bluevia/utils.rb
89
+ - lib/bluevia/oauth.rb
90
+ - lib/bluevia/messaging.rb
91
+ - lib/bluevia/errors.rb
92
+ - lib/bluevia/bluevia_client.rb
93
+ - lib/bluevia/base_client.rb
94
+ - lib/bluevia/ad_response.rb
95
+ - lib/bluevia/errors/client_error.rb
96
+ - lib/bluevia/errors/server_error.rb
97
+ - lib/bluevia/errors/not_found_error.rb
98
+ - lib/bluevia/ext/hash.rb
99
+ - lib/bluevia/schemas/common_types.rb
100
+ - lib/bluevia/schemas/directory_types.rb
101
+ - lib/bluevia/schemas/sms_types.rb
102
+ - README
103
+ - LICENSE.LGPLv3
104
+ - License_Bluevia.txt
105
+ has_rdoc: true
106
+ homepage: http://github.com/bluevia
107
+ post_install_message:
108
+ rdoc_options: []
109
+
110
+ require_paths:
111
+ - lib
112
+ required_ruby_version: !ruby/object:Gem::Requirement
113
+ requirements:
114
+ - - ">="
115
+ - !ruby/object:Gem::Version
116
+ version: "0"
117
+ version:
118
+ required_rubygems_version: !ruby/object:Gem::Requirement
119
+ requirements:
120
+ - - ">="
121
+ - !ruby/object:Gem::Version
122
+ version: "0"
123
+ version:
124
+ requirements: []
125
+
126
+ rubyforge_project:
127
+ rubygems_version: 1.3.1
128
+ signing_key:
129
+ specification_version: 2
130
+ summary: This GEM provides an easy way to access Bluevia Public API
131
+ test_files:
132
+ - test/test_sms.rb
133
+ - test/test_config.rb
134
+ - test/test_directory.rb
135
+ - test/test_oauth.rb
136
+ - test/test_sms_mo.rb
137
+ - test/test_advertising.rb