Class: Access::Response
- Inherits:
-
Object
- Object
- Access::Response
- Defined in:
- lib/access/response.rb
Direct Known Subclasses
AmtResponse, AutocompleteResponse, CampaignResponse, CategoryResponse, ChannelResponse, CitySavingsResponse, DeviceResponse, FavoriteResponse, FilterResponse, GeolocationResponse, HotelResponse, LocationResponse, MemberResponse, OauthApplicationResponse, OfferResponse, ProductGroupResponse, ProgramResponse, RedeemResponse, RedemptionResponse, ReportResponse, ShoppingCartResponse, SpotResponse, StoreResponse, TokenResponse, UserResponse, VerifyResponse
Instance Attribute Summary collapse
-
#access_tokens ⇒ Object
readonly
resources.
-
#aggregations ⇒ Object
readonly
hotel.
-
#api_calls_over_time ⇒ Object
readonly
usages.
-
#campaign_description ⇒ Object
readonly
campaign show page.
-
#campaign_name ⇒ Object
readonly
campaign show page.
-
#campaign_ranking ⇒ Object
readonly
campaign show page.
-
#campaigns ⇒ Object
readonly
resources.
-
#categories ⇒ Object
readonly
resources.
-
#channel_description ⇒ Object
readonly
channel show page.
-
#channel_identifier ⇒ Object
readonly
channel show page.
-
#channel_list ⇒ Object
readonly
campaign show page.
-
#channel_name ⇒ Object
readonly
channel show page.
-
#channel_type ⇒ Object
readonly
channel show page.
-
#channels ⇒ Object
readonly
resources.
-
#content_type ⇒ Object
readonly
redemptions.
-
#custom_aggregation ⇒ Object
readonly
aggregations.
-
#data ⇒ Object
readonly
amt.
-
#details ⇒ Object
readonly
redemptions.
-
#dev_node ⇒ Object
readonly
basics.
-
#devices ⇒ Object
readonly
resources.
-
#end_date ⇒ Object
readonly
campaign show page.
-
#error ⇒ Object
readonly
basics.
-
#favorites ⇒ Object
readonly
resources.
-
#filters ⇒ Object
readonly
resources.
-
#hotels ⇒ Object
readonly
hotel.
-
#info ⇒ Object
readonly
basics.
-
#internal_details ⇒ Object
readonly
basics.
-
#key ⇒ Object
readonly
campaign show page.
-
#links ⇒ Object
readonly
basics.
-
#locations ⇒ Object
readonly
resources.
-
#member_usage ⇒ Object
readonly
usages.
-
#members ⇒ Object
readonly
resources.
-
#message ⇒ Object
readonly
basics.
-
#oauth_access_token ⇒ Object
readonly
resources.
-
#oauth_applications ⇒ Object
readonly
resources.
-
#oauth_token ⇒ Object
readonly
resources.
-
#oauth_tokens ⇒ Object
readonly
resources.
-
#offer_count_by_facet ⇒ Object
readonly
aggregations.
-
#offer_count_by_redemption_method ⇒ Object
readonly
aggregations.
-
#offer_count_in_categories ⇒ Object
readonly
aggregations.
-
#offer_redemptions ⇒ Object
readonly
resources.
-
#offer_resource ⇒ Object
readonly
spot show page.
-
#offers ⇒ Object
readonly
resources.
-
#product_groups ⇒ Object
readonly
resources.
-
#products ⇒ Object
readonly
resources.
-
#programs ⇒ Object
readonly
resources.
-
#redemption_method ⇒ Object
readonly
redemptions.
-
#reports ⇒ Object
readonly
resources.
-
#response ⇒ Object
readonly
basics.
-
#response_status ⇒ Object
readonly
basics.
-
#spot_image_url ⇒ Object
readonly
spot show page.
-
#spot_list ⇒ Object
readonly
campaign show page.
-
#spot_name ⇒ Object
readonly
spot show page.
-
#spot_ranking ⇒ Object
readonly
spot show page.
-
#spot_redirect_type ⇒ Object
readonly
spot show page.
-
#spot_redirect_url ⇒ Object
readonly
spot show page.
-
#spot_text ⇒ Object
readonly
spot show page.
-
#spots ⇒ Object
readonly
resources.
-
#start_date ⇒ Object
readonly
campaign show page.
-
#status ⇒ Object
readonly
basics.
-
#stores ⇒ Object
readonly
resources.
-
#success ⇒ Object
readonly
basics.
-
#suggestions ⇒ Object
readonly
resources.
-
#total_cart_count ⇒ Object
readonly
shopping cart count.
-
#users ⇒ Object
readonly
resources.
-
#verify ⇒ Object
readonly
resources.
Instance Method Summary collapse
- #check_success(response) ⇒ Object
- #create_error ⇒ Object
-
#initialize(response) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(response) ⇒ Response
Returns a new instance of Response.
27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/access/response.rb', line 27 def initialize(response) @response = response # Setting this temporarily so i can have a working member reg call, since it doesn't follow the resource [] best practices response.each { |key, value| instance_variable_set("@#{key}", value) if self.class.instance_methods.include? key.to_sym } @response_status = response. @status ||= response.code check_success(response) if @success @info = Access::Info.new(@info) if @info (@links = @links.is_a?(Array) ? Access::Link.process_batch(@links) : Access::Link.new(@links)) if @links process_data end end |
Instance Attribute Details
#access_tokens ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def access_tokens @access_tokens end |
#aggregations ⇒ Object (readonly)
hotel
25 26 27 |
# File 'lib/access/response.rb', line 25 def aggregations @aggregations end |
#api_calls_over_time ⇒ Object (readonly)
usages
13 14 15 |
# File 'lib/access/response.rb', line 13 def api_calls_over_time @api_calls_over_time end |
#campaign_description ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def campaign_description @campaign_description end |
#campaign_name ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def campaign_name @campaign_name end |
#campaign_ranking ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def campaign_ranking @campaign_ranking end |
#campaigns ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def campaigns @campaigns end |
#categories ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def categories @categories end |
#channel_description ⇒ Object (readonly)
channel show page
19 20 21 |
# File 'lib/access/response.rb', line 19 def channel_description @channel_description end |
#channel_identifier ⇒ Object (readonly)
channel show page
19 20 21 |
# File 'lib/access/response.rb', line 19 def channel_identifier @channel_identifier end |
#channel_list ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def channel_list @channel_list end |
#channel_name ⇒ Object (readonly)
channel show page
19 20 21 |
# File 'lib/access/response.rb', line 19 def channel_name @channel_name end |
#channel_type ⇒ Object (readonly)
channel show page
19 20 21 |
# File 'lib/access/response.rb', line 19 def channel_type @channel_type end |
#channels ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def channels @channels end |
#content_type ⇒ Object (readonly)
redemptions
11 12 13 |
# File 'lib/access/response.rb', line 11 def content_type @content_type end |
#custom_aggregation ⇒ Object (readonly)
aggregations
9 10 11 |
# File 'lib/access/response.rb', line 9 def custom_aggregation @custom_aggregation end |
#data ⇒ Object (readonly)
amt
23 24 25 |
# File 'lib/access/response.rb', line 23 def data @data end |
#details ⇒ Object (readonly)
redemptions
11 12 13 |
# File 'lib/access/response.rb', line 11 def details @details end |
#dev_node ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def dev_node @dev_node end |
#devices ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def devices @devices end |
#end_date ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def end_date @end_date end |
#error ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def error @error end |
#favorites ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def favorites @favorites end |
#filters ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def filters @filters end |
#hotels ⇒ Object (readonly)
hotel
25 26 27 |
# File 'lib/access/response.rb', line 25 def hotels @hotels end |
#info ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def info @info end |
#internal_details ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def internal_details @internal_details end |
#key ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def key @key end |
#links ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def links @links end |
#locations ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def locations @locations end |
#member_usage ⇒ Object (readonly)
usages
13 14 15 |
# File 'lib/access/response.rb', line 13 def member_usage @member_usage end |
#members ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def members @members end |
#message ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def @message end |
#oauth_access_token ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def oauth_access_token @oauth_access_token end |
#oauth_applications ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def oauth_applications @oauth_applications end |
#oauth_token ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def oauth_token @oauth_token end |
#oauth_tokens ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def oauth_tokens @oauth_tokens end |
#offer_count_by_facet ⇒ Object (readonly)
aggregations
9 10 11 |
# File 'lib/access/response.rb', line 9 def offer_count_by_facet @offer_count_by_facet end |
#offer_count_by_redemption_method ⇒ Object (readonly)
aggregations
9 10 11 |
# File 'lib/access/response.rb', line 9 def offer_count_by_redemption_method @offer_count_by_redemption_method end |
#offer_count_in_categories ⇒ Object (readonly)
aggregations
9 10 11 |
# File 'lib/access/response.rb', line 9 def offer_count_in_categories @offer_count_in_categories end |
#offer_redemptions ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def offer_redemptions @offer_redemptions end |
#offer_resource ⇒ Object (readonly)
spot show page
17 18 19 |
# File 'lib/access/response.rb', line 17 def offer_resource @offer_resource end |
#offers ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def offers @offers end |
#product_groups ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def product_groups @product_groups end |
#products ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def products @products end |
#programs ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def programs @programs end |
#redemption_method ⇒ Object (readonly)
redemptions
11 12 13 |
# File 'lib/access/response.rb', line 11 def redemption_method @redemption_method end |
#reports ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def reports @reports end |
#response ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def response @response end |
#response_status ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def response_status @response_status end |
#spot_image_url ⇒ Object (readonly)
spot show page
17 18 19 |
# File 'lib/access/response.rb', line 17 def spot_image_url @spot_image_url end |
#spot_list ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def spot_list @spot_list end |
#spot_name ⇒ Object (readonly)
spot show page
17 18 19 |
# File 'lib/access/response.rb', line 17 def spot_name @spot_name end |
#spot_ranking ⇒ Object (readonly)
spot show page
17 18 19 |
# File 'lib/access/response.rb', line 17 def spot_ranking @spot_ranking end |
#spot_redirect_type ⇒ Object (readonly)
spot show page
17 18 19 |
# File 'lib/access/response.rb', line 17 def spot_redirect_type @spot_redirect_type end |
#spot_redirect_url ⇒ Object (readonly)
spot show page
17 18 19 |
# File 'lib/access/response.rb', line 17 def spot_redirect_url @spot_redirect_url end |
#spot_text ⇒ Object (readonly)
spot show page
17 18 19 |
# File 'lib/access/response.rb', line 17 def spot_text @spot_text end |
#spots ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def spots @spots end |
#start_date ⇒ Object (readonly)
campaign show page
15 16 17 |
# File 'lib/access/response.rb', line 15 def start_date @start_date end |
#status ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def status @status end |
#stores ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def stores @stores end |
#success ⇒ Object (readonly)
basics
5 6 7 |
# File 'lib/access/response.rb', line 5 def success @success end |
#suggestions ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def suggestions @suggestions end |
#total_cart_count ⇒ Object (readonly)
shopping cart count
21 22 23 |
# File 'lib/access/response.rb', line 21 def total_cart_count @total_cart_count end |
#users ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def users @users end |
#verify ⇒ Object (readonly)
resources
7 8 9 |
# File 'lib/access/response.rb', line 7 def verify @verify end |
Instance Method Details
#check_success(response) ⇒ Object
40 41 42 43 44 45 46 |
# File 'lib/access/response.rb', line 40 def check_success(response) if response.success? @success = true else create_error end end |