Comments (15)
Silly question but you obviously used your real API key right? I'll try to test w/ Rails 3.1 later tonight
from gibbon.
Not a silly question at all :) Yes, I used my real API key. I tried with another API key (for a separate account) as well.
from gibbon.
Incidentally, I think I met your iOS dev in the WWDC keynote line. Really nice guy.
from gibbon.
Hah! Bryan Montz? If so, yeah, awesome guy. Small world :)
from gibbon.
I think so, yea. Very small world. :D
from gibbon.
Heisenbug. It's working for me w/ Ruby 1.9.2 and Rails 3.1RC4. Do you have any other environment info that might be helpful? :\
from gibbon.
Here's my bundle list:
Gems included by the bundle:
* ZenTest (4.5.0)
* actionmailer (3.1.0.rc4)
* actionpack (3.1.0.rc4)
* activemodel (3.1.0.rc4)
* activerecord (3.1.0.rc4)
* activeresource (3.1.0.rc4)
* activesupport (3.1.0.rc4)
* archive-tar-minitar (0.5.2)
* arel (2.1.1)
* autotest (4.4.6)
* bcrypt-ruby (2.1.4)
* builder (3.0.0)
* bundler (1.0.15)
* cancan (1.6.4)
* chunky_png (1.2.0)
* coffee-script (2.2.0)
* coffee-script-source (1.1.1)
* columnize (0.3.2)
* compass (0.11.1.24ed97d 24ed97d)
* configuration (1.2.0)
* crack (0.1.8)
* devise (1.4.0.dev 30f9da9)
* diff-lcs (1.1.2)
* erubis (2.7.0)
* execjs (1.1.2)
* f1api (0.10.0)
* factory_girl (1.3.3)
* factory_girl_rails (1.0.1)
* fastercsv (1.5.4)
* fssm (0.2.7)
* geocoder (1.0.1)
* haml (3.1.2)
* haml-rails (0.3.4)
* heroku (2.2.8)
* heroku_san (1.2.0)
* hike (1.0.0)
* hominid (3.0.2)
* hpricot (0.8.4)
* httparty (0.7.8)
* i18n (0.6.0)
* jquery-rails (1.0.9)
* kaminari (0.12.4)
* launchy (0.4.0)
* linecache19 (0.5.12)
* mail (2.3.0)
* mime-types (1.16)
* multi_json (1.0.3)
* nokogiri (1.4.6)
* oauth (0.4.4)
* orm_adapter (0.0.5)
* pg (0.11.0)
* polyglot (0.3.1)
* rack (1.3.0)
* rack-cache (1.0.2)
* rack-mount (0.8.1)
* rack-ssl (1.3.2)
* rack-test (0.6.0)
* rails (3.1.0.rc4)
* rails3-generators (0.17.4)
* rails_admin (0.0.1 727daa2)
* railties (3.1.0.rc4)
* rake (0.8.7)
* rdoc (3.6.1)
* rest-client (1.6.3)
* rspec (2.6.0)
* rspec-core (2.6.4)
* rspec-expectations (2.6.0)
* rspec-mocks (2.6.0)
* rspec-rails (2.6.1)
* ruby-debug-base19 (0.11.25)
* ruby-debug19 (0.11.6)
* ruby_core_source (0.1.5)
* ruby_parser (2.0.6)
* sass (3.1.3)
* sass-rails (3.1.0.rc.2 4771b3f)
* sexp_processor (3.0.5)
* silent-postgres (0.0.8)
* sprockets (2.0.0.beta.10)
* term-ansicolor (1.0.5)
* thor (0.14.6)
* tilt (1.3.2)
* treetop (1.4.9)
* tzinfo (0.3.27)
* uglifier (0.5.4)
* warden (1.0.4)
What else would be useful?
from gibbon.
OS perhaps?
from gibbon.
Mac OS 10.6.6
from gibbon.
Still looking into this. :boggle:
from gibbon.
No worries -- you're not holding me up or anything. I'll see if I can spend some time with it this weekend and give you any more info.
from gibbon.
I tried dropping httparty down to ~>0.6.0 (0.6.1) ... same error.
So I started tracing the call. Here we go
URL requested at gibbon.rb:32
https://us1.api.mailchimp.com/1.3/?method=lists
httparty at line 248
path = https://us1.api.mailchimp.com/1.3/?method=lists
options = {:body=>"%7B%22apikey%22%3A%MY_API_KEY%22%7D", :timeout=>nil}
httparty at line 180
body = {
"total": 2,
"data": [
{
"id": "A_Valid_Id",
"web_id": 12345,
"name": "My List Name",
"date_created": "2011-01-20 21:15:05",
"email_type_option": false,
"use_awesomebar": false,
"default_from_name": "Valid Name",
"default_from_email": "valid email",
"default_subject": "",
"default_language": "en",
"list_rating": 0,
"stats": {
"member_count": 0,
"unsubscribe_count": 0,
"cleaned_count": 0,
"member_count_since_send": 0,
"unsubscribe_count_since_send": 0,
"cleaned_count_since_send": 0,
"campaign_count": 1,
"grouping_count": 0,
"group_count": 0,
"merge_var_count": 2,
"avg_sub_rate": 0,
"avg_unsub_rate": 0,
"target_sub_rate": 0,
"open_rate": 0,
"click_rate": 0
},
"modules": []
},
{
"id": "A_Valid_Id2",
"web_id": 67890,
"name": "My Other List Name",
"date_created": "2011-01-20 20:55:58",
"email_type_option": false,
"use_awesomebar": false,
"default_from_name": "Valid Name",
"default_from_email": "valid email",
"default_subject": "Valid Subject",
"default_language": "en",
"list_rating": 0,
"stats": {
"member_count": 0,
"unsubscribe_count": 2,
"cleaned_count": 0,
"member_count_since_send": 4,
"unsubscribe_count_since_send": 4,
"cleaned_count_since_send": 0,
"campaign_count": 0,
"grouping_count": 0,
"group_count": 0,
"merge_var_count": 2,
"avg_sub_rate": 0,
"avg_unsub_rate": 1,
"target_sub_rate": 1,
"open_rate": 0,
"click_rate": 0
},
"modules": []
}
]
}
** The above is valid JSON, so that's not it **
crack at line 12
json = (same as above)
YAML.load = (this is where the error starts)
Running Crack::JSON.parse(body)
on the above JSON throws the rest of the error I originally posted. Check this out, too:
> JSON body
JSON::ParserError: 384: unexpected token at '{"id":"A_Valid_Id","web_id":A_Valid_Id,"name":"My List Name","date_created":"2011-01-20 21:15:05","email_type_option":false,"use_awesomebar":false,"default_from_name":"Valid Name","default_from_email":"valid email","default_subject":"","default_language":"en","list_rating":0,"stats":{"member_count":0,"unsubscribe_count":0,"cleaned_count":0,"member_count_since_send":0,"unsubscribe_count_since_send":0,"cleaned_count_since_send":0,"campaign_count":1,"grouping_count":0,"group_count":0,"merge_var_count":2,"avg_sub_rate":0,"avg_unsub_rate":0,"target_sub_rate":0,"open_rate":0,"click_rate":0},"modules":[]},{"id":"A_Valid_Id2","web_id":A_Valid_Id2,"name":"My Other List Name","date_created":"2011-01-20 20:55:58","email_type_option":false,"use_awesomebar":false,"default_from_name":"Valid Name","default_from_email":"valid email","default_subject":"Valid Subject","default_language":"en","list_rating":0,"stats":{"member_count":0,"unsubscribe_count":2,"cleaned_count":0,"member_count_since_send":4,"unsubscribe_count_since_send":4,"cleaned_count_since_send":0,"campaign_count":0,"grouping_count":0,"group_count":0,"merge_var_count":2,"avg_sub_rate":0,"avg_unsub_rate":1,"target_sub_rate":1,"open_rate":0,"click_rate":0},"modules":[]}]}'
That led me to this: flori/json#16 ... dunno if it applies.
That's about all I can do tonight. Let me know if this lights any bulbs for you.
from gibbon.
Thanks. That helps. I found this jnunemaker/crack#26. When you get a chance, please try changing:
module Gibbon
class API
include HTTParty
default_timeout 30
to:
module Gibbon
class API
include HTTParty
format :plain
default_timeout 30
and let me know whether or not it works. If it does, I'll push a build with that change.
from gibbon.
Works. Returns a hash. I submitted a pull request with a few other minor changes (tests all passing with one minor tweak to the test)
from gibbon.
Cool. It should return a hash in most cases w/ the MailChimp API. Sometimes (like listSubscribe success case) return a json fragment ("true"), which ActiveSupport::JSON.decode will return as a boolean. Watch out for that sort of thing. It's rare but can be a pain if you're not aware of it. Hopefully this'll change in a future version of the API.
I merged your pull request, tweaked the gemfile and released version 0.1.7 with the format :plain fix. It basically just avoids crack's json parsing all together (didn't want it to happen anyway...).
Thanks for the detailed info.
from gibbon.
Related Issues (20)
- pass the content in campaign
- Cannot set faraday_adapter globally HOT 3
- Uninitialized constant Faraday::Error::ClientError HOT 3
- Changelog updates for 3.3.2 HOT 2
- NameError: uninitialized constant Faraday::Error::ClientError HOT 3
- Rescued errors come back with all nil values? HOT 8
- Got error saying api_key not found HOT 1
- gibbon report issue
- How to send campaign emails to some specific users? HOT 1
- How to delete a member from a list? HOT 5
- How to add member in the segment of a list ?
- Faraday 1.x.x compability HOT 2
- Deprecated warning on Faraday::Connection#basic_auth HOT 4
- 3.4.1 Causes 401: API Key Invalid HOT 7
- updating members in batching does not work HOT 1
- Gibbon doesn't work with Faraday 2.x HOT 4
- How to unsubscribe email that is bounced, pending, or archived? HOT 3
- v3.4.4 security patch for v3.4.0? HOT 1
- API Export 1.0 and API 2.0 will be retired on June 5, 2023 HOT 11
- Updating from 1.x: How to replace .lists.merge_var_add? HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from gibbon.