watson-personality-insights 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 88170788241b8dd30de37a00eedba83dbd16fca5
4
- data.tar.gz: 33aa7ff77586794708b5a01caa02a4809b3b8672
3
+ metadata.gz: 736a3587eea3f4c238a448c24b78aa8bae5bff79
4
+ data.tar.gz: 5a4925046650ad5346143a61d7c0ab6b6066f25e
5
5
  SHA512:
6
- metadata.gz: 55b09a431f3235b39391bca0d65099e10b642c4028f6a169c7039c86a1f351303ab3023720430780a78b03cb4be397c323324e5c88976a2b65a6f143887c672a
7
- data.tar.gz: 2f9b1eb0f18497de6070f7afd65c5573792aeadc74f80a85d6c36b1dbb749406d07eb3e197c9d87f2246585127f2e8fb75cdc699e73448f37b6034f2c6555636
6
+ metadata.gz: 03d611f641f283789f0fe7d7dc0bda013d1bec301e58f5b306ce68b82f4c7340b9b009bbc0cf8d349c327bbfefe127d0c0d3a59f0bde10b237951047c6a8c650
7
+ data.tar.gz: dc983a9e1958c9312f3c37cadadaa3be796a53b973b0025a9e11313720024d858785f4b32e815282f41250ba87d22b90256caa024b0379714941deacc90be1e8
data/README.md CHANGED
@@ -1,61 +1,41 @@
1
- # watson-personality-insights
1
+ # WatsonPersonalityInsights
2
2
 
3
- The IBM Watson™ Personality Insights service provides an Application Programming Interface (API) that enables applications to derive insights from social media, enterprise data, or other digital communications. The service uses linguistic analytics to infer individuals' intrinsic personality characteristics, including Big Five, Needs, and Values, from digital communications such as email, text messages, tweets, and forum posts.
3
+ Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/watson-personality-insights`. To experiment with that code, run `bin/console` for an interactive prompt.
4
4
 
5
- For more informations you can read [here](https://www.ibm.com/watson/developercloud/doc/personality-insights/)
5
+ TODO: Delete this and the text above, and describe your gem
6
6
 
7
- ## Prerequisites
7
+ ## Installation
8
8
 
9
- To get an API username and password, you'll need to [sign up for IBM Bluemix](https://console.ng.bluemix.net/registration/).
10
-
11
- After creating an instance of the Personality Insights service, select Service Credentials from the navigation on the left side of its dashboard page to see the username and password that are associated with the instance. For more information, see [Obtaining credentials for Watson services](https://www.ibm.com/watson/developercloud/doc/common/getting-started-credentials.html).
12
-
13
- After create bluemix account and create username and passowrd credencials, you can use another gem for env variables as ([dotenv](https://github.com/bkeepers/dotenv), [figaro](https://github.com/laserlemon/figaro) or which you want to create env variables).
14
-
15
- Then in (.env) file you should add:
9
+ Add this line to your application's Gemfile:
16
10
 
17
11
  ```ruby
18
- personality_insights_username=$your_username_from_bluemix
19
- personality_insights_username=$your_password_from_bluemix
12
+ gem 'watson-personality-insights'
20
13
  ```
21
14
 
22
- watson_langauge_translator will take your username and password and it will do request with this credencials, it's it!
15
+ And then execute:
23
16
 
24
- ## Getting Started in ruby
25
- You can install this library
17
+ $ bundle
26
18
 
27
- `gem install 'watson-personality-insights'`
19
+ Or install it yourself as:
28
20
 
29
- and use
21
+ $ gem install watson-personality-insights
30
22
 
31
- ```ruby
32
- require 'watson-personality-insights'
33
- ```
23
+ ## Usage
34
24
 
35
- ## Getting Started in Rails
36
- PersonalityInsights works with Rails > 4.1 onwards. You can add it to your Gemfile with:
25
+ TODO: Write usage instructions here
37
26
 
38
- ```ruby
39
- gem 'watson-personality-insights'
40
- ```
27
+ ## Development
41
28
 
42
- Then run `bundle install`
29
+ After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
43
30
 
44
- ## Use
31
+ To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
45
32
 
46
- #### Profile
33
+ ## Contributing
34
+
35
+ Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/WatsonPersonalityInsights.
47
36
 
48
- Generates a personality profile for the author of the input text. The service accepts a maximum of 20 MB of input content. It can analyze text in Arabic, English, Japanese, or Spanish and return its results in a variety of languages. You can provide plain text, HTML, or JSON input. The service returns output in JSON format by default, but you can request the output in CSV format.
49
37
 
50
- ```ruby
51
- @watson_personality = PersonalityInsights::Profile.new(json_file_url)
52
- @watson_personality.get_profile(
53
- version: '2016-10-20',
54
- consumption_preferences: true,
55
- raw_scores: true
56
- )
57
- ```
58
-
59
38
  ## License
60
39
 
61
- This project is licensed under the MIT License
40
+ The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
41
+
@@ -2,7 +2,7 @@ module PersonalityInsights
2
2
  module ActiveMethod
3
3
  class Base < ActiveMethod::Extra
4
4
  include PersonalityInsights::Generator::PersonalityRequest
5
- attr_accessor :username, :password, :json_result, :options, :file
5
+ attr_accessor :username, :password, :json_result, :options, :file, :content_language, :accept, :accept_language
6
6
 
7
7
  def initialize(file)
8
8
  @file = file
@@ -14,6 +14,9 @@ module PersonalityInsights
14
14
  request = Net::HTTP::Post.new(uri)
15
15
  request.basic_auth(@username, @password)
16
16
  request.content_type = "application/json"
17
+ request["Content-Language"] = @options[:content_language] unless @options[:content_language].nil?
18
+ request["Accept"] = @options[:accept] unless @options[:accept].nil?
19
+ request["Accept-Language"] = @options[:accept_language] unless @options[:accept_language].nil?
17
20
  request.body = ""
18
21
  request.body << File.read(@file).delete("\r\n")
19
22
  response(uri, request)
@@ -1,3 +1,3 @@
1
1
  module PersonalityInsights
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: watson-personality-insights
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Diamant