Class: RSimpy::Links
- Inherits:
-
Object
- Object
- RSimpy::Links
- Defined in:
- lib/links.rb
Instance Attribute Summary collapse
-
#status_code ⇒ Object
readonly
TODO move this functionality to RSimpy module.
-
#status_message ⇒ Object
readonly
TODO move this functionality to RSimpy module.
-
#success ⇒ Object
readonly
TODO move this functionality to RSimpy module.
Instance Method Summary collapse
- #execute(service, params) ⇒ Object
- #get_user_from_file ⇒ Object
-
#initialize(login = nil, pass = nil) ⇒ Links
constructor
A new instance of Links.
- #save(params) ⇒ Object
- #set_codes(service = nil) ⇒ Object
Constructor Details
Instance Attribute Details
#status_code ⇒ Object (readonly)
TODO move this functionality to RSimpy module
7 8 9 |
# File 'lib/links.rb', line 7 def status_code @status_code end |
#status_message ⇒ Object (readonly)
TODO move this functionality to RSimpy module
7 8 9 |
# File 'lib/links.rb', line 7 def @status_message end |
#success ⇒ Object (readonly)
TODO move this functionality to RSimpy module
7 8 9 |
# File 'lib/links.rb', line 7 def success @success end |
Instance Method Details
#execute(service, params) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/links.rb', line 43 def execute service, params set_codes response = service.execute params set_codes service response end |
#get_user_from_file ⇒ Object
17 18 19 20 21 22 23 24 25 26 |
# File 'lib/links.rb', line 17 def get_user_from_file storage_service = RSimpy::ProfileStorageService.new config = RSimpy::Configuration.new storage_service if !config.stored? raise UserNotProvidedError "Please configure RSimpy or supply username and password" end config.get end |
#save(params) ⇒ Object
28 29 30 31 |
# File 'lib/links.rb', line 28 def save params params.add(:accessType, :public) unless params.has_key? :accessType execute RSimpy::PostingService.new(RSimpy::SAVE_LINK, RSimpy::Client.new(@user)), params end |
#set_codes(service = nil) ⇒ Object
50 51 52 53 54 55 56 57 58 59 60 |
# File 'lib/links.rb', line 50 def set_codes service=nil if service @success = service.success @status_code = service.status_code @status_message = service. else @success = false @status_code = nil @status_message =nil end end |