Class: Access::Response
- Inherits:
-
Object
- Object
- Access::Response
- Defined in:
- lib/access/response.rb
Direct Known Subclasses
AutocompleteResponse, CampaignResponse, CategoryResponse, ChannelResponse, CitySavingsResponse, FavoriteResponse, FilterResponse, GeolocationResponse, LocationResponse, MemberResponse, OauthApplicationResponse, OfferResponse, RedeemResponse, RedemptionResponse, ReportResponse, SpotResponse, StoreResponse, TokenResponse, VerifyResponse
Instance Attribute Summary collapse
-
#access_tokens ⇒ Object
Returns the value of attribute access_tokens.
-
#api_calls_over_time ⇒ Object
Returns the value of attribute api_calls_over_time.
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#custom_aggregation ⇒ Object
Returns the value of attribute custom_aggregation.
-
#details ⇒ Object
Returns the value of attribute details.
-
#dev_node ⇒ Object
Returns the value of attribute dev_node.
-
#error ⇒ Object
Returns the value of attribute error.
-
#favorites ⇒ Object
Returns the value of attribute favorites.
-
#filters ⇒ Object
Returns the value of attribute filters.
-
#info ⇒ Object
Returns the value of attribute info.
-
#internal_details ⇒ Object
Returns the value of attribute internal_details.
-
#links ⇒ Object
Returns the value of attribute links.
-
#locations ⇒ Object
Returns the value of attribute locations.
-
#member_usage ⇒ Object
Returns the value of attribute member_usage.
-
#members ⇒ Object
Returns the value of attribute members.
-
#message ⇒ Object
Returns the value of attribute message.
-
#oauth_access_token ⇒ Object
Returns the value of attribute oauth_access_token.
-
#oauth_applications ⇒ Object
Returns the value of attribute oauth_applications.
-
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
-
#oauth_tokens ⇒ Object
Returns the value of attribute oauth_tokens.
-
#offer_count_by_facet ⇒ Object
Returns the value of attribute offer_count_by_facet.
-
#offer_count_by_redemption_method ⇒ Object
Returns the value of attribute offer_count_by_redemption_method.
-
#offer_count_in_categories ⇒ Object
Returns the value of attribute offer_count_in_categories.
-
#offer_redemptions ⇒ Object
Returns the value of attribute offer_redemptions.
-
#offers ⇒ Object
Returns the value of attribute offers.
-
#redemption_method ⇒ Object
Returns the value of attribute redemption_method.
-
#reports ⇒ Object
Returns the value of attribute reports.
-
#response ⇒ Object
Returns the value of attribute response.
-
#response_status ⇒ Object
Returns the value of attribute response_status.
-
#status ⇒ Object
Returns the value of attribute status.
-
#stores ⇒ Object
Returns the value of attribute stores.
-
#success ⇒ Object
Returns the value of attribute success.
-
#suggestions ⇒ Object
Returns the value of attribute suggestions.
-
#users ⇒ Object
Returns the value of attribute users.
-
#verify ⇒ Object
Returns the value of attribute verify.
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.
6 7 8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/access/response.rb', line 6 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
Returns the value of attribute access_tokens.
4 5 6 |
# File 'lib/access/response.rb', line 4 def access_tokens @access_tokens end |
#api_calls_over_time ⇒ Object
Returns the value of attribute api_calls_over_time.
4 5 6 |
# File 'lib/access/response.rb', line 4 def api_calls_over_time @api_calls_over_time end |
#categories ⇒ Object
Returns the value of attribute categories.
4 5 6 |
# File 'lib/access/response.rb', line 4 def categories @categories end |
#content_type ⇒ Object
Returns the value of attribute content_type.
4 5 6 |
# File 'lib/access/response.rb', line 4 def content_type @content_type end |
#custom_aggregation ⇒ Object
Returns the value of attribute custom_aggregation.
4 5 6 |
# File 'lib/access/response.rb', line 4 def custom_aggregation @custom_aggregation end |
#details ⇒ Object
Returns the value of attribute details.
4 5 6 |
# File 'lib/access/response.rb', line 4 def details @details end |
#dev_node ⇒ Object
Returns the value of attribute dev_node.
4 5 6 |
# File 'lib/access/response.rb', line 4 def dev_node @dev_node end |
#error ⇒ Object
Returns the value of attribute error.
4 5 6 |
# File 'lib/access/response.rb', line 4 def error @error end |
#favorites ⇒ Object
Returns the value of attribute favorites.
4 5 6 |
# File 'lib/access/response.rb', line 4 def favorites @favorites end |
#filters ⇒ Object
Returns the value of attribute filters.
4 5 6 |
# File 'lib/access/response.rb', line 4 def filters @filters end |
#info ⇒ Object
Returns the value of attribute info.
4 5 6 |
# File 'lib/access/response.rb', line 4 def info @info end |
#internal_details ⇒ Object
Returns the value of attribute internal_details.
4 5 6 |
# File 'lib/access/response.rb', line 4 def internal_details @internal_details end |
#links ⇒ Object
Returns the value of attribute links.
4 5 6 |
# File 'lib/access/response.rb', line 4 def links @links end |
#locations ⇒ Object
Returns the value of attribute locations.
4 5 6 |
# File 'lib/access/response.rb', line 4 def locations @locations end |
#member_usage ⇒ Object
Returns the value of attribute member_usage.
4 5 6 |
# File 'lib/access/response.rb', line 4 def member_usage @member_usage end |
#members ⇒ Object
Returns the value of attribute members.
4 5 6 |
# File 'lib/access/response.rb', line 4 def members @members end |
#message ⇒ Object
Returns the value of attribute message.
4 5 6 |
# File 'lib/access/response.rb', line 4 def @message end |
#oauth_access_token ⇒ Object
Returns the value of attribute oauth_access_token.
4 5 6 |
# File 'lib/access/response.rb', line 4 def oauth_access_token @oauth_access_token end |
#oauth_applications ⇒ Object
Returns the value of attribute oauth_applications.
4 5 6 |
# File 'lib/access/response.rb', line 4 def oauth_applications @oauth_applications end |
#oauth_token ⇒ Object
Returns the value of attribute oauth_token.
4 5 6 |
# File 'lib/access/response.rb', line 4 def oauth_token @oauth_token end |
#oauth_tokens ⇒ Object
Returns the value of attribute oauth_tokens.
4 5 6 |
# File 'lib/access/response.rb', line 4 def oauth_tokens @oauth_tokens end |
#offer_count_by_facet ⇒ Object
Returns the value of attribute offer_count_by_facet.
4 5 6 |
# File 'lib/access/response.rb', line 4 def offer_count_by_facet @offer_count_by_facet end |
#offer_count_by_redemption_method ⇒ Object
Returns the value of attribute offer_count_by_redemption_method.
4 5 6 |
# File 'lib/access/response.rb', line 4 def offer_count_by_redemption_method @offer_count_by_redemption_method end |
#offer_count_in_categories ⇒ Object
Returns the value of attribute offer_count_in_categories.
4 5 6 |
# File 'lib/access/response.rb', line 4 def offer_count_in_categories @offer_count_in_categories end |
#offer_redemptions ⇒ Object
Returns the value of attribute offer_redemptions.
4 5 6 |
# File 'lib/access/response.rb', line 4 def offer_redemptions @offer_redemptions end |
#offers ⇒ Object
Returns the value of attribute offers.
4 5 6 |
# File 'lib/access/response.rb', line 4 def offers @offers end |
#redemption_method ⇒ Object
Returns the value of attribute redemption_method.
4 5 6 |
# File 'lib/access/response.rb', line 4 def redemption_method @redemption_method end |
#reports ⇒ Object
Returns the value of attribute reports.
4 5 6 |
# File 'lib/access/response.rb', line 4 def reports @reports end |
#response ⇒ Object
Returns the value of attribute response.
4 5 6 |
# File 'lib/access/response.rb', line 4 def response @response end |
#response_status ⇒ Object
Returns the value of attribute response_status.
4 5 6 |
# File 'lib/access/response.rb', line 4 def response_status @response_status end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'lib/access/response.rb', line 4 def status @status end |
#stores ⇒ Object
Returns the value of attribute stores.
4 5 6 |
# File 'lib/access/response.rb', line 4 def stores @stores end |
#success ⇒ Object
Returns the value of attribute success.
4 5 6 |
# File 'lib/access/response.rb', line 4 def success @success end |
#suggestions ⇒ Object
Returns the value of attribute suggestions.
4 5 6 |
# File 'lib/access/response.rb', line 4 def suggestions @suggestions end |
#users ⇒ Object
Returns the value of attribute users.
4 5 6 |
# File 'lib/access/response.rb', line 4 def users @users end |
#verify ⇒ Object
Returns the value of attribute verify.
4 5 6 |
# File 'lib/access/response.rb', line 4 def verify @verify end |
Instance Method Details
#check_success(response) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/access/response.rb', line 20 def check_success(response) if response.success? @success = true else create_error end end |