Class: Sistrix::Credits
Instance Attribute Summary collapse
-
#credits ⇒ Object
readonly
Returns the value of attribute credits.
-
#credits_available ⇒ Object
readonly
Returns the value of attribute credits_available.
Instance Method Summary collapse
- #call(options = {}) ⇒ Object
-
#initialize(options = {}) ⇒ Credits
constructor
A new instance of Credits.
Methods included from Base
#base_uri, #fetch, #method_name
Constructor Details
Instance Attribute Details
#credits ⇒ Object (readonly)
Returns the value of attribute credits.
8 9 10 |
# File 'lib/sistrix/credits.rb', line 8 def credits @credits end |
#credits_available ⇒ Object (readonly)
Returns the value of attribute credits_available.
8 9 10 |
# File 'lib/sistrix/credits.rb', line 8 def credits_available @credits_available end |
Instance Method Details
#call(options = {}) ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/sistrix/credits.rb', line 20 def call( = {}) data = fetch() @credits = data.xpath('/response/credits').first['used'].to_i @credits_available = data.xpath('/response/answer/credits').first['value'].to_s.strip.to_i self end |