{"id":16944995,"url":"https://github.com/mattetti/macruby-httpwrapper","last_synced_at":"2026-03-03T16:41:34.107Z","repository":{"id":535120,"uuid":"164394","full_name":"mattetti/macruby-httpwrapper","owner":"mattetti","description":"simplified http wrapper for MacRuby/RubyMotion using delegation/ruby block","archived":false,"fork":false,"pushed_at":"2012-01-26T04:34:17.000Z","size":219,"stargazers_count":29,"open_issues_count":0,"forks_count":2,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T19:52:00.370Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/mattetti.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2009-03-31T18:21:17.000Z","updated_at":"2022-08-06T03:53:09.000Z","dependencies_parsed_at":"2022-07-16T23:46:22.146Z","dependency_job_id":null,"html_url":"https://github.com/mattetti/macruby-httpwrapper","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/mattetti/macruby-httpwrapper","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2Fmacruby-httpwrapper","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2Fmacruby-httpwrapper/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2Fmacruby-httpwrapper/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2Fmacruby-httpwrapper/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/mattetti","download_url":"https://codeload.github.com/mattetti/macruby-httpwrapper/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/mattetti%2Fmacruby-httpwrapper/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30052132,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-03T15:26:47.567Z","status":"ssl_error","status_checked_at":"2026-03-03T15:26:17.132Z","response_time":61,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-13T21:19:34.039Z","updated_at":"2026-03-03T16:41:34.076Z","avatar_url":"https://github.com/mattetti.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# MacRuby HTTP Wrapper\n\nDownload helper making file download trivial.\n \nThe result of the download can be processed by a block or a delegator.\nA block will always take precedence over a delegator, meaning that you can't\npass a delegator and use a block, you have to choose which approach\nyou want to use.\nNOTE: in the case of a non blocking download, the delegation block can be called multiple times\ndue to a bug in Cocoa. (or maybe it's an undocumented feature ;)).\n\n## Parameters\n\nurl\u003cString\u003e:: url of the resource to download\n  \noptions\u003cHash\u003e:: options used for the query, see +MacRubyHTTP::Query.initialize+ for more details\n\n\u0026block\u003cblock\u003e:: block which is called when the file is downloaded\n\n## Options\n:method\u003cString, Symbol\u003e:: An optional value which represents the HTTP method to use\n\n:payload\u003cString\u003e::    - data to pass to a POST, PUT, DELETE query.\n\n:delegation\u003cObject\u003e:: - class or instance to call when the file is downloaded.\n                        the handle_query_response method will be called on the\n                        passed object\n\n:save_to\u003cString\u003e::    - path to save the response to\n\n:credential\u003cHash\u003e::   - should contains the :user key and :password key\n                        By default the credential will be saved for the entire session\n\n## TODO\n\n:progress \u003cProc\u003e::    Proc to call everytime the downloader makes some progress\n\n:cache_storage\n\n## Examples\n    download(\"http://www.macruby.org/files/MacRuby%200.4.zip\", {:save_to =\u003e '~/tmp/macruby.zip'.stringByStandardizingPath}) do |macruby|\n      NSLog(\"file downloaded!\")\n    end\n\n    download \"http://macruby.org\" do |mr|\n      # The response object has 3 accessors: status_code, headers and body\n      NSLog(\"status: #{mr.status_code}, Headers: #{mr.headers.inspect}\")\n    end\n \n    path = File.expand_path('~/macruby_tmp.html')\n    window :frame =\u003e [100, 100, 500, 500], :title =\u003e \"HotCocoa\" do |win|\n      download \"http://macruby.org\", {:save_to =\u003e path} do |homepage|\n        win \u003c\u003c label(:text =\u003e \"status code: #{homepage.status_code}\", :layout =\u003e {:start =\u003e false})\n        win \u003c\u003c label(:text =\u003e \"Headers: #{homepage.headers.inspect}\", :layout =\u003e {:start =\u003e false})\n      end\n    end\n\n    download \"http://macruby.org/users/matt\", :delegation =\u003e @downloaded_file, :method =\u003e 'PUT', :payload =\u003e {:name =\u003e 'matt aimonetti'}\n   \n    download \"http://macruby.org/roadmap.xml\", :delegation =\u003e self\n\n    download \"http://localhost:5984/couchrest-test/\", :method =\u003e 'POST', :payload =\u003e '{\"user\":\"mattaimonetti@mail.com\",\"zip\":92129}', :delegation =\u003e self\n\n    download(\"http://yoursite.com/login\", {:credential =\u003e {:user =\u003e 'me', :password =\u003e 's3krit'}}) do |test|\n      NSLog(\"response received: #{test.headers} #{test.status_code}\")\n    end\n \n    # We can also do the same thing but synchronously and block the runloop  \n    download \"http://macruby.org\", :immediate =\u003e true, :save_to =\u003e '~/tmp/site.html'.stringByStandardizingPath do |mr|\n      p \"file downloaded, let's continue\"\n    end\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattetti%2Fmacruby-httpwrapper","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmattetti%2Fmacruby-httpwrapper","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmattetti%2Fmacruby-httpwrapper/lists"}