Class: Insnergy::Client::Widgets
- Inherits:
-
Object
- Object
- Insnergy::Client::Widgets
- Defined in:
- lib/insnergy-api-ruby-client.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#client ⇒ Object
Returns the value of attribute client.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(client: nil, category: nil) ⇒ Widgets
constructor
A new instance of Widgets.
- #response! ⇒ Object
Constructor Details
#initialize(client: nil, category: nil) ⇒ Widgets
Returns a new instance of Widgets.
85 86 87 88 89 90 91 92 |
# File 'lib/insnergy-api-ruby-client.rb', line 85 def initialize(client: nil,category: nil) @access_token = client.access_token @user_id = client.user_id @domain = client.domain @category = category @response = nil response! end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
82 83 84 |
# File 'lib/insnergy-api-ruby-client.rb', line 82 def category @category end |
#client ⇒ Object
Returns the value of attribute client.
82 83 84 |
# File 'lib/insnergy-api-ruby-client.rb', line 82 def client @client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
83 84 85 |
# File 'lib/insnergy-api-ruby-client.rb', line 83 def response @response end |
Instance Method Details
#response! ⇒ Object
94 95 96 97 98 99 |
# File 'lib/insnergy-api-ruby-client.rb', line 94 def response! parameter = {:params => {:apsystem => "IFA", :email => @user_id, :type_code => 1, :dev_category => "#{@category}"}, :Authorization => "Bearer #{@access_token}"} @response = JSON.parse(RestClient.get "#{@domain}/if/3/user/widgets", parameter) raise "#{response['err']['code']}" unless response['err']['code'] == '0' @response end |