jnunemaker-httparty 0.2.10 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/History +6 -0
- data/Manifest +9 -2
- data/README +2 -2
- data/Rakefile +0 -1
- data/bin/httparty +13 -29
- data/httparty.gemspec +4 -7
- data/lib/core_extensions.rb +42 -220
- data/lib/httparty.rb +76 -16
- data/lib/httparty/cookie_hash.rb +1 -1
- data/lib/httparty/exceptions.rb +3 -0
- data/lib/httparty/module_inheritable_attributes.rb +25 -0
- data/lib/httparty/parsers.rb +4 -0
- data/lib/httparty/parsers/json.rb +67 -0
- data/lib/httparty/parsers/xml.rb +209 -0
- data/lib/httparty/request.rb +19 -13
- data/lib/httparty/response.rb +3 -2
- data/lib/httparty/version.rb +2 -2
- data/spec/hash_spec.rb +44 -0
- data/spec/httparty/parsers/json_spec.rb +41 -0
- data/spec/httparty/parsers/xml_spec.rb +445 -0
- data/spec/string_spec.rb +27 -0
- metadata +14 -14
- data/lib/module_level_inheritable_attributes.rb +0 -25
- data/spec/as_buggery_spec.rb +0 -16
    
        data/spec/string_spec.rb
    ADDED
    
    | @@ -0,0 +1,27 @@ | |
| 1 | 
            +
            describe String, "#snake_case" do
         | 
| 2 | 
            +
              it "lowercases one word CamelCase" do
         | 
| 3 | 
            +
                "Merb".snake_case.should == "merb"
         | 
| 4 | 
            +
              end
         | 
| 5 | 
            +
             | 
| 6 | 
            +
              it "makes one underscore snake_case two word CamelCase" do
         | 
| 7 | 
            +
                "MerbCore".snake_case.should == "merb_core"
         | 
| 8 | 
            +
              end
         | 
| 9 | 
            +
             | 
| 10 | 
            +
              it "handles CamelCase with more than 2 words" do
         | 
| 11 | 
            +
                "SoYouWantContributeToMerbCore".snake_case.should == "so_you_want_contribute_to_merb_core"
         | 
| 12 | 
            +
              end
         | 
| 13 | 
            +
             | 
| 14 | 
            +
              it "handles CamelCase with more than 2 capital letter in a row" do
         | 
| 15 | 
            +
                "CNN".snake_case.should == "cnn"
         | 
| 16 | 
            +
                "CNNNews".snake_case.should == "cnn_news"
         | 
| 17 | 
            +
                "HeadlineCNNNews".snake_case.should == "headline_cnn_news"
         | 
| 18 | 
            +
              end
         | 
| 19 | 
            +
             | 
| 20 | 
            +
              it "does NOT change one word lowercase" do
         | 
| 21 | 
            +
                "merb".snake_case.should == "merb"
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              it "leaves snake_case as is" do
         | 
| 25 | 
            +
                "merb_core".snake_case.should == "merb_core"
         | 
| 26 | 
            +
              end
         | 
| 27 | 
            +
            end
         | 
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification 
         | 
| 2 2 | 
             
            name: jnunemaker-httparty
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version 
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.3.0
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors: 
         | 
| 7 7 | 
             
            - John Nunemaker
         | 
| @@ -9,18 +9,9 @@ autorequire: | |
| 9 9 | 
             
            bindir: bin
         | 
| 10 10 | 
             
            cert_chain: []
         | 
| 11 11 |  | 
| 12 | 
            -
            date: 2009-01- | 
| 12 | 
            +
            date: 2009-01-31 00:00:00 -08:00
         | 
| 13 13 | 
             
            default_executable: httparty
         | 
| 14 14 | 
             
            dependencies: 
         | 
| 15 | 
            -
            - !ruby/object:Gem::Dependency 
         | 
| 16 | 
            -
              name: json
         | 
| 17 | 
            -
              version_requirement: 
         | 
| 18 | 
            -
              version_requirements: !ruby/object:Gem::Requirement 
         | 
| 19 | 
            -
                requirements: 
         | 
| 20 | 
            -
                - - ~>
         | 
| 21 | 
            -
                  - !ruby/object:Gem::Version 
         | 
| 22 | 
            -
                    version: "1.1"
         | 
| 23 | 
            -
                version: 
         | 
| 24 15 | 
             
            - !ruby/object:Gem::Dependency 
         | 
| 25 16 | 
             
              name: echoe
         | 
| 26 17 | 
             
              version_requirement: 
         | 
| @@ -41,11 +32,14 @@ extra_rdoc_files: | |
| 41 32 | 
             
            - lib/core_extensions.rb
         | 
| 42 33 | 
             
            - lib/httparty/cookie_hash.rb
         | 
| 43 34 | 
             
            - lib/httparty/exceptions.rb
         | 
| 35 | 
            +
            - lib/httparty/module_inheritable_attributes.rb
         | 
| 36 | 
            +
            - lib/httparty/parsers/json.rb
         | 
| 37 | 
            +
            - lib/httparty/parsers/xml.rb
         | 
| 38 | 
            +
            - lib/httparty/parsers.rb
         | 
| 44 39 | 
             
            - lib/httparty/request.rb
         | 
| 45 40 | 
             
            - lib/httparty/response.rb
         | 
| 46 41 | 
             
            - lib/httparty/version.rb
         | 
| 47 42 | 
             
            - lib/httparty.rb
         | 
| 48 | 
            -
            - lib/module_level_inheritable_attributes.rb
         | 
| 49 43 | 
             
            - README
         | 
| 50 44 | 
             
            files: 
         | 
| 51 45 | 
             
            - bin/httparty
         | 
