jarvis-cli 0.0.4 → 0.0.5

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c26b44a300bbc904164ecdbc1cd144df389f805c
4
- data.tar.gz: 08857899933477e2adb38afca39c835d481d7bdb
3
+ metadata.gz: 6cef0b81ef3627d403897362e432aa2da25b79cf
4
+ data.tar.gz: a7a3e63709bc53be48677a113ce5ac23b3dacad2
5
5
  SHA512:
6
- metadata.gz: b0974d434a5b97a70a03d8541beed904b3c45657f75574f8ddf0e91ff6b39eea320408e395ce90963f7a1fa71a34eb42b76078a4886419b16288cc09db3f73cc
7
- data.tar.gz: c66896af2af9037b620aa5fc9425fa7e8c735ac01579b864b3b5349eb7c6980834ecc1ec257823277dd38895b3183bd4728df6b491d6ae2b1cfe4f3276060d69
6
+ metadata.gz: b4dea81fd7c1857539b681929901af395f1976ef8e7e370985bb14eb3387a39436fa98e31090aa1c4e364c5eb9450e4f8248cf6e1209712357497352983c28e3
7
+ data.tar.gz: bd9e91beae5f2042ccb06abe40efb967f39d102ec54c15613ca0f99f95562a3f9c4acacf949d0ea395ed40ae61101322a0176535d4fe5d2c9f1c77ba2d68915f
data/.gitignore CHANGED
@@ -20,3 +20,4 @@ tmp
20
20
  *.o
21
21
  *.a
22
22
  mkmf.log
23
+ variables.sh
data/README.md CHANGED
@@ -30,10 +30,10 @@ $ jarvis new my-bot
30
30
 
31
31
  ### Registering Services
32
32
 
33
- `/app/server.rb` is the main brain of your Jarvis bot. Here you can register which services you want to be available on your chatbot.
33
+ `/bot/server.rb` is the main brain of your Jarvis bot. Here you can register which services you want to be available on your chatbot.
34
34
 
35
35
  ```ruby
36
- class MyBot < Jarvis::Server
36
+ class Server < Jarvis::Server
37
37
  register_services :twitter, :img_flip, :urban_dictionary, :weather
38
38
  end
39
39
  ```
@@ -116,6 +116,13 @@ class Joke < Jarvis::Service
116
116
  end
117
117
  end
