Class: TripIt::Profile
Instance Attribute Summary collapse
-
#about_me_info ⇒ Object
readonly
Returns the value of attribute about_me_info.
-
#activity_feed_url ⇒ Object
readonly
Returns the value of attribute activity_feed_url.
-
#alerts_feed_url ⇒ Object
readonly
Returns the value of attribute alerts_feed_url.
-
#company ⇒ Object
readonly
Returns the value of attribute company.
-
#group_memberships ⇒ Object
readonly
Returns the value of attribute group_memberships.
-
#home_city ⇒ Object
readonly
Returns the value of attribute home_city.
-
#ical_url ⇒ Object
readonly
Returns the value of attribute ical_url.
-
#photo_url ⇒ Object
readonly
Returns the value of attribute photo_url.
-
#profile_email_addresses ⇒ Object
readonly
Returns the value of attribute profile_email_addresses.
-
#profile_url ⇒ Object
readonly
Returns the value of attribute profile_url.
-
#public_display_name ⇒ Object
readonly
Returns the value of attribute public_display_name.
-
#ref ⇒ Object
readonly
Returns the value of attribute ref.
-
#screen_name ⇒ Object
readonly
Returns the value of attribute screen_name.
Instance Method Summary collapse
-
#initialize(client, source = nil) ⇒ Profile
constructor
A new instance of Profile.
- #points_programs ⇒ Object
- #populate(source) ⇒ Object
- #subscribe_trips ⇒ Object
- #trips(params = {}) ⇒ Object
- #unsubscribe ⇒ Object
Methods inherited from Base
#Boolean, #camelize, #chkAndPopulate, #chkObjAndPopulate, #convertDT, #to_hash, #to_json, #to_xml
Methods included from ParamUtil
#address_param, #airportcode_param, #array_param, #boolean_param, #boolean_read_param, #camelize, #date_param, #datetime_param, #exceptions, #float_param, #integer_param, #string_param, #time_param, #traveler_array_param, #traveler_param
Constructor Details
#initialize(client, source = nil) ⇒ Profile
Returns a new instance of Profile.
7 8 9 10 11 |
# File 'lib/trip_it/classes/profile.rb', line 7 def initialize(client, source = nil) @client = client @tripCache ||= {} populate(source) end |
Instance Attribute Details
#about_me_info ⇒ Object (readonly)
Returns the value of attribute about_me_info.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def about_me_info @about_me_info end |
#activity_feed_url ⇒ Object (readonly)
Returns the value of attribute activity_feed_url.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def activity_feed_url @activity_feed_url end |
#alerts_feed_url ⇒ Object (readonly)
Returns the value of attribute alerts_feed_url.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def alerts_feed_url @alerts_feed_url end |
#company ⇒ Object (readonly)
Returns the value of attribute company.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def company @company end |
#group_memberships ⇒ Object (readonly)
Returns the value of attribute group_memberships.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def group_memberships @group_memberships end |
#home_city ⇒ Object (readonly)
Returns the value of attribute home_city.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def home_city @home_city end |
#ical_url ⇒ Object (readonly)
Returns the value of attribute ical_url.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def ical_url @ical_url end |
#photo_url ⇒ Object (readonly)
Returns the value of attribute photo_url.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def photo_url @photo_url end |
#profile_email_addresses ⇒ Object (readonly)
Returns the value of attribute profile_email_addresses.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def profile_email_addresses @profile_email_addresses end |
#profile_url ⇒ Object (readonly)
Returns the value of attribute profile_url.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def profile_url @profile_url end |
#public_display_name ⇒ Object (readonly)
Returns the value of attribute public_display_name.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def public_display_name @public_display_name end |
#ref ⇒ Object (readonly)
Returns the value of attribute ref.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def ref @ref end |
#screen_name ⇒ Object (readonly)
Returns the value of attribute screen_name.
3 4 5 |
# File 'lib/trip_it/classes/profile.rb', line 3 def screen_name @screen_name end |
Instance Method Details
#points_programs ⇒ Object
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/trip_it/classes/profile.rb', line 54 def points_programs return [] if self.is_pro == false return @progArr unless @progArr.nil? @progArr = [] progList = @client.list("/points_program")["PointsProgram"] unless progList.nil? if progList.is_a?(Array) progList.each do |prog| @progArr << TripIt::PointsProgram.new(prog) end else @progArr << TripIt::PointsProgram.new(progList) end end return @progArr end |
#populate(source) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/trip_it/classes/profile.rb', line 13 def populate(source) info = source || @client.get("/profile")["Profile"] @screen_name = info['screen_name'] @public_display_name = info['public_display_name'] @profile_url = info['profile_url'] @home_city = info['home_city'] @company = info['company'] @about_me_info = info['about_me_info'] @photo_url = info['photo_url'] @activity_feed_url = info['activity_feed_url'] @alerts_feed_url = info['alerts_feed_url'] @is_pro = Boolean(info['is_pro']) @is_client = Boolean(info['is_client']) @ical_url = info['ical_url'] @ref = info['@attributes']['ref'] @profile_email_addresses = [] @group_memberships = [] chkAndPopulate(@profile_email_addresses, TripIt::ProfileEmailAddress, info['ProfileEmailAddresses']['ProfileEmailAddress']) unless info['ProfileEmailAddresses'].nil? chkAndPopulate(@group_memberships, TripIt::Group, info['GroupMemberships']['Group']) unless info['GroupMemberships'].nil? end |
#subscribe_trips ⇒ Object
71 72 73 |
# File 'lib/trip_it/classes/profile.rb', line 71 def subscribe_trips @client.subscribe("/trip") end |
#trips(params = {}) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 |
# File 'lib/trip_it/classes/profile.rb', line 36 def trips(params = {}) serialized_param_str = params.keys.sort.inject('') do |str, key| str += "#{key}:#{params[key]}::" end return @tripCache[serialized_param_str] unless @tripCache[serialized_param_str].nil? tripArr = [] tripList = @client.list("/trip", params)["Trip"] unless tripList.nil? if tripList.is_a?(Array) tripList.each do |trip| tripArr << TripIt::Trip.new(@client,trip['id'],params[:include_objects]) end else tripArr << TripIt::Trip.new(@client,tripList['id'],params[:include_objects]) end end @tripCache[serialized_param_str] = tripArr return tripArr end |
#unsubscribe ⇒ Object
75 76 77 |
# File 'lib/trip_it/classes/profile.rb', line 75 def unsubscribe @client.unsubscribe end |