| @@ -72,17 +66,19 @@ files: | |
| 72 66 | 
             
            - lib/core_extensions.rb
         | 
| 73 67 | 
             
            - lib/httparty/cookie_hash.rb
         | 
| 74 68 | 
             
            - lib/httparty/exceptions.rb
         | 
| 69 | 
            +
            - lib/httparty/module_inheritable_attributes.rb
         | 
| 70 | 
            +
            - lib/httparty/parsers/json.rb
         | 
| 71 | 
            +
            - lib/httparty/parsers/xml.rb
         | 
| 72 | 
            +
            - lib/httparty/parsers.rb
         | 
| 75 73 | 
             
            - lib/httparty/request.rb
         | 
| 76 74 | 
             
            - lib/httparty/response.rb
         | 
| 77 75 | 
             
            - lib/httparty/version.rb
         | 
| 78 76 | 
             
            - lib/httparty.rb
         | 
| 79 | 
            -
            - lib/module_level_inheritable_attributes.rb
         | 
| 80 77 | 
             
            - Manifest
         | 
| 81 78 | 
             
            - MIT-LICENSE
         | 
| 82 79 | 
             
            - Rakefile
         | 
| 83 80 | 
             
            - README
         | 
| 84 81 | 
             
            - setup.rb
         | 
| 85 | 
            -
            - spec/as_buggery_spec.rb
         | 
| 86 82 | 
             
            - spec/core_extensions_spec.rb
         | 
| 87 83 | 
             
            - spec/fixtures/delicious.xml
         | 
| 88 84 | 
             
            - spec/fixtures/empty.xml
         | 
| @@ -90,11 +86,15 @@ files: | |
| 90 86 | 
             
            - spec/fixtures/twitter.json
         | 
| 91 87 | 
             
            - spec/fixtures/twitter.xml
         | 
| 92 88 | 
             
            - spec/fixtures/undefined_method_add_node_for_nil.xml
         | 
| 89 | 
            +
            - spec/hash_spec.rb
         | 
| 93 90 | 
             
            - spec/httparty/cookie_hash_spec.rb
         | 
| 91 | 
            +
            - spec/httparty/parsers/json_spec.rb
         | 
| 92 | 
            +
            - spec/httparty/parsers/xml_spec.rb
         | 
| 94 93 | 
             
            - spec/httparty/request_spec.rb
         | 
| 95 94 | 
             
            - spec/httparty_spec.rb
         | 
| 96 95 | 
             
            - spec/spec.opts
         | 
| 97 96 | 
             
            - spec/spec_helper.rb
         | 
| 97 | 
            +
            - spec/string_spec.rb
         | 
| 98 98 | 
             
            - website/css/common.css
         | 
| 99 99 | 
             
            - website/index.html
         | 
| 100 100 | 
             
            has_rdoc: true
         | 
| @@ -1,25 +0,0 @@ | |
| 1 | 
            -
            module ModuleLevelInheritableAttributes
         | 
| 2 | 
            -
              def self.included(base)
         | 
| 3 | 
            -
                base.extend(ClassMethods)
         | 
| 4 | 
            -
              end
         | 
| 5 | 
            -
              
         | 
| 6 | 
            -
              module ClassMethods
         | 
| 7 | 
            -
                def mattr_inheritable(*args)
         | 
| 8 | 
            -
                  @mattr_inheritable_attrs ||= [:mattr_inheritable_attrs]
         | 
| 9 | 
            -
                  @mattr_inheritable_attrs += args
         | 
| 10 | 
            -
                  args.each do |arg|
         | 
| 11 | 
            -
                    module_eval %(
         | 
| 12 | 
            -
                      class << self; attr_accessor :#{arg} end
         | 
| 13 | 
            -
                    )
         | 
| 14 | 
            -
                  end
         | 
| 15 | 
            -
                  @mattr_inheritable_attrs
         | 
| 16 | 
            -
                end
         | 
| 17 | 
            -
             | 
| 18 | 
            -
                def inherited(subclass)
         | 
| 19 | 
            -
                  @mattr_inheritable_attrs.each do |inheritable_attribute|
         | 
| 20 | 
            -
                    instance_var = "@#{inheritable_attribute}" 
         | 
| 21 | 
            -
                    subclass.instance_variable_set(instance_var, instance_variable_get(instance_var))
         | 
| 22 | 
            -
                  end
         | 
| 23 | 
            -
                end
         | 
| 24 | 
            -
              end
         | 
| 25 | 
            -
            end
         | 
    
        data/spec/as_buggery_spec.rb
    DELETED
    
    | @@ -1,16 +0,0 @@ | |
| 1 | 
            -
            require File.join(File.dirname(__FILE__), 'spec_helper')
         | 
| 2 | 
            -
             | 
| 3 | 
            -
            require 'activesupport'
         | 
| 4 | 
            -
             | 
| 5 | 
            -
            describe Hash do
         | 
| 6 | 
            -
              describe "#from_xml" do
         | 
| 7 | 
            -
                it "should be able to convert xml with datetimes" do
         | 
| 8 | 
            -
                  xml =<<EOL
         | 
| 9 | 
            -
            <?xml version="1.0" encoding="UTF-8"?>
         | 
| 10 | 
            -
            <created-at type="datetime">2008-12-01T20:00:00-05:00</created-at>
         | 
| 11 | 
            -
            EOL
         | 
| 12 | 
            -
                  hsh = Hash.from_xml(xml)
         | 
| 13 | 
            -
                  hsh["created_at"].should == Time.parse("December 01st, 2008 20:00:00")
         | 
| 14 | 
            -
                end
         | 
| 15 | 
            -
              end
         | 
| 16 | 
            -
            end
         |