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.
69 70 71 72 73 74 75 76 |
# File 'lib/insnergy-api-ruby-client.rb', line 69 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.
66 67 68 |
# File 'lib/insnergy-api-ruby-client.rb', line 66 def category @category end |
#client ⇒ Object
Returns the value of attribute client.
66 67 68 |
# File 'lib/insnergy-api-ruby-client.rb', line 66 def client @client end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
67 68 69 |
# File 'lib/insnergy-api-ruby-client.rb', line 67 def response @response end |
Instance Method Details
#response! ⇒ Object
78 79 80 81 82 83 |
# File 'lib/insnergy-api-ruby-client.rb', line 78 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 |