Class: Gingerice::Parser
- Inherits:
-
Object
- Object
- Gingerice::Parser
- Defined in:
- lib/gingerice/parser.rb
Constant Summary collapse
- GINGER_API_ENDPOINT =
'http://services.gingersoftware.com/Ginger/correct/json/GingerTheText'
- GINGER_API_VERSION =
'2.0'
- GINGER_API_KEY =
'6ae0c3a0-afdc-4532-a810-82ded0054236'
- DEFAULT_LANG =
'US'
Instance Attribute Summary collapse
-
#api_endpoint ⇒ Object
Returns the value of attribute api_endpoint.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#api_version ⇒ Object
Returns the value of attribute api_version.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Parser
constructor
A new instance of Parser.
- #parse(text) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Parser
Returns a new instance of Parser.
17 18 19 20 21 22 23 24 |
# File 'lib/gingerice/parser.rb', line 17 def initialize( = {}) ().each do |key, value| send("#{key}=", value) end @result = '' @corrections = [] end |
Instance Attribute Details
#api_endpoint ⇒ Object
Returns the value of attribute api_endpoint.
14 15 16 |
# File 'lib/gingerice/parser.rb', line 14 def api_endpoint @api_endpoint end |
#api_key ⇒ Object
Returns the value of attribute api_key.
14 15 16 |
# File 'lib/gingerice/parser.rb', line 14 def api_key @api_key end |
#api_version ⇒ Object
Returns the value of attribute api_version.
14 15 16 |
# File 'lib/gingerice/parser.rb', line 14 def api_version @api_version end |
#lang ⇒ Object
Returns the value of attribute lang.
14 15 16 |
# File 'lib/gingerice/parser.rb', line 14 def lang @lang end |
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
15 16 17 |
# File 'lib/gingerice/parser.rb', line 15 def raw_response @raw_response end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
15 16 17 |
# File 'lib/gingerice/parser.rb', line 15 def result @result end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
15 16 17 |
# File 'lib/gingerice/parser.rb', line 15 def text @text end |
Class Method Details
.default_options ⇒ Object
32 33 34 35 36 37 38 39 |
# File 'lib/gingerice/parser.rb', line 32 def self. { :api_endpoint => GINGER_API_ENDPOINT, :api_version => GINGER_API_VERSION, :api_key => GINGER_API_KEY, :lang => DEFAULT_LANG } end |
Instance Method Details
#parse(text) ⇒ Object
26 27 28 29 30 |
# File 'lib/gingerice/parser.rb', line 26 def parse(text) @text = text perform_request process_response end |