aylien_text_api 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +28 -0
- data/LICENSE +13 -0
- data/README.md +67 -0
- data/Rakefile +8 -0
- data/aylien_text_api.gemspec +24 -0
- data/config/app_config.yml.example +7 -0
- data/lib/aylien_text_api.rb +23 -0
- data/lib/aylien_text_api/client.rb +246 -0
- data/lib/aylien_text_api/configuration.rb +57 -0
- data/lib/aylien_text_api/connection.rb +71 -0
- data/lib/aylien_text_api/error.rb +110 -0
- data/lib/aylien_text_api/version.rb +17 -0
- data/spec/fixtures/aylien_text_api/client/classify_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/classify_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/classify_with_text.yml +48 -0
- data/spec/fixtures/aylien_text_api/client/classify_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/classify_with_valid_url.yml +98 -0
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_text.yml +48 -0
- data/spec/fixtures/aylien_text_api/client/classify_with_value_as_valid_url.yml +98 -0
- data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/concepts_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/concepts_with_text.yml +44 -0
- data/spec/fixtures/aylien_text_api/client/concepts_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/concepts_with_valid_url.yml +63 -0
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_text.yml +44 -0
- data/spec/fixtures/aylien_text_api/client/concepts_with_value_as_valid_url.yml +63 -0
- data/spec/fixtures/aylien_text_api/client/entities_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/entities_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/entities_with_text.yml +43 -0
- data/spec/fixtures/aylien_text_api/client/entities_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/entities_with_valid_url.yml +302 -0
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_text.yml +43 -0
- data/spec/fixtures/aylien_text_api/client/entities_with_value_as_valid_url.yml +302 -0
- data/spec/fixtures/aylien_text_api/client/extract_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/extract_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/extract_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/extract_with_valid_url.yml +185 -0
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_text.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/extract_with_value_as_valid_url.yml +185 -0
- data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/hashtags_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/hashtags_with_text.yml +48 -0
- data/spec/fixtures/aylien_text_api/client/hashtags_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/hashtags_with_valid_url.yml +58 -0
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_text.yml +48 -0
- data/spec/fixtures/aylien_text_api/client/hashtags_with_value_as_valid_url.yml +58 -0
- data/spec/fixtures/aylien_text_api/client/language_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/language_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/language_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/language_with_valid_text.yml +41 -0
- data/spec/fixtures/aylien_text_api/client/language_with_valid_url.yml +57 -0
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_text.yml +41 -0
- data/spec/fixtures/aylien_text_api/client/language_with_value_as_valid_url.yml +57 -0
- data/spec/fixtures/aylien_text_api/client/related_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/related_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/related_with_phrase.yml +60 -0
- data/spec/fixtures/aylien_text_api/client/related_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_phrase.yml +60 -0
- data/spec/fixtures/aylien_text_api/client/related_with_value_as_valid_url.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/sentiment_with_invalid_params.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/sentiment_with_text.yml +53 -0
- data/spec/fixtures/aylien_text_api/client/sentiment_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/sentiment_with_valid_url.yml +57 -0
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_text.yml +53 -0
- data/spec/fixtures/aylien_text_api/client/sentiment_with_value_as_valid_url.yml +57 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_client.yml +36 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_invalid_params.yml +41 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_title_and_text.yml +78 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_unauthenticated_client.yml +40 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_valid_url.yml +65 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_title.yml +78 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_text_and_without_title.yml +41 -0
- data/spec/fixtures/aylien_text_api/client/summarize_with_value_as_valid_url.yml +65 -0
- data/spec/lib/aylien_text_api/classify.rb +86 -0
- data/spec/lib/aylien_text_api/client_spec.rb +23 -0
- data/spec/lib/aylien_text_api/concepts.rb +81 -0
- data/spec/lib/aylien_text_api/entities.rb +81 -0
- data/spec/lib/aylien_text_api/extract.rb +81 -0
- data/spec/lib/aylien_text_api/hashtags.rb +87 -0
- data/spec/lib/aylien_text_api/language.rb +79 -0
- data/spec/lib/aylien_text_api/related.rb +80 -0
- data/spec/lib/aylien_text_api/sentiment.rb +91 -0
- data/spec/lib/aylien_text_api/summarize.rb +95 -0
- data/spec/spec_helper.rb +16 -0
- metadata +193 -0
@@ -0,0 +1,40 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.aylien.com/api/v1/summarize
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: text=Batman+has+always+been+my+favourite+superhero+ever+since+the+first+time+I+heard+about+him+because+he+his+human+with+no+powers%2C+also+he+is+much+more+questionable+than+any+other+superhero.+The+story+of+the+film+is+about+Batman%2C+Lieutenant+James+Gordon%2C+and+new+district+attorney+Harvey+Dent+beginning+to+succeed+in+rounding+up+the+criminals+that+plague+Gotham+City.+They+are+unexpectedly+challenged+when+a+mysterious+criminal+mastermind+known+as+the+Joker+appears+in+Gotham.+Batman%27s+struggle+against+the+Joker+becomes+deeply+personal%2C+forcing+him+to+%22confront+everything+he+believes%22+and+to+improve+his+technology+%28which+introduces+the+recreation+of+the+Batcycle%2C+known+as+the+Batpod+and+the+Batsuit+was+redesigned%29+to+stop+the+madman%27s+campaign+of+destruction.+During+the+course+of+the+film%2C+a+love+triangle+develops+between+Bruce+Wayne%2C+Dent+and+Rachel+Dawes.++There+are+now+six+Batman+films+and+I+must+say+that+The+Dark+Knight+is+the+best+out+of+all+of+them.+The+title+is+good+because+that+is+what+Batman+actually+is.+It+has+been+3+years+for+the+adventure+to+continue+from+Batman+Begins+but+that+entire+wait+was+worth+it.+Gotham+city+is+very+Gothic+looking+and+is+very+haunting+and+visionary.+The+whole+movie+is+charged+with+pulse-pounding+suspense%2C+ingenious+special+effects+and+riveting+performances+from+a+first-rate+cast+especially+from+Heath+Ledger+who+gave+an+Oscar+nomination+performance+for+best+supporting-actor.+It+is+a+shame+that+he+can%27t+see+his+terrific+work+on-screen.+The+cinematography+is+excellent+which+is+made+so+dark+%26+sinister+that+really+did+suit+the+mood+for+the+film.+Usually+sequels+don%27t+turn+out+to+be+better+than+the+original+but+The+Dark+Knight+is+one+of+those+rare+sequels+that+surpasses+the+original+like+The+Godfather+2.+I+also+really+liked+the+poster+where+the+building+is+on+fire+in+a+Bat+symbol+%26+Batman+is+standing+in+front+of+it.+Christopher+Nolan+is+a+brilliant+director+and+his+film+Memento+is+one+of+my+most+favourite+films.+He+hasn%27t+made+10+movies+yet+and+3+of+them+are+already+on+the+IMDb+top+250.+Overall+The+Dark+Knight+is+the+kind+of+movie+that+will+make+the+audience+cheer+in+the+end+instead+of+throwing+fruit+%26+vegetables+on+the+screen.
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Aylien Text API Ruby Gem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
App-Id:
|
17
|
+
- random_string
|
18
|
+
App-Key:
|
19
|
+
- random_string
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 403
|
23
|
+
message: Forbidden
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- openresty/1.5.12.1
|
27
|
+
Date:
|
28
|
+
- Tue, 02 Dec 2014 18:16:03 GMT
|
29
|
+
Content-Type:
|
30
|
+
- text/plain; charset=us-ascii
|
31
|
+
Transfer-Encoding:
|
32
|
+
- chunked
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: Authentication failed
|
38
|
+
http_version:
|
39
|
+
recorded_at: Tue, 02 Dec 2014 18:15:00 GMT
|
40
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.aylien.com/api/v1/summarize
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: url=http%3A%2F%2Fwww.bbc.com%2Fsport%2F0%2Ffootball%2F25912393
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Aylien Text API Ruby Gem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
App-Id:
|
17
|
+
- <PASSWORD>
|
18
|
+
App-Key:
|
19
|
+
- <PASSWORD>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- openresty/1.5.12.1
|
27
|
+
Date:
|
28
|
+
- Tue, 02 Dec 2014 18:16:05 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json;charset=UTF-8
|
31
|
+
Content-Length:
|
32
|
+
- '1916'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ! "{\n \"text\": \"Lionel Messi: Forward is not for sale, says Barcelona
|
38
|
+
president\\n\\nBarcelona forward Lionel Messi is not for sale and the club
|
39
|
+
plan to discuss a new contract with the Argentine, says president Josep Maria
|
40
|
+
Bartomeu.\\n\\nFour-time Ballon d'Or winner Messi, 26, is reported to be a\\n\\nIn
|
41
|
+
an interview with radio station RAC1, Bartomeu said: \\\"The club will sit
|
42
|
+
down and negotiate a new contract.\\n\\n\\\"We will do what we have to, to
|
43
|
+
ensure he's the best-paid player.\\\"\\n\\nMessi scored 60 goals in 50 appearances
|
44
|
+
last season but has struggled to match that goalscoring form in 2013-14.\\n\\nHe
|
45
|
+
has scored 18 goals so far but just eight of those have been in the league.\\n\\nHis
|
46
|
+
last league goal came in September, before he was out for five weeks with
|
47
|
+
a hamstring injury.\\n\\n\\\"He can do everything,\\\" said Barca coach Gerardo
|
48
|
+
Martino. \\\"If he succeeds in other facets of his game, it doesn't matter
|
49
|
+
if he scores.\\n\\n\\\"Nothing surprises me with him. He controls the game
|
50
|
+
well, passes the ball well, he is a good finisher, he can press and recover
|
51
|
+
the ball.\\n\\n\\\"He sees passes that most people can only see whilst watching
|
52
|
+
the game on TV or in the stands, not ones that you can normally see on the
|
53
|
+
field.\\\"\",\n \"sentences\": [\"Lionel Messi: Forward is not for sale,
|
54
|
+
says Barcelona president\\n\\nBarcelona forward Lionel Messi is not for sale
|
55
|
+
and the club plan to discuss a new contract with the Argentine, says president
|
56
|
+
Josep Maria Bartomeu.\", \"Four-time Ballon d'Or winner Messi, 26, is reported
|
57
|
+
to be a\\n\\nIn an interview with radio station RAC1, Bartomeu said: \\\"The
|
58
|
+
club will sit down and negotiate a new contract.\", \"His last league goal
|
59
|
+
came in September, before he was out for five weeks with a hamstring injury.\",
|
60
|
+
\"\\\"If he succeeds in other facets of his game, it doesn't matter if he
|
61
|
+
scores.\", \"He controls the game well, passes the ball well, he is a good
|
62
|
+
finisher, he can press and recover the ball.\"]\n}"
|
63
|
+
http_version:
|
64
|
+
recorded_at: Tue, 02 Dec 2014 18:15:02 GMT
|
65
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,78 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.aylien.com/api/v1/summarize
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: title=Batman+at+his+best+and+beyond&text=Batman+has+always+been+my+favourite+superhero+ever+since+the+first+time+I+heard+about+him+because+he+his+human+with+no+powers%2C+also+he+is+much+more+questionable+than+any+other+superhero.+The+story+of+the+film+is+about+Batman%2C+Lieutenant+James+Gordon%2C+and+new+district+attorney+Harvey+Dent+beginning+to+succeed+in+rounding+up+the+criminals+that+plague+Gotham+City.+They+are+unexpectedly+challenged+when+a+mysterious+criminal+mastermind+known+as+the+Joker+appears+in+Gotham.+Batman%27s+struggle+against+the+Joker+becomes+deeply+personal%2C+forcing+him+to+%22confront+everything+he+believes%22+and+to+improve+his+technology+%28which+introduces+the+recreation+of+the+Batcycle%2C+known+as+the+Batpod+and+the+Batsuit+was+redesigned%29+to+stop+the+madman%27s+campaign+of+destruction.+During+the+course+of+the+film%2C+a+love+triangle+develops+between+Bruce+Wayne%2C+Dent+and+Rachel+Dawes.++There+are+now+six+Batman+films+and+I+must+say+that+The+Dark+Knight+is+the+best+out+of+all+of+them.+The+title+is+good+because+that+is+what+Batman+actually+is.+It+has+been+3+years+for+the+adventure+to+continue+from+Batman+Begins+but+that+entire+wait+was+worth+it.+Gotham+city+is+very+Gothic+looking+and+is+very+haunting+and+visionary.+The+whole+movie+is+charged+with+pulse-pounding+suspense%2C+ingenious+special+effects+and+riveting+performances+from+a+first-rate+cast+especially+from+Heath+Ledger+who+gave+an+Oscar+nomination+performance+for+best+supporting-actor.+It+is+a+shame+that+he+can%27t+see+his+terrific+work+on-screen.+The+cinematography+is+excellent+which+is+made+so+dark+%26+sinister+that+really+did+suit+the+mood+for+the+film.+Usually+sequels+don%27t+turn+out+to+be+better+than+the+original+but+The+Dark+Knight+is+one+of+those+rare+sequels+that+surpasses+the+original+like+The+Godfather+2.+I+also+really+liked+the+poster+where+the+building+is+on+fire+in+a+Bat+symbol+%26+Batman+is+standing+in+front+of+it.+Christopher+Nolan+is+a+brilliant+director+and+his+film+Memento+is+one+of+my+most+favourite+films.+He+hasn%27t+made+10+movies+yet+and+3+of+them+are+already+on+the+IMDb+top+250.+Overall+The+Dark+Knight+is+the+kind+of+movie+that+will+make+the+audience+cheer+in+the+end+instead+of+throwing+fruit+%26+vegetables+on+the+screen.
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Aylien Text API Ruby Gem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
App-Id:
|
17
|
+
- <PASSWORD>
|
18
|
+
App-Key:
|
19
|
+
- <PASSWORD>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- openresty/1.5.12.1
|
27
|
+
Date:
|
28
|
+
- Tue, 02 Dec 2014 18:16:06 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json;charset=UTF-8
|
31
|
+
Content-Length:
|
32
|
+
- '2952'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ! "{\n \"text\": \"Batman has always been my favourite superhero ever
|
38
|
+
since the first time I heard about him because he his human with no powers,
|
39
|
+
also he is much more questionable than any other superhero. The story of the
|
40
|
+
film is about Batman, Lieutenant James Gordon, and new district attorney Harvey
|
41
|
+
Dent beginning to succeed in rounding up the criminals that plague Gotham
|
42
|
+
City. They are unexpectedly challenged when a mysterious criminal mastermind
|
43
|
+
known as the Joker appears in Gotham. Batman's struggle against the Joker
|
44
|
+
becomes deeply personal, forcing him to \\\"confront everything he believes\\\"
|
45
|
+
and to improve his technology (which introduces the recreation of the Batcycle,
|
46
|
+
known as the Batpod and the Batsuit was redesigned) to stop the madman's campaign
|
47
|
+
of destruction. During the course of the film, a love triangle develops between
|
48
|
+
Bruce Wayne, Dent and Rachel Dawes. There are now six Batman films and I
|
49
|
+
must say that The Dark Knight is the best out of all of them. The title is
|
50
|
+
good because that is what Batman actually is. It has been 3 years for the
|
51
|
+
adventure to continue from Batman Begins but that entire wait was worth it.
|
52
|
+
Gotham city is very Gothic looking and is very haunting and visionary. The
|
53
|
+
whole movie is charged with pulse-pounding suspense, ingenious special effects
|
54
|
+
and riveting performances from a first-rate cast especially from Heath Ledger
|
55
|
+
who gave an Oscar nomination performance for best supporting-actor. It is
|
56
|
+
a shame that he can't see his terrific work on-screen. The cinematography
|
57
|
+
is excellent which is made so dark & sinister that really did suit the mood
|
58
|
+
for the film. Usually sequels don't turn out to be better than the original
|
59
|
+
but The Dark Knight is one of those rare sequels that surpasses the original
|
60
|
+
like The Godfather 2. I also really liked the poster where the building is
|
61
|
+
on fire in a Bat symbol & Batman is standing in front of it. Christopher Nolan
|
62
|
+
is a brilliant director and his film Memento is one of my most favourite films.
|
63
|
+
He hasn't made 10 movies yet and 3 of them are already on the IMDb top 250.
|
64
|
+
Overall The Dark Knight is the kind of movie that will make the audience cheer
|
65
|
+
in the end instead of throwing fruit & vegetables on the screen.\",\n \"sentences\":
|
66
|
+
[\"Batman has always been my favourite superhero ever since the first time
|
67
|
+
I heard about him because he his human with no powers, also he is much more
|
68
|
+
questionable than any other superhero.\", \"The story of the film is about
|
69
|
+
Batman, Lieutenant James Gordon, and new district attorney Harvey Dent beginning
|
70
|
+
to succeed in rounding up the criminals that plague Gotham City.\", \"There
|
71
|
+
are now six Batman films and I must say that The Dark Knight is the best out
|
72
|
+
of all of them.\", \"The cinematography is excellent which is made so dark
|
73
|
+
& sinister that really did suit the mood for the film.\", \"Overall The Dark
|
74
|
+
Knight is the kind of movie that will make the audience cheer in the end instead
|
75
|
+
of throwing fruit & vegetables on the screen.\"]\n}"
|
76
|
+
http_version:
|
77
|
+
recorded_at: Tue, 02 Dec 2014 18:15:03 GMT
|
78
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,41 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.aylien.com/api/v1/summarize
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: text=Batman+has+always+been+my+favourite+superhero+ever+since+the+first+time+I+heard+about+him+because+he+his+human+with+no+powers%2C+also+he+is+much+more+questionable+than+any+other+superhero.+The+story+of+the+film+is+about+Batman%2C+Lieutenant+James+Gordon%2C+and+new+district+attorney+Harvey+Dent+beginning+to+succeed+in+rounding+up+the+criminals+that+plague+Gotham+City.+They+are+unexpectedly+challenged+when+a+mysterious+criminal+mastermind+known+as+the+Joker+appears+in+Gotham.+Batman%27s+struggle+against+the+Joker+becomes+deeply+personal%2C+forcing+him+to+%22confront+everything+he+believes%22+and+to+improve+his+technology+%28which+introduces+the+recreation+of+the+Batcycle%2C+known+as+the+Batpod+and+the+Batsuit+was+redesigned%29+to+stop+the+madman%27s+campaign+of+destruction.+During+the+course+of+the+film%2C+a+love+triangle+develops+between+Bruce+Wayne%2C+Dent+and+Rachel+Dawes.++There+are+now+six+Batman+films+and+I+must+say+that+The+Dark+Knight+is+the+best+out+of+all+of+them.+The+title+is+good+because+that+is+what+Batman+actually+is.+It+has+been+3+years+for+the+adventure+to+continue+from+Batman+Begins+but+that+entire+wait+was+worth+it.+Gotham+city+is+very+Gothic+looking+and+is+very+haunting+and+visionary.+The+whole+movie+is+charged+with+pulse-pounding+suspense%2C+ingenious+special+effects+and+riveting+performances+from+a+first-rate+cast+especially+from+Heath+Ledger+who+gave+an+Oscar+nomination+performance+for+best+supporting-actor.+It+is+a+shame+that+he+can%27t+see+his+terrific+work+on-screen.+The+cinematography+is+excellent+which+is+made+so+dark+%26+sinister+that+really+did+suit+the+mood+for+the+film.+Usually+sequels+don%27t+turn+out+to+be+better+than+the+original+but+The+Dark+Knight+is+one+of+those+rare+sequels+that+surpasses+the+original+like+The+Godfather+2.+I+also+really+liked+the+poster+where+the+building+is+on+fire+in+a+Bat+symbol+%26+Batman+is+standing+in+front+of+it.+Christopher+Nolan+is+a+brilliant+director+and+his+film+Memento+is+one+of+my+most+favourite+films.+He+hasn%27t+made+10+movies+yet+and+3+of+them+are+already+on+the+IMDb+top+250.+Overall+The+Dark+Knight+is+the+kind+of+movie+that+will+make+the+audience+cheer+in+the+end+instead+of+throwing+fruit+%26+vegetables+on+the+screen.
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Aylien Text API Ruby Gem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
App-Id:
|
17
|
+
- <PASSWORD>
|
18
|
+
App-Key:
|
19
|
+
- <PASSWORD>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 400
|
23
|
+
message: Bad Request
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- openresty/1.5.12.1
|
27
|
+
Date:
|
28
|
+
- Tue, 02 Dec 2014 18:16:02 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json;charset=UTF-8
|
31
|
+
Content-Length:
|
32
|
+
- '100'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ! '{"error" : "requirement failed: if you are not providing an url,
|
38
|
+
both text and title are required."}'
|
39
|
+
http_version:
|
40
|
+
recorded_at: Tue, 02 Dec 2014 18:14:59 GMT
|
41
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,65 @@
|
|
1
|
+
---
|
2
|
+
http_interactions:
|
3
|
+
- request:
|
4
|
+
method: post
|
5
|
+
uri: https://api.aylien.com/api/v1/summarize
|
6
|
+
body:
|
7
|
+
encoding: US-ASCII
|
8
|
+
string: url=http%3A%2F%2Fwww.bbc.com%2Fsport%2F0%2Ffootball%2F25912393
|
9
|
+
headers:
|
10
|
+
Accept:
|
11
|
+
- ! '*/*'
|
12
|
+
User-Agent:
|
13
|
+
- Aylien Text API Ruby Gem 0.0.1
|
14
|
+
Content-Type:
|
15
|
+
- application/x-www-form-urlencoded
|
16
|
+
App-Id:
|
17
|
+
- <PASSWORD>
|
18
|
+
App-Key:
|
19
|
+
- <PASSWORD>
|
20
|
+
response:
|
21
|
+
status:
|
22
|
+
code: 200
|
23
|
+
message: OK
|
24
|
+
headers:
|
25
|
+
Server:
|
26
|
+
- openresty/1.5.12.1
|
27
|
+
Date:
|
28
|
+
- Tue, 02 Dec 2014 18:16:01 GMT
|
29
|
+
Content-Type:
|
30
|
+
- application/json;charset=UTF-8
|
31
|
+
Content-Length:
|
32
|
+
- '1916'
|
33
|
+
Connection:
|
34
|
+
- keep-alive
|
35
|
+
body:
|
36
|
+
encoding: US-ASCII
|
37
|
+
string: ! "{\n \"text\": \"Lionel Messi: Forward is not for sale, says Barcelona
|
38
|
+
president\\n\\nBarcelona forward Lionel Messi is not for sale and the club
|
39
|
+
plan to discuss a new contract with the Argentine, says president Josep Maria
|
40
|
+
Bartomeu.\\n\\nFour-time Ballon d'Or winner Messi, 26, is reported to be a\\n\\nIn
|
41
|
+
an interview with radio station RAC1, Bartomeu said: \\\"The club will sit
|
42
|
+
down and negotiate a new contract.\\n\\n\\\"We will do what we have to, to
|
43
|
+
ensure he's the best-paid player.\\\"\\n\\nMessi scored 60 goals in 50 appearances
|
44
|
+
last season but has struggled to match that goalscoring form in 2013-14.\\n\\nHe
|
45
|
+
has scored 18 goals so far but just eight of those have been in the league.\\n\\nHis
|
46
|
+
last league goal came in September, before he was out for five weeks with
|
47
|
+
a hamstring injury.\\n\\n\\\"He can do everything,\\\" said Barca coach Gerardo
|
48
|
+
Martino. \\\"If he succeeds in other facets of his game, it doesn't matter
|
49
|
+
if he scores.\\n\\n\\\"Nothing surprises me with him. He controls the game
|
50
|
+
well, passes the ball well, he is a good finisher, he can press and recover
|
51
|
+
the ball.\\n\\n\\\"He sees passes that most people can only see whilst watching
|
52
|
+
the game on TV or in the stands, not ones that you can normally see on the
|
53
|
+
field.\\\"\",\n \"sentences\": [\"Lionel Messi: Forward is not for sale,
|
54
|
+
says Barcelona president\\n\\nBarcelona forward Lionel Messi is not for sale
|
55
|
+
and the club plan to discuss a new contract with the Argentine, says president
|
56
|
+
Josep Maria Bartomeu.\", \"Four-time Ballon d'Or winner Messi, 26, is reported
|
57
|
+
to be a\\n\\nIn an interview with radio station RAC1, Bartomeu said: \\\"The
|
58
|
+
club will sit down and negotiate a new contract.\", \"His last league goal
|
59
|
+
came in September, before he was out for five weeks with a hamstring injury.\",
|
60
|
+
\"\\\"If he succeeds in other facets of his game, it doesn't matter if he
|
61
|
+
scores.\", \"He controls the game well, passes the ball well, he is a good
|
62
|
+
finisher, he can press and recover the ball.\"]\n}"
|
63
|
+
http_version:
|
64
|
+
recorded_at: Tue, 02 Dec 2014 18:14:58 GMT
|
65
|
+
recorded_with: VCR 2.9.3
|
@@ -0,0 +1,86 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
|
3
|
+
describe "Classify endpoint" do
|
4
|
+
before do
|
5
|
+
@url = "http://techcrunch.com/2014/10/20/the-super-slim-kindle-voyage-is-a-great-travel-companion/"
|
6
|
+
@text = %q(CCTV footage shows the moment a suicide car bomber detonates
|
7
|
+
a device in Beirut on Tuesday. The incident took place in an area
|
8
|
+
of support for Hezbollah and left four people dead with many more wounded.
|
9
|
+
A group calling itself the al-Nusra Front in Lebanon has claimed
|
10
|
+
responsibility for the attack saying it was in retaliation for
|
11
|
+
Hezbollah's military support of president Bashar al-Assad's forces in Syria)
|
12
|
+
end
|
13
|
+
|
14
|
+
it "shouldn't be nil with valid url" do
|
15
|
+
VCR.use_cassette('classify_with_valid_url') do
|
16
|
+
result = @client.classify(url: @url)
|
17
|
+
result.wont_be_nil
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it "shouldn't be nil with text" do
|
22
|
+
VCR.use_cassette('classify_with_text') do
|
23
|
+
result = @client.classify(text: @text)
|
24
|
+
result.wont_be_nil
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
it "shouldn't be nil with value as valid url" do
|
29
|
+
VCR.use_cassette('classify_with_value_as_valid_url') do
|
30
|
+
result = @client.classify(@url)
|
31
|
+
result.wont_be_nil
|
32
|
+
end
|
33
|
+
end
|
34
|
+
|
35
|
+
it "shouldn't be nil with value as value" do
|
36
|
+
VCR.use_cassette('classify_with_value_as_text') do
|
37
|
+
result = @client.classify(@text)
|
38
|
+
result.wont_be_nil
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should be nil with invalid params" do
|
43
|
+
VCR.use_cassette('classify_with_invalid_params') do
|
44
|
+
result = @client.classify(wrong_param: @text)
|
45
|
+
result.must_be_nil
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
it "should be nil with unauthenticated client" do
|
50
|
+
VCR.use_cassette('classify_with_unauthenticated_client') do
|
51
|
+
result = @unauthenticated_client.classify(text: @text)
|
52
|
+
result.must_be_nil
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
it "should raise Forbidden with unauthenticated client" do
|
57
|
+
VCR.use_cassette('classify_with_unauthenticated_client') do
|
58
|
+
proc {
|
59
|
+
@unauthenticated_client.classify!(text: @text)
|
60
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
it "should be nil with invalid client" do
|
65
|
+
VCR.use_cassette('classify_with_invalid_client') do
|
66
|
+
result = @invalid_client.classify(text: @text)
|
67
|
+
result.must_be_nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
it "should raise Forbidden with invalid client" do
|
72
|
+
VCR.use_cassette('classify_with_invalid_client') do
|
73
|
+
proc {
|
74
|
+
@invalid_client.classify!(text: @text)
|
75
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
it "should raise BadRequest with invalid params" do
|
80
|
+
VCR.use_cassette('classify_with_invalid_params') do
|
81
|
+
proc {
|
82
|
+
@client.classify!(wrong_param: @text)
|
83
|
+
}.must_raise AylienTextApi::Error::BadRequest
|
84
|
+
end
|
85
|
+
end
|
86
|
+
end
|
@@ -0,0 +1,23 @@
|
|
1
|
+
require_relative '../../spec_helper'
|
2
|
+
|
3
|
+
describe AylienTextApi::Client do
|
4
|
+
before do
|
5
|
+
@client = AylienTextApi::Client.new(
|
6
|
+
app_id: CONFIG["text_api"]["correct_keys"]["app_id"],
|
7
|
+
app_key: CONFIG["text_api"]["correct_keys"]["app_key"])
|
8
|
+
@unauthenticated_client = AylienTextApi::Client.new(
|
9
|
+
app_id: CONFIG["text_api"]["incorrect_keys"]["app_id"],
|
10
|
+
app_key: CONFIG["text_api"]["incorrect_keys"]["app_key"])
|
11
|
+
@invalid_client = AylienTextApi::Client.new(incorrect_param_app_id: CONFIG["text_api"]["app_id"],
|
12
|
+
incorrect_param_app_key: CONFIG["text_api"]["correct_keys"]["app_key"])
|
13
|
+
end
|
14
|
+
require_relative './classify'
|
15
|
+
require_relative './concepts'
|
16
|
+
require_relative './entities'
|
17
|
+
require_relative './extract'
|
18
|
+
require_relative './hashtags'
|
19
|
+
require_relative './language'
|
20
|
+
require_relative './related'
|
21
|
+
require_relative './sentiment'
|
22
|
+
require_relative './summarize'
|
23
|
+
end
|
@@ -0,0 +1,81 @@
|
|
1
|
+
describe "Concepts endpoint" do
|
2
|
+
before do
|
3
|
+
@url = "http://www.bbc.co.uk/news/business-25821345"
|
4
|
+
@text = %q(Barack Hussein Obama II is the 44th and current
|
5
|
+
President of the United States, and the first
|
6
|
+
African American to hold the office.)
|
7
|
+
end
|
8
|
+
|
9
|
+
it "shouldn't be nil with valid url" do
|
10
|
+
VCR.use_cassette('concepts_with_valid_url') do
|
11
|
+
result = @client.concepts(url: @url)
|
12
|
+
result.wont_be_nil
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
it "shouldn't be nil with text" do
|
17
|
+
VCR.use_cassette('concepts_with_text') do
|
18
|
+
result = @client.concepts(text: @text)
|
19
|
+
result.wont_be_nil
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
it "shouldn't be nil with value as valid url" do
|
24
|
+
VCR.use_cassette('concepts_with_value_as_valid_url') do
|
25
|
+
result = @client.concepts(@url)
|
26
|
+
result.wont_be_nil
|
27
|
+
end
|
28
|
+
end
|
29
|
+
|
30
|
+
it "shouldn't be nil with value as text" do
|
31
|
+
VCR.use_cassette('concepts_with_value_as_text') do
|
32
|
+
result = @client.concepts(@text)
|
33
|
+
result.wont_be_nil
|
34
|
+
end
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should be nil with unauthenticated client" do
|
38
|
+
VCR.use_cassette('concepts_with_unauthenticated_client') do
|
39
|
+
result = @unauthenticated_client.concepts(text: @text)
|
40
|
+
result.must_be_nil
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
it "should raise Forbidden with unauthenticated client" do
|
45
|
+
VCR.use_cassette('concepts_with_unauthenticated_client') do
|
46
|
+
proc {
|
47
|
+
@unauthenticated_client.concepts!(text: @text)
|
48
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
49
|
+
end
|
50
|
+
end
|
51
|
+
|
52
|
+
it "should be nil with invalid client" do
|
53
|
+
VCR.use_cassette('concepts_with_invalid_client') do
|
54
|
+
result = @invalid_client.concepts(text: @text)
|
55
|
+
result.must_be_nil
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
it "should raise Forbidden with invalid client" do
|
60
|
+
VCR.use_cassette('concepts_with_invalid_client') do
|
61
|
+
proc {
|
62
|
+
@invalid_client.concepts!(text: @text)
|
63
|
+
}.must_raise AylienTextApi::Error::Forbidden
|
64
|
+
end
|
65
|
+
end
|
66
|
+
|
67
|
+
it "should be nil with invalid params" do
|
68
|
+
VCR.use_cassette('concepts_with_invalid_params') do
|
69
|
+
result = @client.concepts(wrong_param: @text)
|
70
|
+
result.must_be_nil
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
it "should raise BadRequest with invalid params" do
|
75
|
+
VCR.use_cassette('concepts_with_invalid_params') do
|
76
|
+
proc {
|
77
|
+
@client.concepts!(wrong_param: @text)
|
78
|
+
}.must_raise AylienTextApi::Error::BadRequest
|
79
|
+
end
|
80
|
+
end
|
81
|
+
end
|