mogreet 0.0.1 → 0.0.2.pre

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.
Files changed (61) hide show
  1. data/.gitignore +6 -6
  2. data/Gemfile +1 -2
  3. data/README.md +49 -28
  4. data/Rakefile +8 -3
  5. data/lib/mogreet.rb +12 -8
  6. data/lib/mogreet/client.rb +60 -0
  7. data/lib/mogreet/deprecated.rb +56 -0
  8. data/lib/mogreet/keyword.rb +27 -0
  9. data/lib/mogreet/list.rb +67 -0
  10. data/lib/mogreet/media.rb +19 -0
  11. data/lib/mogreet/request.rb +19 -0
  12. data/lib/mogreet/response.rb +7 -0
  13. data/lib/mogreet/system.rb +10 -0
  14. data/lib/mogreet/transaction.rb +30 -0
  15. data/lib/mogreet/user.rb +33 -1
  16. data/lib/mogreet/version.rb +2 -2
  17. data/mogreet.gemspec +20 -19
  18. data/spec/cassettes/deprecated_mms.yml +53 -0
  19. data/spec/cassettes/keyword_add.yml +56 -0
  20. data/spec/cassettes/keyword_check.yml +57 -0
  21. data/spec/cassettes/keyword_list.yml +121 -0
  22. data/spec/cassettes/keyword_remove.yml +56 -0
  23. data/spec/cassettes/list_append.yml +61 -0
  24. data/spec/cassettes/list_create.yml +57 -0
  25. data/spec/cassettes/list_destroy.yml +56 -0
  26. data/spec/cassettes/list_download.yml +59 -0
  27. data/spec/cassettes/list_empty.yml +56 -0
  28. data/spec/cassettes/list_info.yml +65 -0
  29. data/spec/cassettes/list_list.yml +63 -0
  30. data/spec/cassettes/list_prune.yml +61 -0
  31. data/spec/cassettes/list_send.yml +56 -0
  32. data/spec/cassettes/media_destroy.yml +61 -0
  33. data/spec/cassettes/media_list.yml +72 -0
  34. data/spec/cassettes/media_upload.yml +3602 -0
  35. data/spec/cassettes/ping_invalid.yml +51 -0
  36. data/spec/cassettes/ping_success.yml +147 -0
  37. data/spec/cassettes/transaction_lookup.yml +74 -0
  38. data/spec/cassettes/transaction_send.yml +101 -0
  39. data/spec/cassettes/user_info_success.yml +56 -0
  40. data/spec/cassettes/user_lookup_success.yml +104 -0
  41. data/spec/cassettes/user_transactions_success.yml +62 -0
  42. data/spec/cassettes/user_uncache_success.yml +56 -0
  43. data/spec/deprecated_spec.rb +37 -0
  44. data/spec/fixtures/api.jpg +0 -0
  45. data/spec/keyword_spec.rb +84 -0
  46. data/spec/list_spec.rb +193 -0
  47. data/spec/media_spec.rb +67 -0
  48. data/spec/ping_spec.rb +43 -0
  49. data/spec/spec_helper.rb +26 -7
  50. data/spec/transaction_spec.rb +53 -0
  51. data/spec/user_spec.rb +66 -0
  52. metadata +93 -59
  53. data/.rspec +0 -1
  54. data/LICENSE +0 -22
  55. data/lib/mogreet/config.rb +0 -3
  56. data/lib/mogreet/message.rb +0 -8
  57. data/lib/mogreet/mogreet.rb +0 -13
  58. data/lib/mogreet/response/transaction_send.rb +0 -5
  59. data/spec/fixtures/transaction_send.xml +0 -6
  60. data/spec/mogreet/config_spec.rb +0 -17
  61. data/spec/mogreet/message_spec.rb +0 -32
@@ -1,5 +1,37 @@
1
1
  module Mogreet
2
2
  class User
3
+ def initialize(client)
4
+ @client = client
5
+ end
6
+
7
+ def lookup(options)
8
+ @client.get_request('/moms/user.lookup', options)
9
+ end
10
+
11
+ # Name Description
12
+ # client_id Your client id. Log onto the Campaign Manager to access your client id.
13
+ # token Your token. Log onto the Campaign Manager to access your token.
14
+ # number A mobile number (MSISDN).
15
+ # campaign_id A campaign id to search on. (Optional - if excluded, returns all opt in statuses for the client’s campaigns)
16
+ # start_date (Optional) Narrow search by adding a date to start searching on [YYYY-MM-DD]
17
+ # end_date (Optional) Narrow search by adding a date to stop searching on [YYYY-MM-DD]
18
+ def transactions(options)
19
+ @client.get_request('/moms/user.transactions', options)
20
+ end
21
+
22
+ def info(options)
23
+ @client.get_request('/moms/user.info', options)
24
+ end
25
+
26
+ def uncache(options)
27
+ @client.get_request('/moms/user.uncache', options)
28
+ end
3
29
 