118
118
  ```
119
+ ## TODO
120
+
121
+ * Finish Porting The Services from the original bot to the framework
122
+ * Add Test Framework to the Project Generator
123
+ * Service Generator
124
+ * Configure all the things
125
+
119
126
  ## Contributing
120
127
 
121
128
  1. Fork it ( https://github.com/[my-github-username]/jarvis_server/fork )
@@ -0,0 +1,40 @@
1
+ @vcr
2
+ Feature: Giphy Service
3
+ In order to amuse my team
4
+ As a lover of GIFs
5
+ I want Jarvis to return random GIFs from a variety of categories
6
+
7
+ Scenario: Plain old GIF
8
+ Given a server is running with the giphy service enabled
9
+ When Jarvis recieves the message "Jarvis a gif please"
10
+ Then Jarvis will respond with "http://s3.amazonaws.com/giphymedia/media/10eqhIldgc59za/giphy.gif"
11
+
12
+ Scenario: Cat GIF - Cat Wording
13
+ Given a server is running with the giphy service enabled
14
+ When Jarvis recieves the message "Jarvis a cat gif please"
15
+ Then Jarvis will respond with "http://s3.amazonaws.com/giphymedia/media/ucEr1xRMsj6Fi/giphy.gif"
16
+
17
+ Scenario: Cat GIF - Kitty Wording
18
+ Given a server is running with the giphy service enabled
19
+ When Jarvis recieves the message "Jarvis a Kitty gif please"
20
+ Then Jarvis will respond with "http://s3.amazonaws.com/giphymedia/media/xA88mlhRVZ3lm/giphy.gif"
21
+
22
+ Scenario: Cat GIF - Kitty Wording - Case Insensitive
23
+ Given a server is running with the giphy service enabled
24
+ When Jarvis recieves the message "Jarvis a KiTty gif please"
25
+ Then Jarvis will respond with "http://s3.amazonaws.com/giphymedia/media/paYyHCsUUXQPK/giphy.gif"
26
+
27
+ Scenario: Sloth
28
+ Given a server is running with the giphy service enabled
29
+ When Jarvis recieves the message "Jarvis a sloth gif please"
30
+ Then Jarvis will respond with "http://s3.amazonaws.com/giphymedia/media/QoxeDUyerqIrC/giphy.gif"
31
+
32
+ Scenario: Bacon
33
+ Given a server is running with the giphy service enabled
34
+ When Jarvis recieves the message "Jarvis a bacon gif please"
35
+ Then Jarvis will respond with "http://s3.amazonaws.com/giphymedia/media/PJ3wMa5ImiVY4/giphy.gif"
36
+
37
+ Scenario: Trippy
38
+ Given a server is running with the giphy service enabled
39
+ When Jarvis recieves the message "Jarvis a sloth gif please"
40
+ Then Jarvis will respond with "http://s3.amazonaws.com/giphymedia/media/upNoNLqei1FVS/giphy.gif"
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=bacon
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:44:24 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '1468311114'
47
+ Content-Length:
48
+ - '369'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"PJ3wMa5ImiVY4","url":"http:\/\/giphy.com\/gifs\/bacon-PJ3wMa5ImiVY4","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/giphy.mp4","image_frames":"92","image_width":"360","image_height":"480","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/200_d.gif","fixed_height_downsampled_width":"150","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"267","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/100_s.gif","fixed_height_small_width":"75","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/PJ3wMa5ImiVY4\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"133","rating":"g","username":"","caption":"","tags":["bacon"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:44:27 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=cat
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:44:12 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '133998923'
47
+ Content-Length:
48
+ - '385'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"ucEr1xRMsj6Fi","url":"http:\/\/giphy.com\/gifs\/cat-talking-ucEr1xRMsj6Fi","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/giphy.mp4","image_frames":"8","image_width":"500","image_height":"255","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/200_d.gif","fixed_height_downsampled_width":"392","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"102","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/100_s.gif","fixed_height_small_width":"196","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/ucEr1xRMsj6Fi\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"51","rating":"g","username":"","caption":"","tags":["cat","animals","talking","meow"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:44:26 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=cat
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:44:23 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '1468311092'
47
+ Content-Length:
48
+ - '388'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"xA88mlhRVZ3lm","url":"http:\/\/giphy.com\/gifs\/cat-oops-xA88mlhRVZ3lm","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/giphy.mp4","image_frames":"74","image_width":"385","image_height":"355","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/200_d.gif","fixed_height_downsampled_width":"217","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"184","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/100_s.gif","fixed_height_small_width":"108","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/xA88mlhRVZ3lm\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"92","rating":"g","username":"","caption":"","tags":["cat","cat","buzzfeed","shit","oops"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:44:26 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=cat
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:43:15 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '2077463139'
47
+ Content-Length:
48
+ - '394'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"paYyHCsUUXQPK","url":"http:\/\/giphy.com\/gifs\/cat-robot-playing-paYyHCsUUXQPK","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/giphy.mp4","image_frames":"50","image_width":"500","image_height":"281","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/200_d.gif","fixed_height_downsampled_width":"356","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"112","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/100_s.gif","fixed_height_small_width":"178","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/paYyHCsUUXQPK\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"56","rating":"g","username":"","caption":"video","tags":["cat","robot","playing","toy"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:44:26 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:42:42 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '488624767'
47
+ Content-Length:
48
+ - '389'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"10eqhIldgc59za","url":"http:\/\/giphy.com\/gifs\/horror-clown-fatboy-10eqhIldgc59za","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/giphy.mp4","image_frames":"11","image_width":"482","image_height":"267","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/200_d.gif","fixed_height_downsampled_width":"361","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"111","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/100_s.gif","fixed_height_small_width":"181","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10eqhIldgc59za\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"55","rating":"pg","username":"","caption":"","tags":["horror","clown","fatboy"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:42:10 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=sloth
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:44:03 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '1041668836'
47
+ Content-Length:
48
+ - '393'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"QoxeDUyerqIrC","url":"http:\/\/giphy.com\/gifs\/tired-morning-sloth-QoxeDUyerqIrC","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/giphy.mp4","image_frames":"25","image_width":"250","image_height":"125","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/200_d.gif","fixed_height_downsampled_width":"400","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"100","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/100_s.gif","fixed_height_small_width":"200","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/QoxeDUyerqIrC\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"50","rating":"pg-13","username":"","caption":"","tags":["animals","tired","morning","sloth","monday"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:44:27 GMT
58
+ recorded_with: VCR 2.9.3
@@ -0,0 +1,58 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=sloth
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:44:15 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '531912009'
47
+ Content-Length:
48
+ - '426'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"upNoNLqei1FVS","url":"http:\/\/giphy.com\/gifs\/sloth-eating-upNoNLqei1FVS","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/giphy.mp4","image_frames":"53","image_width":"245","image_height":"184","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/200_d.gif","fixed_height_downsampled_width":"266","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"150","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/100_s.gif","fixed_height_small_width":"133","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/upNoNLqei1FVS\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"75","rating":"g","username":"","caption":"warholing beyonces me myself and i playing","tags":["animals","eating","sloth","lazy","relaxed"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:44:27 GMT
58
+ recorded_with: VCR 2.9.3
@@ -7,11 +7,18 @@ require 'jarvis/exceptions'
7
7
  require 'jarvis/interpreter'
8
8
  require 'jarvis/services'
9
9
  require 'jarvis/slack'
10
+ require 'jarvis/api/response'
10
11
  require 'httparty'
11
12
  require 'uri'
13
+ require 'active_support/configurable'
12
14
 
13
15
  module Jarvis
14
16
  include HTTParty
17
+ include ActiveSupport::Configurable
18
+
19
+ self.configure do |config|
20
+ end
21
+
15
22
  class << self
16
23
 
17
24
  attr_accessor :services
@@ -29,7 +36,7 @@ module Jarvis
29
36
  end
30
37
 
31
38
  def get(*args, &blk)
32
- HTTParty.get(*args, &blk)
39
+ Jarvis::API::Response.new HTTParty.get(*args, &blk)
33
40
  end
34
41
 
35
42
  end
@@ -0,0 +1,12 @@
1
+ module Jarvis
2
+ module API
3
+ class Response
4
+ attr_accessor :status, :response
5
+
6
+ def initialize(response)
7
+ @status = response.code
8
+ @response = response.parsed_response
9
+ end
10
+ end
11
+ end
12
+ end
@@ -19,7 +19,7 @@ module Jarvis
19
19
  rescue Jarvis::UnfitEnvironmentException => e
20
20
  json text: "I'm really sorry, but that sevice needs to be configured"
21
21
  rescue => e
22
- json text: "I'm sorry, Something went wrong"
22
+ json text: "I'm sorry, Something went wrong: #{e}"
23
23
  end
24
24
  end
25
25
 
@@ -2,3 +2,4 @@ require 'jarvis/services/null_service'
2
2
  require 'jarvis/services/dice'
3
3
  require 'jarvis/services/eightball'
4
4
  require 'jarvis/services/fact'
5
+ require 'jarvis/services/giphy'
@@ -2,6 +2,6 @@ class Fact < Jarvis::Service
2
2
  phrases "fact"
3
3
 
4
4
  def run
5
- Jarvis.get("http://numbersapi.com/random").parsed_response
5
+ Jarvis.get("http://numbersapi.com/random").response
6
6
  end
7
7
  end
@@ -0,0 +1,38 @@
1
+ class Giphy < Jarvis::Service
2
+ phrases "gif"
3
+ environment :giphy_api_version, :giphy_api_key
4
+ before_invoke :build_request_url
5
+ attr_accessor :request_url
6
+ def run
7
+ Jarvis.get(request_url).response["data"]["image_url"]
8
+ end
9
+
10
+ private
11
+
12
+ def build_request_url
13
+ self.request_url = "#{host}#{endpoint}random?api_key=#{giphy_api_key}#{additional_params}"
14
+ end
15
+
16
+ def host
17
+ "http://api.giphy.com/"
18
+ end
19
+
20
+ def endpoint
21
+ "#{giphy_api_version}/gifs/"
22
+ end
23
+
24
+ def additional_params
25
+ case text
26
+ when /Cat|Kitty/i
27
+ "&tag=cat"
28
+ when /sloth/i
29
+ "&tag=sloth"
30
+ when /bacon/i
31
+ "&tag=bacon"
32
+ when /trippy/i
33
+ "&tag=trippy"
34
+ else
35
+ ""
36
+ end
37
+ end
38
+ end
@@ -1,3 +1,3 @@
1
1
  module Jarvis
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.5"
3
3
  end
@@ -0,0 +1,45 @@
1
+ require 'spec_helper'
2
+
3
+ RSpec.describe Giphy, vcr: { cassette_name: 'giphy', :record => :new_episodes} do
4
+ describe "Any old GIF" do
5
+ let(:message) { Slack::Message.new(slack_outgoing_message(text: "Jarvis, a gif please")) }
6
+ subject { described_class.new message }
7
+ it { expect(subject.invoke).to eq "http://s3.amazonaws.com/giphymedia/media/10BhvFXneBD6X6/giphy.gif" }
8
+ it { expect(subject.send(:additional_params)).to eq "" } # No tags
9
+ end
10
+
11
+ describe "Cat GIF" do
12
+ let(:message) { Slack::Message.new(slack_outgoing_message(text: "Jarvis, a cat gif please")) }
13
+ subject { described_class.new message }
14
+ it { expect(subject.invoke).to eq "http://s3.amazonaws.com/giphymedia/media/4u8WdgQEMVaj6/giphy.gif" }
15
+ it { expect(subject.send(:additional_params)).to eq "&tag=cat" }
16
+ end
17
+
18
+ describe "Kitty GIF" do
19
+ let(:message) { Slack::Message.new(slack_outgoing_message(text: "Jarvis, a Kitty gif please")) }
20
+ subject { described_class.new message }
21
+ it { expect(subject.invoke).to eq "http://s3.amazonaws.com/giphymedia/media/4u8WdgQEMVaj6/giphy.gif" }
22
+ it { expect(subject.send(:additional_params)).to eq "&tag=cat" }
23
+ end
24
+
25
+ describe "Sloth GIF" do
26
+ let(:message) { Slack::Message.new(slack_outgoing_message(text: "Jarvis, a sloth gif please")) }
27
+ subject { described_class.new message }
28
+ it { expect(subject.invoke).to eq "http://s3.amazonaws.com/giphymedia/media/FsjDdnIRcroIM/giphy.gif" }
29
+ it { expect(subject.send(:additional_params)).to eq "&tag=sloth" }
30
+ end
31
+
32
+ describe "Bacon GIF" do
33
+ let(:message) { Slack::Message.new(slack_outgoing_message(text: "Jarvis, a bacon gif please")) }
34
+ subject { described_class.new message }
35
+ it { expect(subject.invoke).to eq "http://s3.amazonaws.com/giphymedia/media/La4sAOzY9H8L6/giphy.gif" }
36
+ it { expect(subject.send(:additional_params)).to eq "&tag=bacon" }
37
+ end
38
+
39
+ describe "Trippy GIF" do
40
+ let(:message) { Slack::Message.new(slack_outgoing_message(text: "Jarvis, a trippy gif please")) }
41
+ subject { described_class.new message }
42
+ it { expect(subject.invoke).to eq "http://s3.amazonaws.com/giphymedia/media/muAhZqHWt0bv2/giphy.gif" }
43
+ it { expect(subject.send(:additional_params)).to eq "&tag=trippy" }
44
+ end
45
+ end
@@ -7,8 +7,10 @@ require 'byebug'
7
7
  require 'vcr'
8
8
  require_relative './support/shared_contexts/service'
9
9
  require_relative './support/shared_contexts/server'
10
+ require 'jarvis/test_support/test_support'
10
11
 
11
12
  include Rack::Test::Methods
13
+ include Jarvis::TestSupport
12
14
 
13
15
  def app
14
16
  Jarvis::Server
@@ -20,19 +22,6 @@ def stub_env(hash)
20
22
  end
21
23
  end
22
24
 
23
- def slack_outgoing_message(options={text:"Jarvis, what's going on?"})
24
- {
25
- "team_id" => options[:team_id] || "T0001",
26
- "channel_id" => options[:channel_id] || "BLAH",
27
- "channel_name" => options[:channel_name] || "test",
28
- "timestamp" => options[:timestamp] || "1355517523.000005",
29
- "user_id" => options[:user_id] || "U2147483697",
30
- "user_name" => options[:user_name] || "Steve",
31
- "text" => options[:text],
32
- "trigger_word" => options[:trigger_word] || "Jarvis"
33
- }
34
- end
35
-
36
25
  RSpec.configure do |config|
37
26
  config.expose_dsl_globally = false
38
27
  config.around(:each) do |example|
@@ -0,0 +1,278 @@
1
+ ---
2
+ http_interactions:
3
+ - request:
4
+ method: get
5
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC
6
+ body:
7
+ encoding: US-ASCII
8
+ string: ''
9
+ headers:
10
+ Accept-Encoding:
11
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
12
+ Accept:
13
+ - "*/*"
14
+ User-Agent:
15
+ - Ruby
16
+ response:
17
+ status:
18
+ code: 200
19
+ message: OK
20
+ headers:
21
+ Accept-Ranges:
22
+ - bytes
23
+ Access-Control-Allow-Credentials:
24
+ - 'true'
25
+ Access-Control-Allow-Headers:
26
+ - Content-Type, Accept
27
+ Access-Control-Allow-Methods:
28
+ - GET, POST, PUT, DELETE, OPTIONS
29
+ Access-Control-Allow-Origin:
30
+ - "*"
31
+ Age:
32
+ - '0'
33
+ Content-Type:
34
+ - application/json
35
+ Date:
36
+ - Fri, 20 Feb 2015 20:30:34 GMT
37
+ Server:
38
+ - nginx/1.4.6 (Ubuntu)
39
+ Vary:
40
+ - Accept-Encoding
41
+ Via:
42
+ - 1.1 varnish
43
+ X-Powered-By:
44
+ - PHP/5.5.9-1ubuntu4
45
+ X-Varnish:
46
+ - '133978543'
47
+ Content-Length:
48
+ - '384'
49
+ Connection:
50
+ - keep-alive
51
+ body:
52
+ encoding: UTF-8
53
+ string: |2-
54
+
55
+ {"data":{"type":"gif","id":"10BhvFXneBD6X6","url":"http:\/\/giphy.com\/gifs\/xavi-hernndez-10BhvFXneBD6X6","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/giphy.mp4","image_frames":"37","image_width":"160","image_height":"260","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/200_d.gif","fixed_height_downsampled_width":"123","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"325","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/100_s.gif","fixed_height_small_width":"62","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/10BhvFXneBD6X6\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"163","rating":"g","username":"","caption":"","tags":["xavi","xavi hernndez"]},"meta":{"status":200,"msg":"OK"}}
56
+ http_version:
57
+ recorded_at: Fri, 20 Feb 2015 20:30:48 GMT
58
+ - request:
59
+ method: get
60
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=cat
61
+ body:
62
+ encoding: US-ASCII
63
+ string: ''
64
+ headers:
65
+ Accept-Encoding:
66
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
67
+ Accept:
68
+ - "*/*"
69
+ User-Agent:
70
+ - Ruby
71
+ response:
72
+ status:
73
+ code: 200
74
+ message: OK
75
+ headers:
76
+ Accept-Ranges:
77
+ - bytes
78
+ Access-Control-Allow-Credentials:
79
+ - 'true'
80
+ Access-Control-Allow-Headers:
81
+ - Content-Type, Accept
82
+ Access-Control-Allow-Methods:
83
+ - GET, POST, PUT, DELETE, OPTIONS
84
+ Access-Control-Allow-Origin:
85
+ - "*"
86
+ Age:
87
+ - '0'
88
+ Content-Type:
89
+ - application/json
90
+ Date:
91
+ - Fri, 20 Feb 2015 20:34:55 GMT
92
+ Server:
93
+ - nginx/1.4.6 (Ubuntu)
94
+ Vary:
95
+ - Accept-Encoding
96
+ Via:
97
+ - 1.1 varnish
98
+ X-Powered-By:
99
+ - PHP/5.5.9-1ubuntu4
100
+ X-Varnish:
101
+ - '133985085'
102
+ Content-Length:
103
+ - '386'
104
+ Connection:
105
+ - keep-alive
106
+ body:
107
+ encoding: UTF-8
108
+ string: |2-
109
+
110
+ {"data":{"type":"gif","id":"4u8WdgQEMVaj6","url":"http:\/\/giphy.com\/gifs\/cat-kitten-please-4u8WdgQEMVaj6","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/giphy.mp4","image_frames":"95","image_width":"240","image_height":"181","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/200_d.gif","fixed_height_downsampled_width":"265","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"151","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/100_s.gif","fixed_height_small_width":"133","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/4u8WdgQEMVaj6\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"75","rating":"g","username":"","caption":"","tags":["cat","kitten","please","beg"]},"meta":{"status":200,"msg":"OK"}}
111
+ http_version:
112
+ recorded_at: Fri, 20 Feb 2015 20:35:08 GMT
113
+ - request:
114
+ method: get
115
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=sloth
116
+ body:
117
+ encoding: US-ASCII
118
+ string: ''
119
+ headers:
120
+ Accept-Encoding:
121
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
122
+ Accept:
123
+ - "*/*"
124
+ User-Agent:
125
+ - Ruby
126
+ response:
127
+ status:
128
+ code: 200
129
+ message: OK
130
+ headers:
131
+ Accept-Ranges:
132
+ - bytes
133
+ Access-Control-Allow-Credentials:
134
+ - 'true'
135
+ Access-Control-Allow-Headers:
136
+ - Content-Type, Accept
137
+ Access-Control-Allow-Methods:
138
+ - GET, POST, PUT, DELETE, OPTIONS
139
+ Access-Control-Allow-Origin:
140
+ - "*"
141
+ Age:
142
+ - '0'
143
+ Content-Type:
144
+ - application/json
145
+ Date:
146
+ - Fri, 20 Feb 2015 20:36:21 GMT
147
+ Server:
148
+ - nginx/1.4.6 (Ubuntu)
149
+ Vary:
150
+ - Accept-Encoding
151
+ Via:
152
+ - 1.1 varnish
153
+ X-Powered-By:
154
+ - PHP/5.5.9-1ubuntu4
155
+ X-Varnish:
156
+ - '133986589'
157
+ Content-Length:
158
+ - '403'
159
+ Connection:
160
+ - keep-alive
161
+ body:
162
+ encoding: UTF-8
163
+ string: |2-
164
+
165
+ {"data":{"type":"gif","id":"FsjDdnIRcroIM","url":"http:\/\/giphy.com\/gifs\/cheezburger-sloth-yawn-FsjDdnIRcroIM","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/giphy.mp4","image_frames":"90","image_width":"300","image_height":"169","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/200_d.gif","fixed_height_downsampled_width":"355","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"113","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/100_s.gif","fixed_height_small_width":"178","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/FsjDdnIRcroIM\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"56","rating":"pg","username":"cheezburger","caption":"","tags":["animals","cute","tired","sloth","yawn"]},"meta":{"status":200,"msg":"OK"}}
166
+ http_version:
167
+ recorded_at: Fri, 20 Feb 2015 20:36:35 GMT
168
+ - request:
169
+ method: get
170
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=bacon
171
+ body:
172
+ encoding: US-ASCII
173
+ string: ''
174
+ headers:
175
+ Accept-Encoding:
176
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
177
+ Accept:
178
+ - "*/*"
179
+ User-Agent:
180
+ - Ruby
181
+ response:
182
+ status:
183
+ code: 200
184
+ message: OK
185
+ headers:
186
+ Accept-Ranges:
187
+ - bytes
188
+ Access-Control-Allow-Credentials:
189
+ - 'true'
190
+ Access-Control-Allow-Headers:
191
+ - Content-Type, Accept
192
+ Access-Control-Allow-Methods:
193
+ - GET, POST, PUT, DELETE, OPTIONS
194
+ Access-Control-Allow-Origin:
195
+ - "*"
196
+ Age:
197
+ - '0'
198
+ Content-Type:
199
+ - application/json
200
+ Date:
201
+ - Fri, 20 Feb 2015 20:38:16 GMT
202
+ Server:
203
+ - nginx/1.4.6 (Ubuntu)
204
+ Vary:
205
+ - Accept-Encoding
206
+ Via:
207
+ - 1.1 varnish
208
+ X-Powered-By:
209
+ - PHP/5.5.9-1ubuntu4
210
+ X-Varnish:
211
+ - '488618084'
212
+ Content-Length:
213
+ - '371'
214
+ Connection:
215
+ - keep-alive
216
+ body:
217
+ encoding: UTF-8
218
+ string: |2-
219
+
220
+ {"data":{"type":"gif","id":"La4sAOzY9H8L6","url":"http:\/\/giphy.com\/gifs\/bacon-La4sAOzY9H8L6","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/giphy.mp4","image_frames":"59","image_width":"500","image_height":"281","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/200_d.gif","fixed_height_downsampled_width":"356","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"112","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/100_s.gif","fixed_height_small_width":"178","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/La4sAOzY9H8L6\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"56","rating":"g","username":"","caption":"","tags":["bacon"]},"meta":{"status":200,"msg":"OK"}}
221
+ http_version:
222
+ recorded_at: Fri, 20 Feb 2015 20:37:44 GMT
223
+ - request:
224
+ method: get
225
+ uri: http://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=trippy
226
+ body:
227
+ encoding: US-ASCII
228
+ string: ''
229
+ headers:
230
+ Accept-Encoding:
231
+ - gzip;q=1.0,deflate;q=0.6,identity;q=0.3
232
+ Accept:
233
+ - "*/*"
234
+ User-Agent:
235
+ - Ruby
236
+ response:
237
+ status:
238
+ code: 200
239
+ message: OK
240
+ headers:
241
+ Accept-Ranges:
242
+ - bytes
243
+ Access-Control-Allow-Credentials:
244
+ - 'true'
245
+ Access-Control-Allow-Headers:
246
+ - Content-Type, Accept
247
+ Access-Control-Allow-Methods:
248
+ - GET, POST, PUT, DELETE, OPTIONS
249
+ Access-Control-Allow-Origin:
250
+ - "*"
251
+ Age:
252
+ - '0'
253
+ Content-Type:
254
+ - application/json
255
+ Date:
256
+ - Fri, 20 Feb 2015 20:38:45 GMT
257
+ Server:
258
+ - nginx/1.4.6 (Ubuntu)
259
+ Vary:
260
+ - Accept-Encoding
261
+ Via:
262
+ - 1.1 varnish
263
+ X-Powered-By:
264
+ - PHP/5.5.9-1ubuntu4
265
+ X-Varnish:
266
+ - '298562229'
267
+ Content-Length:
268
+ - '396'
269
+ Connection:
270
+ - keep-alive
271
+ body:
272
+ encoding: UTF-8
273
+ string: |2-
274
+
275
+ {"data":{"type":"gif","id":"muAhZqHWt0bv2","url":"http:\/\/giphy.com\/gifs\/trippy-psychedelic-eye-muAhZqHWt0bv2","image_original_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/giphy.gif","image_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/giphy.gif","image_mp4_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/giphy.mp4","image_frames":"19","image_width":"500","image_height":"369","fixed_height_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/200_d.gif","fixed_height_downsampled_width":"271","fixed_height_downsampled_height":"200","fixed_width_downsampled_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/200w_d.gif","fixed_width_downsampled_width":"200","fixed_width_downsampled_height":"148","fixed_height_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/100.gif","fixed_height_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/100_s.gif","fixed_height_small_width":"136","fixed_height_small_height":"100","fixed_width_small_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/100w.gif","fixed_width_small_still_url":"http:\/\/s3.amazonaws.com\/giphymedia\/media\/muAhZqHWt0bv2\/100w_s.gif","fixed_width_small_width":"100","fixed_width_small_height":"74","rating":"y","username":"","caption":"","tags":["trippy","psychedelic","eye","camera","flash"]},"meta":{"status":200,"msg":"OK"}}
276
+ http_version:
277
+ recorded_at: Fri, 20 Feb 2015 20:38:45 GMT
278
+ recorded_with: VCR 2.9.3
@@ -1,6 +1,6 @@
1
1
  class Server < Jarvis::Server
2
2
  # Use `register_services` to enable services in your Jarvis Bot. Available built-in services are:
3
- # :dice, :eightball, :fact
3
+ # :dice, :eightball, :fact, :giphy
4
4
  # You can make your own services with `jarvis generate service my_service`
5
5
  register_services :fact
6
6
  end
@@ -1,4 +1,4 @@
1
1
  $: << File.expand_path('../', __FILE__)
2
2
  require 'jarvis'
3
- require './app/server.rb'
3
+ require './bot/server.rb'
4
4
  run Server
File without changes
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jarvis-cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - DVG
@@ -224,13 +224,22 @@ files:
224
224
  - Rakefile
225
225
  - bin/jarvis
226
226
  - features/fact_service.feature
227
+ - features/giphy_service.feature
227
228
  - features/step_definitions/fact_service_steps.rb
228
229
  - features/step_definitions/server_steps.rb
229
230
  - features/support/env.rb
230
231
  - features/support/hooks.rb
231
232
  - features/support/vcr_cassettes/Fact_Service/Jarvis_responds_with_a_random_fact.yml
233
+ - features/support/vcr_cassettes/Giphy_Service/Bacon.yml
234
+ - features/support/vcr_cassettes/Giphy_Service/Cat_GIF_-_Cat_Wording.yml
235
+ - features/support/vcr_cassettes/Giphy_Service/Cat_GIF_-_Kitty_Wording.yml
236
+ - features/support/vcr_cassettes/Giphy_Service/Cat_GIF_-_Kitty_Wording_-_Case_Insensitive.yml
237
+ - features/support/vcr_cassettes/Giphy_Service/Plain_old_GIF.yml
238
+ - features/support/vcr_cassettes/Giphy_Service/Sloth.yml
239
+ - features/support/vcr_cassettes/Giphy_Service/Trippy.yml
232
240
  - jarvis-cli.gemspec
233
241
  - lib/jarvis.rb
242
+ - lib/jarvis/api/response.rb
234
243
  - lib/jarvis/cli.rb
235
244
  - lib/jarvis/core_ext.rb
236
245
  - lib/jarvis/core_ext/symbol.rb
@@ -242,6 +251,7 @@ files:
242
251
  - lib/jarvis/services/dice.rb
243
252
  - lib/jarvis/services/eightball.rb
244
253
  - lib/jarvis/services/fact.rb
254
+ - lib/jarvis/services/giphy.rb
245
255
  - lib/jarvis/services/null_service.rb
246
256
  - lib/jarvis/slack.rb
247
257
  - lib/jarvis/slack/message.rb
@@ -254,15 +264,18 @@ files:
254
264
  - spec/services/dice_spec.rb
255
265
  - spec/services/eightball_spec.rb
256
266
  - spec/services/fact_spec.rb
267
+ - spec/services/giphy_spec.rb
257
268
  - spec/services/null_service_spec.rb
258
269
  - spec/spec_helper.rb
259
270
  - spec/support/fixtures/vcr_cassettes/fact.yml
271
+ - spec/support/fixtures/vcr_cassettes/giphy.yml
260
272
  - spec/support/shared_contexts/server.rb
261
273
  - spec/support/shared_contexts/service.rb
262
274
  - templates/project/Gemfile
263
- - templates/project/app/server.rb
264
- - templates/project/app/services/.gitkeep
275
+ - templates/project/bot/server.rb
276
+ - templates/project/bot/services/.gitkeep
265
277
  - templates/project/config.ru
278
+ - templates/project/config/.gitkeep
266
279
  homepage: https://github.com/DVG/jarvis-cli.git
267
280
  licenses:
268
281
  - MIT
@@ -289,11 +302,19 @@ specification_version: 4
289
302
  summary: Chatbot Application Framework for Slack Chat Rooms
290
303
  test_files:
291
304
  - features/fact_service.feature
305
+ - features/giphy_service.feature
292
306
  - features/step_definitions/fact_service_steps.rb
293
307
  - features/step_definitions/server_steps.rb
294
308
  - features/support/env.rb
295
309
  - features/support/hooks.rb
296
310
  - features/support/vcr_cassettes/Fact_Service/Jarvis_responds_with_a_random_fact.yml
311
+ - features/support/vcr_cassettes/Giphy_Service/Bacon.yml
312
+ - features/support/vcr_cassettes/Giphy_Service/Cat_GIF_-_Cat_Wording.yml
313
+ - features/support/vcr_cassettes/Giphy_Service/Cat_GIF_-_Kitty_Wording.yml
314
+ - features/support/vcr_cassettes/Giphy_Service/Cat_GIF_-_Kitty_Wording_-_Case_Insensitive.yml
315
+ - features/support/vcr_cassettes/Giphy_Service/Plain_old_GIF.yml
316
+ - features/support/vcr_cassettes/Giphy_Service/Sloth.yml
317
+ - features/support/vcr_cassettes/Giphy_Service/Trippy.yml
297
318
  - spec/jarvis/interpreter_spec.rb
298
319
  - spec/jarvis/jarvis_spec.rb
299
320
  - spec/jarvis/server_spec.rb
@@ -301,8 +322,10 @@ test_files:
301
322
  - spec/services/dice_spec.rb
302
323
  - spec/services/eightball_spec.rb
303
324
  - spec/services/fact_spec.rb
325
+ - spec/services/giphy_spec.rb
304
326
  - spec/services/null_service_spec.rb
305
327
  - spec/spec_helper.rb
306
328
  - spec/support/fixtures/vcr_cassettes/fact.yml
329
+ - spec/support/fixtures/vcr_cassettes/giphy.yml
307
330
  - spec/support/shared_contexts/server.rb
308
331
  - spec/support/shared_contexts/service.rb