lymbix 0.4.0 → 0.4.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/Changelog +1 -0
  2. data/README +0 -22
  3. data/lib/lymbix/base.rb +9 -11
  4. metadata +3 -3
data/Changelog CHANGED
@@ -1,3 +1,4 @@
1
+ v0.4.1 - added reference_id param to flag_response
1
2
  v0.4.0 - re-factored whole gem, implemented methods for 2.1 version
2
3
  v0.3.7 - added endpoint attribute to Base for companies implementation
3
4
  v0.3.6 - added end and start time to data points coming from toneaday
data/README CHANGED
@@ -6,28 +6,6 @@ Lymbix gives you the ability to determine the tone of any phrase or passage.
6
6
 
7
7
  To be able to access this resource - please go to http://www.toneapi.com and create an account. You need to agree to the licensing terms, and your account needs to be approved.
8
8
 
9
- Some resources to help you along the way:
10
-
11
- #Add resources
12
-
13
- == Example usage
14
-
15
- Authentication:
16
-
17
- @lymbix = Lymbix::Base.authenticate('user@example.com','secretpassword', application_id)
18
-
19
- Get the tone of words/phrases:
20
-
21
- @lymbix.tonalize_phrase "This is a test passage"
22
-
23
- Connotative Categories:
24
-
25
- @lymbix.all_connotative_categories
26
-
27
- Database Size:
28
-
29
- @lymbix.word_count
30
-
31
9
 
32
10
  == Authors and credits
33
11
 
@@ -1,19 +1,15 @@
1
1
  module Lymbix
2
2
 
3
3
  =begin rdoc
4
- The Base class is the most used class in the Lymbix gem.
4
+ The Base class is the main class used in the Lymbix gem.
5
5
  It incorporates all the methods used to tonalize.
6
6
 
7
- To begin using the base class, you must authenticate using one of the authenticate methods and store the results in a variable.
8
- On a successful authentication, you can start calling tonalize methods immediatly.
7
+ To begin using the base class, you must get your authentication key provided from ToneAPI.com and store the key in the @auth_key variable.
9
8
  =end
10
9
 
11
10
  class Base
12
11
  # The user's authentication key
13
- attr_accessor :auth_key
14
- # Error messages that were caught during the authentication
15
- attr_accessor :error_messages
16
- # API Version
12
+ attr_accessor :auth_key
17
13
 
18
14
  def initialize(auth_key)
19
15
  @auth_key = auth_key
@@ -49,10 +45,10 @@ On a successful authentication, you can start calling tonalize methods immediatl
49
45
  end
50
46
 
51
47
  # Flags a phrase to be re-evaluated
52
- def flag_response(phrase, api_method_requested, api_version, callback_url = nil)
48
+ def flag_response(reference_id, phrase, api_method_requested, api_version, callback_url = nil)
53
49
  @version = 2.1
54
- response = request(:post, 'flag_response', {:phrase => phrase, :api_method_requested => api_method_requested, :api_version => api_version, :callback_url => callback_url}).data
55
- end
50
+ response = request(:post, 'flag_response', {:reference_id => reference_id, :phrase => phrase, :api_method_requested => api_method_requested, :api_version => api_version, :callback_url => callback_url}).data
51
+ end
56
52
 
57
53
  private
58
54
  def request(action, method, data, headers = {})
@@ -60,7 +56,8 @@ On a successful authentication, you can start calling tonalize methods immediatl
60
56
  end
61
57
 
62
58
  def return_fields_xml(return_fields)
63
- xml = "<return_fields>"
59
+ xml = "<?xml version='1.0' encoding='utf-8' ?>"
60
+ xml << "<return_fields>"
64
61
  return_fields.each {|field| xml << "<field>" + field + "</field>"}
65
62
  xml << "</return_fields>"
66
63
  xml
@@ -71,6 +68,7 @@ On a successful authentication, you can start calling tonalize methods immediatl
71
68
  end
72
69
 
73
70
  def articles_xml(articles)
71
+ xml = "<?xml version='1.0' encoding='utf-8' ?>"
74
72
  xml = "<articles>"
75
73
  articles.each {|article| xml << "<article>" + article + "</article>"}
76
74
  xml << "</articles>"
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lymbix
3
3
  version: !ruby/object:Gem::Version
4
- hash: 15
4
+ hash: 13
5
5
  prerelease: false
6
6
  segments:
7
7
  - 0
8
8
  - 4
9
- - 0
10
- version: 0.4.0
9
+ - 1
10
+ version: 0.4.1
11
11
  platform: ruby
12
12
  authors:
13
13
  - Patrick Roy