30
+ # number
31
+ # campaign_id
32
+ def getopt(options)
33
+ @client.get_request('/moms/user.getopt', options)
34
+ end
35
+
4
36
  end
5
- end
37
+ end
@@ -1,3 +1,3 @@
1
1
  module Mogreet
2
- VERSION = "0.0.1"
3
- end
2
+ VERSION = '0.0.2.pre'
3
+ end
@@ -1,23 +1,24 @@
1
1
  # -*- encoding: utf-8 -*-
2
- require File.expand_path('../lib/mogreet/version', __FILE__)
2
+ $:.push File.expand_path("../lib", __FILE__)
3
+ require "mogreet/version"
3
4
 
4
- Gem::Specification.new do |gem|
5
- gem.authors = ["Andrew Hage", "Mateusz Dominiak"]
6
- gem.email = ["andrew@okvenue.com", "mateusz.dominiak@gmail.com"]
7
- gem.description = %q{A ruby wrapper for the Mogreet API}
8
- gem.summary = %q{A simple ruby interface to the api at https://api.mogreet.com}
9
- gem.homepage = ""
5
+ Gem::Specification.new do |s|
6
+ s.name = "mogreet"
7
+ s.version = Mogreet::VERSION
8
+ # who wants to join me?
9
+ s.authors = ["Paul Forsyth"]
10
+ s.email = ["paul@mogreet.com"]
11
+ # for now
12
+ s.homepage = "https://github.com/pforsyth/mogreet"
13
+ s.summary = %q{Ruby interface to the Mogreet API}
14
+ s.description = %q{Ruby interface to the Mogreet API. Allows sending SMS and MMS messages. Go to https://developer.mogreet.com to create an account.}
10
15
 
11
- gem.files = `git ls-files`.split($\)
12
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
13
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
14
- gem.name = "mogreet"
15
- gem.require_paths = ["lib"]
16
- gem.version = Mogreet::VERSION
17
-
18
- gem.add_development_dependency "rspec"
19
-
20
- gem.add_runtime_dependency "hashie"
21
- gem.add_runtime_dependency "httparty"
22
- gem.add_runtime_dependency "crack"
16
+ s.files = `git ls-files`.split("\n")
17
+ s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
18
+ s.require_paths = ["lib"]
19
+
20
+ # specify any dependencies here; for example:
21
+ # s.add_development_dependency "rspec"
22
+ s.add_runtime_dependency "rest-client"
23
+ s.add_runtime_dependency "hashie"
23
24
  end
@@ -0,0 +1,53 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.mogreet.com/moms/transaction.send?campaign_id=20861&client_id=1010101&content_url=http://rubyonrails.org/images/rails.png&format=json&message=Hello%20World!&to=3108675309&token=xyxyxyxyxyxyxyxyxyxyxyxyxyx
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Content-Type:
22
+ - text/xml
23
+ Connection:
24
+ - close
25
+ Server:
26
+ - mogreet moms api
27
+ - pserver
28
+ Host:
29
+ - leffe.mogreet.com:96
30
+ Content-Length:
31
+ - "147"
32
+ Language:
33
+ - en
34
+ Type:
35
+ - text/xml
36
+ Status:
37
+ - OK
38
+ body:
39
+ encoding: US-ASCII
40
+ string: |
41
+ {
42
+ "response": {
43
+ "code": "1",
44
+ "status": "success",
45
+ "message": "API Request Accepted",
46
+ "message_id": "184801357",
47
+ "hash": "d4coz040"
48
+ }
49
+ }
50
+
51
+ http_version:
52
+ recorded_at: Thu, 21 Mar 2013 23:00:04 GMT
53
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.mogreet.com/cm/keyword.add?campaign_id=20948&client_id=1010101&format=json&keyword=reallylongkeyword12345&shortcode=343434&token=xyxyxyxyxyxyxyxyxyxyxyxyxyx
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Wed, 20 Mar 2013 23:25:47 GMT
23
+ Server:
24
+ - Apache/2.2.21 (Unix) Phusion_Passenger/3.0.11 mod_ssl/2.2.21 OpenSSL/0.9.8q
25
+ X-Powered-By:
26
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
27
+ X-Ua-Compatible:
28
+ - IE=Edge,chrome=1
29
+ Etag:
30
+ - "\"89b0c440ceea5ae6d59d1b9091f59ae6\""
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Runtime:
34
+ - "1.463485"
35
+ X-Rack-Cache:
36
+ - miss
37
+ Status:
38
+ - "200"
39
+ Content-Length:
40
+ - "96"
41
+ Content-Type:
42
+ - application/json; charset=utf-8
43
+ body:
44
+ encoding: US-ASCII
45
+ string: |
46
+ {
47
+ "response": {
48
+ "code": "1",
49
+ "status": "success",
50
+ "message": "keyword added"
51
+ }
52
+ }
53
+
54
+ http_version:
55
+ recorded_at: Wed, 20 Mar 2013 23:25:37 GMT
56
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,57 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.mogreet.com/cm/keyword.check?client_id=1010101&format=json&keyword=reallylongkeyword12345&shortcode=343434&token=xyxyxyxyxyxyxyxyxyxyxyxyxyx
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Wed, 20 Mar 2013 23:25:49 GMT
23
+ Server:
24
+ - Apache/2.2.21 (Unix) Phusion_Passenger/3.0.11 mod_ssl/2.2.21 OpenSSL/0.9.8q
25
+ X-Powered-By:
26
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
27
+ X-Ua-Compatible:
28
+ - IE=Edge,chrome=1
29
+ Etag:
30
+ - "\"eece87ef7693bba29fc82fcb3253b952\""
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Runtime:
34
+ - "1.137230"
35
+ X-Rack-Cache:
36
+ - miss
37
+ Status:
38
+ - "200"
39
+ Content-Length:
40
+ - "123"
41
+ Content-Type:
42
+ - application/json; charset=utf-8
43
+ body:
44
+ encoding: US-ASCII
45
+ string: |
46
+ {
47
+ "response": {
48
+ "code": "1",
49
+ "status": "success",
50
+ "message": "Keyword available",
51
+ "available": "true"
52
+ }
53
+ }
54
+
55
+ http_version:
56
+ recorded_at: Wed, 20 Mar 2013 23:25:38 GMT
57
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,121 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.mogreet.com/cm/keyword.list?client_id=1010101&format=json&query=%7B%7D&token=xyxyxyxyxyxyxyxyxyxyxyxyxyx
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Wed, 20 Mar 2013 23:15:50 GMT
23
+ Server:
24
+ - Apache/2.2.21 (Unix) Phusion_Passenger/3.0.11 mod_ssl/2.2.21 OpenSSL/0.9.8q
25
+ X-Powered-By:
26
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
27
+ X-Ua-Compatible:
28
+ - IE=Edge,chrome=1
29
+ Etag:
30
+ - "\"8bf6b18fd8af79f8a548617f3e2ca13e\""
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Runtime:
34
+ - "0.603146"
35
+ X-Rack-Cache:
36
+ - miss
37
+ Status:
38
+ - "200"
39
+ Content-Length:
40
+ - "175"
41
+ Content-Type:
42
+ - application/json; charset=utf-8
43
+ body:
44
+ encoding: US-ASCII
45
+ string: |
46
+ {
47
+ "response": {
48
+ "code": "1",
49
+ "status": "success",
50
+ "message": "keywords retrieved",
51
+ "keywords": [
52
+ {
53
+ "name": "PAULF",
54
+ "master": "true"
55
+ }
56
+ ]
57
+ }
58
+ }
59
+
60
+ http_version:
61
+ recorded_at: Wed, 20 Mar 2013 23:15:51 GMT
62
+ - request:
63
+ method: get
64
+ uri: https://api.mogreet.com/cm/keyword.list?client_id=1010101&format=json&token=xyxyxyxyxyxyxyxyxyxyxyxyxyx
65
+ body:
66
+ encoding: US-ASCII
67
+ string: ""
68
+ headers:
69
+ Accept:
70
+ - "*/*; q=0.5, application/xml"
71
+ Accept-Encoding:
72
+ - gzip, deflate
73
+ User-Agent:
74
+ - Ruby
75
+ response:
76
+ status:
77
+ code: 200
78
+ message: OK
79
+ headers:
80
+ Date:
81
+ - Wed, 20 Mar 2013 23:21:37 GMT
82
+ Server:
83
+ - Apache/2.2.21 (Unix) Phusion_Passenger/3.0.11 mod_ssl/2.2.21 OpenSSL/0.9.8q
84
+ X-Powered-By:
85
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
86
+ X-Ua-Compatible:
87
+ - IE=Edge,chrome=1
88
+ Etag:
89
+ - "\"8bf6b18fd8af79f8a548617f3e2ca13e\""
90
+ Cache-Control:
91
+ - max-age=0, private, must-revalidate
92
+ X-Runtime:
93
+ - "0.584184"
94
+ X-Rack-Cache:
95
+ - miss
96
+ Status:
97
+ - "200"
98
+ Content-Length:
99
+ - "175"
100
+ Content-Type:
101
+ - application/json; charset=utf-8
102
+ body:
103
+ encoding: US-ASCII
104
+ string: |
105
+ {
106
+ "response": {
107
+ "code": "1",
108
+ "status": "success",
109
+ "message": "keywords retrieved",
110
+ "keywords": [
111
+ {
112
+ "name": "PAULF",
113
+ "master": "true"
114
+ }
115
+ ]
116
+ }
117
+ }
118
+
119
+ http_version:
120
+ recorded_at: Wed, 20 Mar 2013 23:21:25 GMT
121
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,56 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.mogreet.com/cm/keyword.remove?campaign_id=20948&client_id=1010101&format=json&keyword=reallylongkeyword12345&shortcode=343434&token=xyxyxyxyxyxyxyxyxyxyxyxyxyx
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Wed, 20 Mar 2013 23:26:47 GMT
23
+ Server:
24
+ - Apache/2.2.21 (Unix) Phusion_Passenger/3.0.11 mod_ssl/2.2.21 OpenSSL/0.9.8q
25
+ X-Powered-By:
26
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
27
+ X-Ua-Compatible:
28
+ - IE=Edge,chrome=1
29
+ Etag:
30
+ - "\"2afc624c0a482722b7caea997b3a7732\""
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Runtime:
34
+ - "1.783962"
35
+ X-Rack-Cache:
36
+ - miss
37
+ Status:
38
+ - "200"
39
+ Content-Length:
40
+ - "98"
41
+ Content-Type:
42
+ - application/json; charset=utf-8
43
+ body:
44
+ encoding: US-ASCII
45
+ string: |
46
+ {
47
+ "response": {
48
+ "code": "1",
49
+ "status": "success",
50
+ "message": "keyword removed"
51
+ }
52
+ }
53
+
54
+ http_version:
55
+ recorded_at: Wed, 20 Mar 2013 23:26:49 GMT
56
+ recorded_with: VCR 2.4.0
@@ -0,0 +1,61 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: https://api.mogreet.com/cm/list.append?client_id=1010101&format=json&list_id=8228&numbers=3108675309&token=xyxyxyxyxyxyxyxyxyxyxyxyxyx
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ""
9
+ headers:
10
+ Accept:
11
+ - "*/*; q=0.5, application/xml"
12
+ Accept-Encoding:
13
+ - gzip, deflate
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Date:
22
+ - Thu, 21 Mar 2013 19:40:37 GMT
23
+ Server:
24
+ - Apache/2.2.21 (Unix) Phusion_Passenger/3.0.11 mod_ssl/2.2.21 OpenSSL/0.9.8q
25
+ X-Powered-By:
26
+ - Phusion Passenger (mod_rails/mod_rack) 3.0.11
27
+ X-Ua-Compatible:
28
+ - IE=Edge,chrome=1
29
+ Etag:
30
+ - "\"f203c0416699279d3e1b17298995d9da\""
31
+ Cache-Control:
32
+ - max-age=0, private, must-revalidate
33
+ X-Runtime:
34
+ - "0.232925"
35
+ X-Rack-Cache:
36
+ - miss
37
+ Status:
38
+ - "200"
39
+ Content-Length:
40
+ - "182"
41
+ Content-Type:
42
+ - application/json; charset=utf-8
43
+ body:
44
+ encoding: US-ASCII
45
+ string: |
46
+ {
47
+ "response": {
48
+ "code": "1",
49
+ "status": "success",
50
+ "message": "request processed",
51
+ "statistics": {
52
+ "created": "1",
53
+ "duplicate": "0",
54
+ "rejected": "0"
55
+ }
56
+ }
57
+ }
58
+
59
+ http_version:
60
+ recorded_at: Thu, 21 Mar 2013 19:40:25 GMT
61
+ recorded_with: VCR 2.4.0