rubytcc 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +37 -0
- data/Gemfile +3 -0
- data/Gemfile.lock +118 -0
- data/Guardfile +22 -0
- data/LICENSE +22 -0
- data/Rakefile +10 -0
- data/Readme.md +107 -0
- data/lib/rubytcc.rb +9 -0
- data/lib/rubytcc/authenticate_login_result.rb +11 -0
- data/lib/rubytcc/change_request_result.rb +8 -0
- data/lib/rubytcc/change_thermostat_ui_result.rb +8 -0
- data/lib/rubytcc/client.rb +72 -0
- data/lib/rubytcc/country_info.rb +11 -0
- data/lib/rubytcc/create_location_result.rb +9 -0
- data/lib/rubytcc/current_weather.rb +13 -0
- data/lib/rubytcc/demand_response_event.rb +16 -0
- data/lib/rubytcc/edit_location_result.rb +9 -0
- data/lib/rubytcc/enumberable.rb +26 -0
- data/lib/rubytcc/error.rb +60 -0
- data/lib/rubytcc/fan.rb +12 -0
- data/lib/rubytcc/forecast_day_info.rb +13 -0
- data/lib/rubytcc/get_comm_task_state_result.rb +10 -0
- data/lib/rubytcc/get_locations_result.rb +10 -0
- data/lib/rubytcc/get_schedule_result.rb +11 -0
- data/lib/rubytcc/get_short_location_info_result.rb +10 -0
- data/lib/rubytcc/get_system_geo_info_result.rb +10 -0
- data/lib/rubytcc/get_thermostat_fan_result.rb +10 -0
- data/lib/rubytcc/get_thermostat_humidification_result.rb +10 -0
- data/lib/rubytcc/get_thermostat_result.rb +10 -0
- data/lib/rubytcc/get_thermostat_ui_result.rb +8 -0
- data/lib/rubytcc/get_user_address_info_result.rb +10 -0
- data/lib/rubytcc/get_volatile_thermostat_data_result.rb +11 -0
- data/lib/rubytcc/get_weather_forecast_result.rb +10 -0
- data/lib/rubytcc/helper.rb +14 -0
- data/lib/rubytcc/humidification.rb +17 -0
- data/lib/rubytcc/keep_alive_result.rb +7 -0
- data/lib/rubytcc/location_info.rb +18 -0
- data/lib/rubytcc/log_off_result.rb +7 -0
- data/lib/rubytcc/rest/api.rb +45 -0
- data/lib/rubytcc/rest/authenticate_user_login.rb +14 -0
- data/lib/rubytcc/rest/change_thermostat_fan.rb +14 -0
- data/lib/rubytcc/rest/change_thermostat_ui.rb +13 -0
- data/lib/rubytcc/rest/client.rb +107 -0
- data/lib/rubytcc/rest/create_location.rb +13 -0
- data/lib/rubytcc/rest/edit_location.rb +13 -0
- data/lib/rubytcc/rest/get_comm_task_state.rb +13 -0
- data/lib/rubytcc/rest/get_locations.rb +13 -0
- data/lib/rubytcc/rest/get_schedule.rb +13 -0
- data/lib/rubytcc/rest/get_short_location_info.rb +13 -0
- data/lib/rubytcc/rest/get_system_geo_info.rb +13 -0
- data/lib/rubytcc/rest/get_thermostat.rb +13 -0
- data/lib/rubytcc/rest/get_thermostat_fan.rb +13 -0
- data/lib/rubytcc/rest/get_thermostat_humidification.rb +13 -0
- data/lib/rubytcc/rest/get_thermostat_ui.rb +13 -0
- data/lib/rubytcc/rest/get_user_address_info.rb +13 -0
- data/lib/rubytcc/rest/get_volatile_thermostat_data.rb +13 -0
- data/lib/rubytcc/rest/get_weather_forecast.rb +13 -0
- data/lib/rubytcc/rest/keep_alive.rb +13 -0
- data/lib/rubytcc/rest/log_off.rb +13 -0
- data/lib/rubytcc/schedule.rb +11 -0
- data/lib/rubytcc/scheduled_period_info.rb +14 -0
- data/lib/rubytcc/short_location_info.rb +19 -0
- data/lib/rubytcc/state_info.rb +7 -0
- data/lib/rubytcc/thermostat.rb +11 -0
- data/lib/rubytcc/thermostat_alert.rb +7 -0
- data/lib/rubytcc/thermostat_info.rb +22 -0
- data/lib/rubytcc/ui.rb +38 -0
- data/lib/rubytcc/user_address_info.rb +16 -0
- data/lib/rubytcc/user_info.rb +12 -0
- data/lib/rubytcc/version.rb +4 -0
- data/rubytcc.gemspec +33 -0
- data/spec/lib/rubytcc/helper_spec.rb +28 -0
- data/spec/lib/rubytcc/rest/authenticate_user_login_spec.rb +25 -0
- data/spec/lib/rubytcc/rest/change_thermostat_fan_spec.rb +28 -0
- data/spec/lib/rubytcc/rest/change_thermostat_ui_spec.rb +44 -0
- data/spec/lib/rubytcc/rest/client_spec.rb +34 -0
- data/spec/lib/rubytcc/rest/create_location_spec.rb +39 -0
- data/spec/lib/rubytcc/rest/edit_location_spec.rb +42 -0
- data/spec/lib/rubytcc/rest/get_comm_task_state_spec.rb +28 -0
- data/spec/lib/rubytcc/rest/get_locations_spec.rb +28 -0
- data/spec/lib/rubytcc/rest/get_schedule_spec.rb +28 -0
- data/spec/lib/rubytcc/rest/get_short_location_info_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_system_geo_info_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_thermostat_fan_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_thermostat_humidification_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_thermostat_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_thermostat_ui_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_user_address_info_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_volatile_thermostat_data_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/get_weather_forecast_spec.rb +27 -0
- data/spec/lib/rubytcc/rest/keep_alive_spec.rb +26 -0
- data/spec/lib/rubytcc/rest/log_off_spec.rb +34 -0
- data/spec/lib/rubytcc_spec.rb +2 -0
- data/spec/spec_helper.rb +17 -0
- data/spec/support/vcr_setup.rb +7 -0
- metadata +331 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: cd4ab81de10386a81907d23388107f1320985e7f
|
4
|
+
data.tar.gz: f9312ad2387f4c092f8c7cdb57b8c9b3f33201f1
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 12008d5f17df703b1ee11b6084b8ba98315768a5c8abea545d4965253bf74378c45d7bb2fc88b5d4bdd97f73a099c7b98be3045c9933fe3175e8cd847965d3d3
|
7
|
+
data.tar.gz: 92fc9385fd560c96bf4620f2920963028a5114b0f43fa944497b1c6b7bee9c8c75b2456be7ef4745e5e4db819c0b6675e7f327e8831b1a3caada75193e83f23b
|
data/.gitignore
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
/spec/variables.rb
|
2
|
+
/spec/fixtures/*
|
3
|
+
|
4
|
+
*.gem
|
5
|
+
*.rbc
|
6
|
+
/.config
|
7
|
+
/coverage/
|
8
|
+
/InstalledFiles
|
9
|
+
/pkg/
|
10
|
+
/spec/reports/
|
11
|
+
/test/tmp/
|
12
|
+
/test/version_tmp/
|
13
|
+
/tmp/
|
14
|
+
|
15
|
+
## Specific to RubyMotion:
|
16
|
+
.dat*
|
17
|
+
.repl_history
|
18
|
+
build/
|
19
|
+
|
20
|
+
## Documentation cache and generated files:
|
21
|
+
/.yardoc/
|
22
|
+
/_yardoc/
|
23
|
+
/doc/
|
24
|
+
/rdoc/
|
25
|
+
|
26
|
+
## Environment normalisation:
|
27
|
+
/.bundle/
|
28
|
+
/lib/bundler/man/
|
29
|
+
|
30
|
+
# for a library or gem, you might want to ignore these files since the code is
|
31
|
+
# intended to run in multiple environments; otherwise, check them in:
|
32
|
+
# Gemfile.lock
|
33
|
+
# .ruby-version
|
34
|
+
# .ruby-gemset
|
35
|
+
|
36
|
+
# unless supporting rvm < 1.11.0 or doing something fancy, ignore this:
|
37
|
+
.rvmrc
|
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,118 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
rubytcc (0.0.1)
|
5
|
+
faraday (~> 0.9.0)
|
6
|
+
nori (~> 2.4.0)
|
7
|
+
savon (~> 2.5.1)
|
8
|
+
xml-mapping (~> 0.10.0)
|
9
|
+
|
10
|
+
GEM
|
11
|
+
remote: https://rubygems.org/
|
12
|
+
specs:
|
13
|
+
addressable (2.3.6)
|
14
|
+
akami (1.2.2)
|
15
|
+
gyoku (>= 0.4.0)
|
16
|
+
nokogiri
|
17
|
+
builder (3.2.2)
|
18
|
+
celluloid (0.16.0)
|
19
|
+
timers (~> 4.0.0)
|
20
|
+
coderay (1.1.0)
|
21
|
+
crack (0.4.2)
|
22
|
+
safe_yaml (~> 1.0.0)
|
23
|
+
diff-lcs (1.2.5)
|
24
|
+
faraday (0.9.0)
|
25
|
+
multipart-post (>= 1.2, < 3)
|
26
|
+
ffi (1.9.6)
|
27
|
+
formatador (0.2.5)
|
28
|
+
growl (1.0.3)
|
29
|
+
guard (2.6.1)
|
30
|
+
formatador (>= 0.2.4)
|
31
|
+
listen (~> 2.7)
|
32
|
+
lumberjack (~> 1.0)
|
33
|
+
pry (>= 0.9.12)
|
34
|
+
thor (>= 0.18.1)
|
35
|
+
guard-rspec (4.3.1)
|
36
|
+
guard (~> 2.1)
|
37
|
+
rspec (>= 2.14, < 4.0)
|
38
|
+
gyoku (1.1.1)
|
39
|
+
builder (>= 2.1.2)
|
40
|
+
hitimes (1.2.2)
|
41
|
+
httpi (2.1.1)
|
42
|
+
rack
|
43
|
+
rubyntlm (~> 0.3.2)
|
44
|
+
listen (2.7.11)
|
45
|
+
celluloid (>= 0.15.2)
|
46
|
+
rb-fsevent (>= 0.9.3)
|
47
|
+
rb-inotify (>= 0.9)
|
48
|
+
lumberjack (1.0.9)
|
49
|
+
macaddr (1.7.1)
|
50
|
+
systemu (~> 2.6.2)
|
51
|
+
method_source (0.8.2)
|
52
|
+
mini_portile (0.6.0)
|
53
|
+
multipart-post (2.0.0)
|
54
|
+
nokogiri (1.6.3.1)
|
55
|
+
mini_portile (= 0.6.0)
|
56
|
+
nori (2.4.0)
|
57
|
+
pry (0.10.1)
|
58
|
+
coderay (~> 1.1.0)
|
59
|
+
method_source (~> 0.8.1)
|
60
|
+
slop (~> 3.4)
|
61
|
+
rack (1.5.2)
|
62
|
+
rake (10.3.2)
|
63
|
+
rb-fsevent (0.9.4)
|
64
|
+
rb-inotify (0.9.5)
|
65
|
+
ffi (>= 0.5.0)
|
66
|
+
rspec (3.1.0)
|
67
|
+
rspec-core (~> 3.1.0)
|
68
|
+
rspec-expectations (~> 3.1.0)
|
69
|
+
rspec-mocks (~> 3.1.0)
|
70
|
+
rspec-core (3.1.7)
|
71
|
+
rspec-support (~> 3.1.0)
|
72
|
+
rspec-expectations (3.1.2)
|
73
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
74
|
+
rspec-support (~> 3.1.0)
|
75
|
+
rspec-mocks (3.1.3)
|
76
|
+
rspec-support (~> 3.1.0)
|
77
|
+
rspec-support (3.1.2)
|
78
|
+
ruby_gntp (0.3.4)
|
79
|
+
rubyntlm (0.3.4)
|
80
|
+
safe_yaml (1.0.4)
|
81
|
+
savon (2.5.1)
|
82
|
+
akami (~> 1.2.0)
|
83
|
+
builder (>= 2.1.2)
|
84
|
+
gyoku (~> 1.1.0)
|
85
|
+
httpi (~> 2.1.0)
|
86
|
+
nokogiri (>= 1.4.0)
|
87
|
+
nori (~> 2.4.0)
|
88
|
+
uuid (~> 2.3.7)
|
89
|
+
wasabi (~> 3.3.0)
|
90
|
+
slop (3.6.0)
|
91
|
+
systemu (2.6.4)
|
92
|
+
thor (0.19.1)
|
93
|
+
timers (4.0.1)
|
94
|
+
hitimes
|
95
|
+
uuid (2.3.7)
|
96
|
+
macaddr (~> 1.0)
|
97
|
+
vcr (2.9.3)
|
98
|
+
wasabi (3.3.1)
|
99
|
+
httpi (~> 2.0)
|
100
|
+
nokogiri (>= 1.4.0)
|
101
|
+
webmock (1.19.0)
|
102
|
+
addressable (>= 2.3.6)
|
103
|
+
crack (>= 0.3.2)
|
104
|
+
xml-mapping (0.10.0)
|
105
|
+
|
106
|
+
PLATFORMS
|
107
|
+
ruby
|
108
|
+
|
109
|
+
DEPENDENCIES
|
110
|
+
growl (~> 1.0.0)
|
111
|
+
guard (~> 2.6.0)
|
112
|
+
guard-rspec (~> 4.3.0)
|
113
|
+
rake (~> 10.3.2)
|
114
|
+
rspec (~> 3.1.0)
|
115
|
+
ruby_gntp (~> 0.3.4)
|
116
|
+
rubytcc!
|
117
|
+
vcr (~> 2.9.3)
|
118
|
+
webmock (~> 1.19.0)
|
data/Guardfile
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# A sample Guardfile
|
2
|
+
# More info at https://github.com/guard/guard#readme
|
3
|
+
|
4
|
+
# Note: The cmd option is now required due to the increasing number of ways
|
5
|
+
# rspec may be run, below are examples of the most common uses.
|
6
|
+
# * bundler: 'bundle exec rspec'
|
7
|
+
# * bundler binstubs: 'bin/rspec'
|
8
|
+
# * spring: 'bin/rsspec' (This will use spring if running and you have
|
9
|
+
# installed the spring binstubs per the docs)
|
10
|
+
# * zeus: 'zeus rspec' (requires the server to be started separetly)
|
11
|
+
# * 'just' rspec: 'rspec'
|
12
|
+
guard :rspec, cmd: 'bundle exec rspec' do
|
13
|
+
watch(%r{^spec/.+_spec\.rb$})
|
14
|
+
watch(%r{^spec/lib/.+_spec\.rb$})
|
15
|
+
watch(%r{^spec/lib/rubytcc/.+_spec\.rb$})
|
16
|
+
watch(%r{^spec/lib/rubytcc/rest/.+_spec\.rb$})
|
17
|
+
watch(%r{^lib/(.+)\.rb$}) { "spec" }
|
18
|
+
watch(%r{^lib/rubytcc/(.+)\.rb$}) { "spec" }
|
19
|
+
watch(%r{^lib/rubytcc/rest/(.+)\.rb$}) { |m| "spec/lib/rubytcc/rest/#{m[1]}_spec.rb" }
|
20
|
+
watch('spec/spec_helper.rb') { "spec" }
|
21
|
+
end
|
22
|
+
|
data/LICENSE
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2014 Austin
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
13
|
+
copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
21
|
+
SOFTWARE.
|
22
|
+
|
data/Rakefile
ADDED
@@ -0,0 +1,10 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
Bundler::GemHelper.install_tasks
|
5
|
+
|
6
|
+
# @source: http://simonecarletti.com/blog/2009/09/rake-console/
|
7
|
+
desc "Open an irb session preloaded with this library"
|
8
|
+
task :console do
|
9
|
+
sh "irb -rubygems -I lib -r rubytcc.rb"
|
10
|
+
end
|
data/Readme.md
ADDED
@@ -0,0 +1,107 @@
|
|
1
|
+
ruby-tcc
|
2
|
+
================
|
3
|
+
|
4
|
+
Ruby client for the Honeywell Total Connect Comfort API.
|
5
|
+
|
6
|
+
[![Code Climate](https://codeclimate.com/github/auzroz/ruby-tcc/badges/gpa.svg)](https://codeclimate.com/github/auzroz/ruby-tcc)
|
7
|
+
## Installation
|
8
|
+
|
9
|
+
In your Gemfile:
|
10
|
+
|
11
|
+
```ruby
|
12
|
+
gem "ruby-tcc", "~> 0.0.1"
|
13
|
+
```
|
14
|
+
|
15
|
+
or
|
16
|
+
|
17
|
+
```ruby
|
18
|
+
gem 'ruby-tcc', :git => 'https://github.com/auzroz/ruby-tcc'
|
19
|
+
```
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
First create a Client:
|
23
|
+
```ruby
|
24
|
+
client = RubyTCC::REST::Client.new(:username => USERNAME, :password => PASSWORD)
|
25
|
+
```
|
26
|
+
Second, authenticate the login:
|
27
|
+
```ruby
|
28
|
+
client.authenticate_user_login
|
29
|
+
```
|
30
|
+
Next, calls can be made using the client object to availble APIs.
|
31
|
+
|
32
|
+
```ruby
|
33
|
+
client.get_locations
|
34
|
+
```
|
35
|
+
|
36
|
+
## Currently Supported APIs
|
37
|
+
* AuthenticateUserLogin
|
38
|
+
* ChangeThermostatFan
|
39
|
+
* ChangeThermostatUI
|
40
|
+
* CreateLocation
|
41
|
+
* EditLocation
|
42
|
+
* GetCommTaskState
|
43
|
+
* GetLocations
|
44
|
+
* GetSchedule
|
45
|
+
* GetShortLocationInfo
|
46
|
+
* GetSystemGeoInfo
|
47
|
+
* GetThermostat
|
48
|
+
* GetThermostatFan
|
49
|
+
* GetThermostatHumidification
|
50
|
+
* GetThermostatUI
|
51
|
+
* GetVolatileThermostatData
|
52
|
+
* GetWeatherForecast
|
53
|
+
* KeepAlive
|
54
|
+
* LogOff
|
55
|
+
|
56
|
+
## APIs In Progress
|
57
|
+
* CancelScheduleChanges
|
58
|
+
* ChangeSchedule
|
59
|
+
* SubmitScheduleChanges
|
60
|
+
|
61
|
+
## APIs Currently Unable to Test
|
62
|
+
|
63
|
+
Based on the [Honeywell 7-Day Wifi Thermostat (RTH6580WF1001/W)](http://smile.amazon.com/gp/product/B00A97FIG0/ref=oh_details_o00_s00_i00?ie=UTF8&psc=1), the following APIs are not available to test. Any pull requests that can verify the function would be appreciated.
|
64
|
+
|
65
|
+
* AcceptInvitation
|
66
|
+
* ChangeThermostatHumidification
|
67
|
+
* DeclineInvitation
|
68
|
+
* DismissSiteAlert
|
69
|
+
* DismissThermostatAlert
|
70
|
+
* DismissCommunicationAlert
|
71
|
+
* EditDealerInformation
|
72
|
+
* Edit PreferredDealerInformation
|
73
|
+
* EmailDealer
|
74
|
+
* GetDREvent
|
75
|
+
* GetDealerInformation
|
76
|
+
* GetPendingInvitations
|
77
|
+
* HideDREvent
|
78
|
+
* OptOutDREvent
|
79
|
+
* RequestDealerInvitation
|
80
|
+
* WiringToolGetThermostats
|
81
|
+
* WiringToolGetWireMapWithAnswer
|
82
|
+
|
83
|
+
## APIs That Are Outside of Scope
|
84
|
+
|
85
|
+
These functions are best left to the official app and website.
|
86
|
+
|
87
|
+
* CreateAccount
|
88
|
+
* GetSecurityQuestions
|
89
|
+
* RegisterGateway
|
90
|
+
* ResendAccountActivationEmail
|
91
|
+
* ResetPassword
|
92
|
+
* UnregisterGateway
|
93
|
+
* UpdateLocationLevelOfAccess
|
94
|
+
|
95
|
+
## Contributing
|
96
|
+
|
97
|
+
Feel free to contribute, there are several options available that I don't have the ability to test with a home thermostat.
|
98
|
+
|
99
|
+
You need to update your login and thermostat credentials in spec/spec_helper.rb before running them:
|
100
|
+
|
101
|
+
```bash
|
102
|
+
bundle exec rspec spec
|
103
|
+
```
|
104
|
+
- or -
|
105
|
+
```bash
|
106
|
+
bundle exec guard
|
107
|
+
```
|
data/lib/rubytcc.rb
ADDED
@@ -0,0 +1,72 @@
|
|
1
|
+
require 'rubytcc/error'
|
2
|
+
|
3
|
+
module RubyTCC
|
4
|
+
class Client
|
5
|
+
attr_accessor :username, :password, :application_id, :application_version, :ui_language, :proxy
|
6
|
+
attr_writer :user_agent
|
7
|
+
|
8
|
+
|
9
|
+
# Initializes a new Client object
|
10
|
+
#
|
11
|
+
# @param options [Hash]
|
12
|
+
# @return [RubyTCC::Client]
|
13
|
+
def initialize(options = {})
|
14
|
+
options.each do |key, value|
|
15
|
+
send(:"#{key}=", value)
|
16
|
+
end
|
17
|
+
yield(self) if block_given?
|
18
|
+
validate_credential_type!
|
19
|
+
end
|
20
|
+
|
21
|
+
# @return [String]
|
22
|
+
def user_agent
|
23
|
+
@user_agent ||= 'Apache-HttpClient/UNAVAILABLE (java 1.4)'
|
24
|
+
end
|
25
|
+
|
26
|
+
# @return [String]
|
27
|
+
def application_id
|
28
|
+
@application_id ||= 'a0c7a795-ff44-4bcd-9a99-420fac57ff04'
|
29
|
+
end
|
30
|
+
|
31
|
+
# @return [String]
|
32
|
+
def application_version
|
33
|
+
@application_version ||= '2'
|
34
|
+
end
|
35
|
+
|
36
|
+
# @return [String]
|
37
|
+
def ui_language
|
38
|
+
@ui_language ||= 'English'
|
39
|
+
end
|
40
|
+
|
41
|
+
# @return [Hash]
|
42
|
+
def credentials
|
43
|
+
{
|
44
|
+
:username => username,
|
45
|
+
:password => password,
|
46
|
+
:ApplicationId => self.application_id,
|
47
|
+
:ApplicationVersion => self.application_version,
|
48
|
+
:UiLanguage => self.ui_language
|
49
|
+
}
|
50
|
+
end
|
51
|
+
|
52
|
+
# @return [Boolean]
|
53
|
+
def credentials?
|
54
|
+
credentials.values.all?
|
55
|
+
end
|
56
|
+
|
57
|
+
private
|
58
|
+
|
59
|
+
# Ensures that all credentials set during configuration are of a
|
60
|
+
# valid type. Valid types are String and Symbol.
|
61
|
+
#
|
62
|
+
# @raise [RubyTCC::Error::ConfigurationError] Error is raised when
|
63
|
+
# supplied twitter credentials are not a String or Symbol.
|
64
|
+
def validate_credential_type!
|
65
|
+
credentials.each do |credential, value|
|
66
|
+
next if value.nil?
|
67
|
+
fail(RubyTCC::Error::ConfigurationError.new("Invalid #{credential} specified: #{value.inspect} must be a string or symbol.")) unless value.is_a?(String) || value.is_a?(Symbol)
|
68
|
+
end
|
69
|
+
end
|
70
|
+
|
71
|
+
end
|
72
|
+
end
|