ip2k / google-api-ruby-client

Automatically exported from code.google.com/p/google-api-ruby-client
Apache License 2.0
0 stars 0 forks source link

API Discovery is broken on REE 1.8.7 2012.02 #53

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
Run this code:
client = Google::APIClient.new
client.discovered_api('analytics', 'v3')

What is the expected output? What do you see instead?
Expected: API Discovery works correctly
Observed: API Discovery crashes with a LoadError. Note that this also happens 
for other services like Plus v1.

What version of the product are you using? On what operating system?
Gem version 0.4.5 on Mac with ree-1.8.7-2012.02

It seems to work correctly on Ruby 1.9.3. I'm guessing there is some dependency 
on something that is specific to Ruby 1.9.3. I would really appreciate it if 
this could be fixed to work on ree-1.8.7 as well, as we and many others are not 
on Ruby 1.9.3 as of yet.

Original issue reported on code.google.com by Jwkpia...@gmail.com on 13 Aug 2012 at 7:14

GoogleCodeExporter commented 9 years ago
Please include the stack trace of the error your seeing.

Original comment by bobaman@google.com on 14 Aug 2012 at 8:56

GoogleCodeExporter commented 9 years ago
The relevant section is below:

LoadError: no such file to load -- {
 "kind": "discovery#restDescription",
 "discoveryVersion": "v1",
 "id": "analytics:v3",
 "name": "analytics",
 "version": "v3",
 "revision": "20120808",
 "title": "Google Analytics API",
 "description": "View and manage your Google Analytics data",
 "icons": {
  "x16": "http://www.google.com/images/icons/product/analytics-16.png",
  "x32": "http://www.google.com/images/icons/product/analytics-32.png"
 },
 "documentationLink": "http://code.google.com/apis/analytics",
 "protocol": "rest",
 "baseUrl": "https://www.googleapis.com/analytics/v3/",
 "basePath": "/analytics/v3/",
 "rootUrl": "https://www.googleapis.com/",
 "servicePath": "analytics/v3/",
 "batchPath": "batch",
 "parameters": {
  "alt": {
   "type": "string",
   "description": "Data format for the response.",
   "default": "json",
   "enum": [
    "json"
   ],
   "enumDescriptions": [
    "Responses with Content-Type of application/json"
   ],
   "location": "query"
  },
  "fields": {
   "type": "string",
   "description": "Selector specifying which fields to include in a partial response.",
   "location": "query"
  },
  "key": {
   "type": "string",
   "description": "API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token.",
   "location": "query"
  },
  "oauth_token": {
   "type": "string",
   "description": "OAuth 2.0 token for the current user.",
   "location": "query"
  },
  "prettyPrint": {
   "type": "boolean",
   "description": "Returns response with indentations and line breaks.",
   "default": "false",
   "location": "query"
  },
  "quotaUser": {
   "type": "string",
   "description": "Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. Overrides userIp if both are provided.",
   "location": "query"
  },
  "userIp": {
   "type": "string",
   "description": "IP address of the site where the request originates. Use this if you want to enforce per-user limits.",
   "location": "query"
  }
 },
 "auth": {
  "oauth2": {
   "scopes": {
    "https://www.googleapis.com/auth/analytics.readonly": {
     "description": "View your Google Analytics data"
    }
   }
  }
 },
 "schemas": {
  "Account": {
   "id": "Account",
   "type": "object",
   "description": "JSON template for Analytics account entry.",
   "properties": {
    "childLink": {
     "type": "object",
     "description": "Child link for an account entry. Points to the list of web properties for this account.",
     "properties": {
      "href": {
       "type": "string",
       "description": "Link to the list of web properties for this account."
      },
      "type": {
       "type": "string",
       "description": "Type of the child link. Its value is \"analytics#webproperties\".",
       "default": "analytics#webproperties"
      }
     }
    },
    "created": {
     "type": "string",
     "description": "Time the account was created.",
     "format": "date-time"
    },
    "id": {
     "type": "string",
     "description": "Account ID."
    },
    "kind": {
     "type": "string",
     "description": "Resource type for Analytics account.",
     "default": "analytics#account"
    },
    "name": {
     "type": "string",
     "description": "Account name."
    },
    "selfLink": {
     "type": "string",
     "description": "Link for this account."
    },
    "updated": {
     "type": "string",
     "description": "Time the account was last modified.",
     "format": "date-time"
    }
   }
  },
  "Accounts": {
   "id": "Accounts",
   "type": "object",
   "description": "An account collection provides a list of Analytics accounts to which a user has access. The account collection is the entry point to all management information. Each resource in the collection corresponds to a single Analytics account.",
   "properties": {
    "items": {
     "type": "array",
     "description": "A list of accounts.",
     "items": {
      "$ref": "Account"
     }
    },
    "itemsPerPage": {
     "type": "integer",
     "description": "The maximum number of entries the response can contain, regardless of the actual number of entries returned. Its value ranges from 1 to 10,000 with a value of 1000 by default, or otherwise specified by the max-results query parameter.",
     "format": "int32"
    },
    "kind": {
     "type": "string",
     "description": "Collection type.",
     "default": "analytics#accounts"
    },
    "nextLink": {
     "type": "string",
     "description": "Next link for this account collection."
    },
    "previousLink": {
     "type": "string",
     "description": "Previous link for this account collection."
    },
    "startIndex": {
     "type": "integer",
     "description": "The starting index of the entries, which is 1 by default or otherwise specified by the start-index query parameter.",
     "format": "int32"
    },
    "totalResults": {
     "type": "integer",
     "description": "The total number of results for the query, regardless of the number of results in the response.",
     "format": "int32"
    },
    "username": {
     "type": "string",
     "description": "Email ID of the authenticated user"
    }
   }
  },
  "GaData": {
   "id": "GaData",
   "type": "object",
   "description": "Analytics data for a given profile.",
   "properties": {
    "columnHeaders": {
     "type": "array",
     "description": "Column headers that list dimension names followed by the metric names. The order of dimensions and metrics is same as specified in the request.",
     "items": {
      "type": "object",
      "properties": {
       "columnType": {
        "type": "string",
        "description": "Column Type. Either DIMENSION or METRIC."
       },
       "dataType": {
        "type": "string",
        "description": "Data type. Dimension column headers have only STRING as the data type. Metric column headers have data types for metric values such as INTEGER, DOUBLE, CURRENCY etc."
       },
       "name": {
        "type": "string",
        "description": "Column name."
       }
      }
     }
    },
    "containsSampledData": {
     "type": "boolean",
     "description": "Determines if Analytics data contains samples."
    },
    "id": {
     "type": "string",
     "description": "Unique ID for this data response."
    },
    "itemsPerPage": {
     "type": "integer",
     "description": "The maximum number of rows the response can contain, regardless of the actual number of rows returned. Its value ranges from 1 to 10,000 with a value of 1000 by default, or otherwise specified by the max-results query parameter.",
     "format": "int32"
    },
    "kind": {
     "type": "string",
     "description": "Resource type.",
     "default": "analytics#gaData"
    },
    "nextLink": {
     "type": "string",
     "description": "Link to next page for this Analytics data query."
    },
    "previousLink": {
     "type": "string",
     "description": "Link to previous page for this Analytics data query."
    },
    "profileInfo": {
     "type": "object",
     "description": "Information for the profile, for which the Analytics data was requested.",
     "properties": {
      "accountId": {
       "type": "string",
       "description": "Account ID to which this profile belongs."
      },
      "internalWebPropertyId": {
       "type": "string",
       "description": "Internal ID for the web property to which this profile belongs."
      },
      "profileId": {
       "type": "string",
       "description": "Profile ID."
      },
      "profileName": {
       "type": "string",
       "description": "Profile name."
      },
      "tableId": {
       "type": "string",
       "description": "Table ID for profile."
      },
      "webPropertyId": {
       "type": "string",
       "description": "Web Property ID to which this profile belongs."
      }
     }
    },
    "query": {
     "type": "object",
     "description": "Analytics data request query parameters.",
     "properties": {
      "dimensions": {
       "type": "string",
       "description": "List of analytics dimensions."
      },
      "end-date": {

    from vendor/bundle/ruby/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from vendor/bundle/ruby/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from vendor/bundle/ruby/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:225:in `load_dependency'
    from vendor/bundle/ruby/1.8/gems/activesupport-3.1.6/lib/active_support/dependencies.rb:234:in `load'
    from vendor/bundle/ruby/1.8/gems/google-api-client-0.4.5/lib/google/api_client.rb:336:in `discovery_document'
    from vendor/bundle/ruby/1.8/gems/google-api-client-0.4.5/lib/google/api_client.rb:389:in `discovered_api'

Original comment by Jwkpia...@gmail.com on 14 Aug 2012 at 4:39

GoogleCodeExporter commented 9 years ago
I've discovered the problem. That line is using MultiJson.load, which is only 
available in the 1.3.x versions of multi_json. Rails 3.1.x is restricted to 
using MultiJson versions < 1.3. The old name was MultiJson.decode for the same 
method.

Original comment by Jwkpia...@gmail.com on 14 Aug 2012 at 5:11

GoogleCodeExporter commented 9 years ago
OK. It looks like it's ActiveSupport that declares the dependency. However, the 
dependency declared is "multi_json ~> 1.0". Because that requirement omits the 
trailing tiny version number, it should load either 1.0.x or 1.3.x. Whether 
Rails actually *supports* 1.3.x is an either different story.

My feeling is that our client should support both, simple because darn near 
everybody has the multi_json dependency and nobody agrees on which version to 
use. That's a recipe for dependency conflicts. I'm inclined to monkey-patch an 
alias in until people update their dependencies to the latest version. We can 
take it out once most people have upgraded.

Original comment by bobaman@google.com on 14 Aug 2012 at 8:13

GoogleCodeExporter commented 9 years ago
Yes, that's what I did in my code.
Rails 3-2-stable and master branches have that ~> 1.0 requirement only. Rails 
3-1-stable branch has a < 1.3 as well. The commit that added that requirement 
was reverted in the 3-2-stable branch, but not in the 3-1-stable branch.

Original comment by Jwkpia...@gmail.com on 14 Aug 2012 at 9:34

GoogleCodeExporter commented 9 years ago
Install Signet 0.4.2—the backwards compatibility code it loads should cover 
the rest of the client.

Original comment by bobaman@google.com on 30 Aug 2012 at 9:12