Class: WriteItInstance
- Inherits:
-
Object
- Object
- WriteItInstance
- Defined in:
- lib/models/writeitinstance.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#url ⇒ Object
Returns the value of attribute url.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
Instance Attribute Details
#api_key ⇒ Object
Returns the value of attribute api_key.
5 6 7 |
# File 'lib/models/writeitinstance.rb', line 5 def api_key @api_key end |
#base_url ⇒ Object
Returns the value of attribute base_url.
3 4 5 |
# File 'lib/models/writeitinstance.rb', line 3 def base_url @base_url end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
6 7 8 |
# File 'lib/models/writeitinstance.rb', line 6 def errors @errors end |
#url ⇒ Object
Returns the value of attribute url.
2 3 4 |
# File 'lib/models/writeitinstance.rb', line 2 def url @url end |
#username ⇒ Object
Returns the value of attribute username.
4 5 6 |
# File 'lib/models/writeitinstance.rb', line 4 def username @username end |
Instance Method Details
#validate ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/models/writeitinstance.rb', line 9 def validate = 'ApiKey %{username}:%{api_key}' % { :username => self.username, :api_key => self.api_key, } url = self.base_url + "/api/v1" + self.url request = RestClient::Request.new( :method => :get, :url => url, :headers => { :accept => :json, :authorization => , } ) #RestClient::ResourceNotFound begin request.execute rescue Exception => e @errors = [e.] return false end return true end |