Class: GitSleep::Communicator
- Inherits:
-
Object
- Object
- GitSleep::Communicator
- Includes:
- Singleton
- Defined in:
- lib/git-sleep/communicator.rb
Instance Method Summary collapse
- #can_commit? ⇒ Boolean
- #can_connect? ⇒ Boolean
- #happy_response? ⇒ Boolean
- #hours_of_sleep ⇒ Object
- #not_signed_up_message ⇒ Object
- #not_signed_up_response? ⇒ Boolean
- #username ⇒ Object
Instance Method Details
#can_commit? ⇒ Boolean
30 31 32 |
# File 'lib/git-sleep/communicator.rb', line 30 def can_commit? data['can_commit'] end |
#can_connect? ⇒ Boolean
8 9 10 11 12 13 14 15 |
# File 'lib/git-sleep/communicator.rb', line 8 def can_connect? reset_data! true # TODO: be more specific # only rescue httparty error related to inability to connect rescue StandardError false end |
#happy_response? ⇒ Boolean
17 18 19 |
# File 'lib/git-sleep/communicator.rb', line 17 def happy_response? response.code == 200 end |
#hours_of_sleep ⇒ Object
34 35 36 |
# File 'lib/git-sleep/communicator.rb', line 34 def hours_of_sleep data['sleep24'] end |
#not_signed_up_message ⇒ Object
25 26 27 28 |
# File 'lib/git-sleep/communicator.rb', line 25 def "Must first authorize at #{GitSleep::OUR_SITE}\n" \ 'Then run `git sleep authorize`' end |
#not_signed_up_response? ⇒ Boolean
21 22 23 |
# File 'lib/git-sleep/communicator.rb', line 21 def not_signed_up_response? response.code == 401 end |
#username ⇒ Object
38 39 40 |
# File 'lib/git-sleep/communicator.rb', line 38 def username ENV['USER'] end |