ultron 0.0.1 → 0.0.2
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.
- checksums.yaml +4 -4
 - data/.gitignore +3 -1
 - data/.rspec +1 -1
 - data/.travis.yml +7 -0
 - data/{LICENSE.txt → LICENSE.md} +2 -2
 - data/README.md +19 -21
 - data/Rakefile +1 -1
 - data/config/params.yaml +0 -0
 - data/config/ultron.yaml +2 -0
 - data/examples/links.rb +0 -0
 - data/lib/ultron.rb +29 -4
 - data/lib/ultron/api/character.rb +19 -0
 - data/lib/ultron/api/characters.rb +14 -0
 - data/lib/ultron/api/comic.rb +15 -0
 - data/lib/ultron/api/comics.rb +14 -0
 - data/lib/ultron/api/creator.rb +19 -0
 - data/lib/ultron/api/creators.rb +14 -0
 - data/lib/ultron/api/entities.rb +45 -0
 - data/lib/ultron/api/entity.rb +51 -0
 - data/lib/ultron/api/event.rb +15 -0
 - data/lib/ultron/api/events.rb +14 -0
 - data/lib/ultron/api/series.rb +23 -0
 - data/lib/ultron/api/serieses.rb +16 -0
 - data/lib/ultron/api/stories.rb +14 -0
 - data/lib/ultron/api/story.rb +15 -0
 - data/lib/ultron/config.rb +35 -0
 - data/lib/ultron/connection.rb +41 -0
 - data/lib/ultron/helpers.rb +25 -0
 - data/lib/ultron/version.rb +1 -1
 - data/spec/cassettes/Ultron_API_Character/should_have_a_series_set.yml +88 -0
 - data/spec/cassettes/Ultron_API_Character/should_have_an_events_set.yml +32 -0
 - data/spec/cassettes/Ultron_API_Character/should_have_the_correct_name.yml +88 -0
 - data/spec/cassettes/Ultron_API_Character/should_have_the_correct_sets/events.yml +32 -0
 - data/spec/cassettes/Ultron_API_Character/should_not_have_any_events.yml +32 -0
 - data/spec/cassettes/Ultron_API_CharacterSet/should_have_the_correct_first_character.yml +1616 -0
 - data/spec/cassettes/Ultron_API_Characters/characters_filtered_by_comic/should_have_the_correct_first_character.yml +1616 -0
 - data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_comic.yml +1862 -0
 - data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_event.yml +3876 -0
 - data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_series.yml +743 -0
 - data/spec/cassettes/Ultron_API_Characters/generate_filtered_lists_of_characters/by_story.yml +345 -0
 - data/spec/cassettes/Ultron_API_Characters/get_a_character_by_name/should_have_the_correct_id.yml +114 -0
 - data/spec/cassettes/Ultron_API_Characters/get_a_character_by_name/should_have_the_correct_name.yml +114 -0
 - data/spec/cassettes/Ultron_API_Characters/get_a_character_with_a_space_in_their_name/should_have_the_correct_id.yml +99 -0
 - data/spec/cassettes/Ultron_API_Characters/get_a_character_with_a_space_in_their_name/should_have_the_correct_name.yml +99 -0
 - data/spec/cassettes/Ultron_API_Characters/get_the_first_character_off_the_list/should_have_the_correct_id.yml +644 -0
 - data/spec/cassettes/Ultron_API_Characters/get_the_first_character_off_the_list/should_have_the_correct_name.yml +644 -0
 - data/spec/cassettes/Ultron_API_Characters/get_the_first_character_off_the_list/should_have_the_correct_resourceURI.yml +644 -0
 - data/spec/cassettes/Ultron_API_Characters/parameterize_the_request/should_let_us_set_multiple_parameters.yml +1595 -0
 - data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_comic.yml +2737 -0
 - data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_event.yml +7345 -0
 - data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_series.yml +743 -0
 - data/spec/cassettes/Ultron_API_Characters/should_generate_a_list_of_characters_filtered_by_story.yml +231 -0
 - data/spec/cassettes/Ultron_API_Characters/should_have_genarate_a_list_of_characters_filtered_by_comic.yml +1616 -0
 - data/spec/cassettes/Ultron_API_Characters/should_have_the_correct_first_character.yml +1616 -0
 - data/spec/cassettes/Ultron_API_Characters/should_not_generate_a_list_of_characters_filtered_by_creator.yml +31 -0
 - data/spec/cassettes/Ultron_API_Characters/should_not_generate_lists_of_characters/filtered_by_creator.yml +31 -0
 - data/spec/cassettes/Ultron_API_Comic/should_have_a_list_of_characters.yml +46 -0
 - data/spec/cassettes/Ultron_API_Comic/should_have_openstruct_method-style_attribute_accessors.yml +46 -0
 - data/spec/cassettes/Ultron_API_Comic/should_have_the_correct_title.yml +46 -0
 - data/spec/cassettes/Ultron_API_Comic/should_have_the_correct_year.yml +46 -0
 - data/spec/cassettes/Ultron_API_ComicSet/should_have_the_correct_first_comic.yml +2013 -0
 - data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_character.yml +2059 -0
 - data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_creator.yml +2177 -0
 - data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_event.yml +1701 -0
 - data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_series.yml +123 -0
 - data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_stories.yml +499 -0
 - data/spec/cassettes/Ultron_API_Comics/generate_filtered_lists_of_comics/by_story.yml +577 -0
 - data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_id.yml +1039 -0
 - data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_name.yml +946 -0
 - data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_resourceURI.yml +1039 -0
 - data/spec/cassettes/Ultron_API_Comics/get_the_first_comic_off_the_list/should_have_the_correct_title.yml +1039 -0
 - data/spec/cassettes/Ultron_API_Comics/parameterize_the_request/should_let_us_set_a_dateRange.yml +1613 -0
 - data/spec/cassettes/Ultron_API_Comics/parameterize_the_request/should_let_us_set_a_limit.yml +96 -0
 - data/spec/cassettes/Ultron_API_Comics/should_generate_a_list_of_comics_filtered_by_character.yml +3955 -0
 - data/spec/cassettes/Ultron_API_Comics/should_have_the_correct_first_comic.yml +2012 -0
 - data/spec/cassettes/Ultron_API_ComicsSet/should_have_the_correct_first_comic.yml +2013 -0
 - data/spec/cassettes/Ultron_API_Creator/it_should_have_the_correct_sets/comics.yml +2029 -0
 - data/spec/cassettes/Ultron_API_Creator/should_have_a_comics_set.yml +2022 -0
 - data/spec/cassettes/Ultron_API_Creator/should_have_the_correct_comic.yml +2029 -0
 - data/spec/cassettes/Ultron_API_Creator/should_have_the_correct_name.yml +243 -0
 - data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_comic.yml +1205 -0
 - data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_event.yml +2778 -0
 - data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_series.yml +4555 -0
 - data/spec/cassettes/Ultron_API_Creators/generate_filtered_lists_of_creators/by_story.yml +1253 -0
 - data/spec/cassettes/Ultron_API_Creators/get_a_creator_by_name/should_return_the_correct_creator.yml +30 -0
 - data/spec/cassettes/Ultron_API_Creators/get_the_fourth_creator_off_the_list/should_have_the_right_name.yml +1205 -0
 - data/spec/cassettes/Ultron_API_Creators/get_the_second_creator_off_the_list/should_have_the_right_name.yml +384 -0
 - data/spec/cassettes/Ultron_API_Creators/should_have_the_correct_first_comic.yml +32 -0
 - data/spec/cassettes/Ultron_API_Creators/should_not_generate_a_list_of_creators_filtered_by_character.yml +31 -0
 - data/spec/cassettes/Ultron_API_Creators/should_not_generate_lists_of_creators/filtered_by_character.yml +31 -0
 - data/spec/cassettes/Ultron_API_Event/should_have_a_list_of_characters.yml +195 -0
 - data/spec/cassettes/Ultron_API_Event/should_have_the_correct_first_character.yml +195 -0
 - data/spec/cassettes/Ultron_API_Event/should_have_the_correct_title.yml +108 -0
 - data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_character.yml +5161 -0
 - data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_comic.yml +363 -0
 - data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_creator.yml +9257 -0
 - data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_series.yml +240 -0
 - data/spec/cassettes/Ultron_API_Events/generate_filtered_lists_of_events/by_story.yml +375 -0
 - data/spec/cassettes/Ultron_API_Events/get_the_second_event_off_the_list/should_have_the_right_name.yml +4762 -0
 - data/spec/cassettes/Ultron_API_Series/should_have_the_correct_sets/not_series.yml +40 -0
 - data/spec/cassettes/Ultron_API_Series/should_have_the_correct_title.yml +40 -0
 - data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_character.yml +3618 -0
 - data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_comic.yml +31 -0
 - data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_creator.yml +1104 -0
 - data/spec/cassettes/Ultron_API_Serieses/generate_filtered_lists_of_serieses/by_event.yml +591 -0
 - data/spec/cassettes/Ultron_API_Serieses/get_the_third_event_off_the_list/should_have_the_right_name.yml +1780 -0
 - data/spec/cassettes/Ultron_API_Serieses/should_not_generate_lists_of_series/filtered_by_comic.yml +31 -0
 - data/spec/cassettes/Ultron_API_Serieses/should_not_generate_lists_of_series/filtered_by_story.yml +31 -0
 - data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_character.yml +342 -0
 - data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_comic.yml +110 -0
 - data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_creator.yml +1041 -0
 - data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_event.yml +846 -0
 - data/spec/cassettes/Ultron_API_Stories/generate_filtered_lists_of_stories/by_series.yml +143 -0
 - data/spec/cassettes/Ultron_API_Stories/get_the_fourth_story_off_the_list/should_have_the_right_name.yml +686 -0
 - data/spec/cassettes/Ultron_API_Stories/get_the_second_story_off_the_list/should_have_the_right_name.yml +686 -0
 - data/spec/cassettes/Ultron_API_Story/should_have_the_correct_title.yml +40 -0
 - data/spec/cassettes/Ultron_Connection/should_get_a_200.yml +559 -0
 - data/spec/spec_helper.rb +3 -0
 - data/spec/support/vcr_setup.rb +17 -0
 - data/spec/ultron/api/character_spec.rb +50 -0
 - data/spec/ultron/api/comic_spec.rb +55 -0
 - data/spec/ultron/api/creator_spec.rb +50 -0
 - data/spec/ultron/api/event_spec.rb +50 -0
 - data/spec/ultron/api/filtered_sets/characters_filtered_spec.rb +53 -0
 - data/spec/ultron/api/filtered_sets/comics_filtered_spec.rb +51 -0
 - data/spec/ultron/api/filtered_sets/creators_filtered_spec.rb +51 -0
 - data/spec/ultron/api/filtered_sets/events_filtered_spec.rb +51 -0
 - data/spec/ultron/api/filtered_sets/series_filtered_spec.rb +50 -0
 - data/spec/ultron/api/filtered_sets/stories_filtered_spec.rb +52 -0
 - data/spec/ultron/api/series_spec.rb +46 -0
 - data/spec/ultron/api/sets/characters_spec.rb +71 -0
 - data/spec/ultron/api/sets/comics_spec.rb +46 -0
 - data/spec/ultron/api/sets/creators_spec.rb +29 -0
 - data/spec/ultron/api/sets/events_spec.rb +26 -0
 - data/spec/ultron/api/sets/serieses_spec.rb +26 -0
 - data/spec/ultron/api/sets/stories_spec.rb +26 -0
 - data/spec/ultron/api/story_spec.rb +46 -0
 - data/spec/ultron/auth_spec.rb +13 -0
 - data/spec/ultron/config_spec.rb +16 -0
 - data/spec/ultron/connection_spec.rb +33 -0
 - data/spec/ultron/helpers_spec.rb +11 -0
 - data/ultron.gemspec +16 -11
 - metadata +346 -50
 - data/lib/ultron/characters.rb +0 -9
 - data/spec/ultron/characters_spec.rb +0 -12
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA1:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: c3aaf7379f93c11b5004a4b61a2634d3e5b47cc9
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 010fdad665f622d6c3a1ffd268f09a7614565edc
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 4ad4469d1b48e912d996984e639b5973c386dd4e43da57bfed47281df991401d22e850977c5d74a9bfb0a4d6c11e91221313177237ef0da532619c3d49f27631
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: 9911fbe134c142d4ac887b6f2df5dd86f2eaeb1b5877f06113a017ef9aad428540f85323b6ee7e422e9e6212f9d5c953a3b6efc71c0cadb202a5e40e3f6f27a0
         
     | 
    
        data/.gitignore
    CHANGED
    
    
    
        data/.rspec
    CHANGED
    
    | 
         @@ -1,2 +1,2 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --color
         
     | 
| 
       2 
     | 
    
         
            -
            -- 
     | 
| 
      
 2 
     | 
    
         
            +
            --format documentation
         
     | 
    
        data/.travis.yml
    ADDED
    
    | 
         @@ -0,0 +1,7 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            language: ruby
         
     | 
| 
      
 2 
     | 
    
         
            +
            rvm:
         
     | 
| 
      
 3 
     | 
    
         
            +
            - 2.1.0
         
     | 
| 
      
 4 
     | 
    
         
            +
            env:
         
     | 
| 
      
 5 
     | 
    
         
            +
              global:
         
     | 
| 
      
 6 
     | 
    
         
            +
              - secure: I6w+eRCXNkVnye8y/NVU9FAiSGgSC6RKtClXUdM1ZbYZHYf/PtruM0eHQAA+2fMR3Vg3Ekg88D2ePWUwLG1HfJO694YMyYIMnaIsK1ESvnhavPSmpWxnXlQhrQcAsDi4QDLM1qpUtnwAOAmo+WNXpU5Jdaoa6024IGKm5VMwWtE=
         
     | 
| 
      
 7 
     | 
    
         
            +
              - secure: V3Ebf8/4PMSD8vv/kto8OoUlKWk7RlvPmhySbDGkyO6XgPmCYhUMblvwP9gYBjZzowiZcU4bD5D0HUMBimz5XSojK4FpMKPtxtjt20wf3FS43LTxLbvpST6XWDcKfqcEPLIRn/9Z/o5I019O4LbkI7PmHNJyP2MXyNYfZuGvrvw=
         
     | 
    
        data/{LICENSE.txt → LICENSE.md}
    RENAMED
    
    
    
        data/README.md
    CHANGED
    
    | 
         @@ -1,29 +1,27 @@ 
     | 
|
| 
       1 
     | 
    
         
            -
             
     | 
| 
       2 
     | 
    
         
            -
             
     | 
| 
       3 
     | 
    
         
            -
             
     | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
             
     | 
| 
      
 1 
     | 
    
         
            +
            [](https://travis-ci.org/pikesley/ultron)
         
     | 
| 
      
 2 
     | 
    
         
            +
            [](https://gemnasium.com/pikesley/ultron)
         
     | 
| 
      
 3 
     | 
    
         
            +
            [](https://coveralls.io/r/pikesley/ultron)
         
     | 
| 
      
 4 
     | 
    
         
            +
            [](https://codeclimate.com/github/pikesley/ultron)
         
     | 
| 
      
 5 
     | 
    
         
            +
            [](https://rubygems.org/gems/ultron)
         
     | 
| 
      
 6 
     | 
    
         
            +
            [](http://pikesley.mit-license.org)
         
     | 
| 
      
 7 
     | 
    
         
            +
            [](https://github.com/pikesley/badger)
         
     | 
| 
       6 
8 
     | 
    
         | 
| 
       7 
     | 
    
         
            -
             
     | 
| 
       8 
     | 
    
         
            -
             
     | 
| 
       9 
     | 
    
         
            -
                gem 'ultron'
         
     | 
| 
       10 
     | 
    
         
            -
             
     | 
| 
       11 
     | 
    
         
            -
            And then execute:
         
     | 
| 
      
 9 
     | 
    
         
            +
            # Ultron
         
     | 
| 
       12 
10 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
             
     | 
| 
      
 11 
     | 
    
         
            +
            Wrapping some Ruby around the [Marvel Comics API](http://developer.marvel.com/)
         
     | 
| 
       14 
12 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
             
     | 
| 
      
 13 
     | 
    
         
            +
                git clone https://github.com/pikesley/ultron
         
     | 
| 
      
 14 
     | 
    
         
            +
                ultron
         
     | 
| 
      
 15 
     | 
    
         
            +
                bundle
         
     | 
| 
      
 16 
     | 
    
         
            +
                rake
         
     | 
| 
       16 
17 
     | 
    
         | 
| 
       17 
     | 
    
         
            -
             
     | 
| 
      
 18 
     | 
    
         
            +
            Look at the [specs](https://github.com/pikesley/ultron/blob/master/spec/ultron/) to see what it's actually doing - I'm knocking things off one-at-a-time from [this list](http://developer.marvel.com/docs#!/public/).
         
     | 
| 
       18 
19 
     | 
    
         | 
| 
       19 
     | 
    
         
            -
             
     | 
| 
      
 20 
     | 
    
         
            +
            To actually use it you need an API key and secret which you can get from [here](https://developer.marvel.com/signup), put them into `.env` like this
         
     | 
| 
       20 
21 
     | 
    
         | 
| 
       21 
     | 
    
         
            -
             
     | 
| 
      
 22 
     | 
    
         
            +
                PUBLIC_KEY: this_r_public_key
         
     | 
| 
      
 23 
     | 
    
         
            +
                PRIVATE_KEY: this_one_r_private_key
         
     | 
| 
       22 
24 
     | 
    
         | 
| 
       23 
     | 
    
         
            -
            ##  
     | 
| 
      
 25 
     | 
    
         
            +
            ## Alpha alpha alpha
         
     | 
| 
       24 
26 
     | 
    
         | 
| 
       25 
     | 
    
         
            -
             
     | 
| 
       26 
     | 
    
         
            -
            2. Create your feature branch (`git checkout -b my-new-feature`)
         
     | 
| 
       27 
     | 
    
         
            -
            3. Commit your changes (`git commit -am 'Add some feature'`)
         
     | 
| 
       28 
     | 
    
         
            -
            4. Push to the branch (`git push origin my-new-feature`)
         
     | 
| 
       29 
     | 
    
         
            -
            5. Create new Pull Request
         
     | 
| 
      
 27 
     | 
    
         
            +
            I'm working this out as I go along, my API is liable to get bent out of all recognition before I'm done.
         
     | 
    
        data/Rakefile
    CHANGED
    
    
    
        data/config/params.yaml
    ADDED
    
    | 
         
            File without changes
         
     | 
    
        data/config/ultron.yaml
    ADDED
    
    
    
        data/examples/links.rb
    ADDED
    
    | 
         
            File without changes
         
     | 
    
        data/lib/ultron.rb
    CHANGED
    
    | 
         @@ -1,6 +1,31 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            require 'singleton'
         
     | 
| 
      
 2 
     | 
    
         
            +
            require 'curb'
         
     | 
| 
      
 3 
     | 
    
         
            +
            require 'dotenv'
         
     | 
| 
      
 4 
     | 
    
         
            +
             
     | 
| 
       1 
5 
     | 
    
         
             
            require 'ultron/version'
         
     | 
| 
       2 
     | 
    
         
            -
            require 'ultron/ 
     | 
| 
      
 6 
     | 
    
         
            +
            require 'ultron/helpers'
         
     | 
| 
      
 7 
     | 
    
         
            +
            require 'ultron/config'
         
     | 
| 
      
 8 
     | 
    
         
            +
            require 'ultron/connection'
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
            require 'ultron/api/entity'
         
     | 
| 
      
 11 
     | 
    
         
            +
            require 'ultron/api/entities'
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
            require 'ultron/api/character'
         
     | 
| 
      
 14 
     | 
    
         
            +
            require 'ultron/api/characters'
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
            require 'ultron/api/comic'
         
     | 
| 
      
 17 
     | 
    
         
            +
            require 'ultron/api/comics'
         
     | 
| 
      
 18 
     | 
    
         
            +
             
     | 
| 
      
 19 
     | 
    
         
            +
            require 'ultron/api/creator'
         
     | 
| 
      
 20 
     | 
    
         
            +
            require 'ultron/api/creators'
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
            require 'ultron/api/event'
         
     | 
| 
      
 23 
     | 
    
         
            +
            require 'ultron/api/events'
         
     | 
| 
      
 24 
     | 
    
         
            +
             
     | 
| 
      
 25 
     | 
    
         
            +
            require 'ultron/api/series'
         
     | 
| 
      
 26 
     | 
    
         
            +
            require 'ultron/api/serieses'
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
            require 'ultron/api/story'
         
     | 
| 
      
 29 
     | 
    
         
            +
            require 'ultron/api/stories'
         
     | 
| 
       3 
30 
     | 
    
         | 
| 
       4 
     | 
    
         
            -
             
     | 
| 
       5 
     | 
    
         
            -
              # Your code goes here...
         
     | 
| 
       6 
     | 
    
         
            -
            end
         
     | 
| 
      
 31 
     | 
    
         
            +
            require 'pry'
         
     | 
| 
         @@ -0,0 +1,45 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Ultron
         
     | 
| 
      
 2 
     | 
    
         
            +
              module API
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Entities
         
     | 
| 
      
 4 
     | 
    
         
            +
                  include Enumerable
         
     | 
| 
      
 5 
     | 
    
         
            +
             
     | 
| 
      
 6 
     | 
    
         
            +
                  def initialize type
         
     | 
| 
      
 7 
     | 
    
         
            +
                    @cnxn = Ultron::Connection.new type
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def each
         
     | 
| 
      
 11 
     | 
    
         
            +
                    results.each do |item|
         
     | 
| 
      
 12 
     | 
    
         
            +
                      yield item
         
     | 
| 
      
 13 
     | 
    
         
            +
                    end
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  def add_params params
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @cnxn.add_params params
         
     | 
| 
      
 18 
     | 
    
         
            +
                  end
         
     | 
| 
      
 19 
     | 
    
         
            +
             
     | 
| 
      
 20 
     | 
    
         
            +
                  def remove_param p
         
     | 
| 
      
 21 
     | 
    
         
            +
                    @cnxn.remove_param p
         
     | 
| 
      
 22 
     | 
    
         
            +
                  end
         
     | 
| 
      
 23 
     | 
    
         
            +
             
     | 
| 
      
 24 
     | 
    
         
            +
                  def length
         
     | 
| 
      
 25 
     | 
    
         
            +
                    results.length
         
     | 
| 
      
 26 
     | 
    
         
            +
                  end
         
     | 
| 
      
 27 
     | 
    
         
            +
             
     | 
| 
      
 28 
     | 
    
         
            +
                  def results
         
     | 
| 
      
 29 
     | 
    
         
            +
                    @results || begin
         
     | 
| 
      
 30 
     | 
    
         
            +
                      @cnxn.perform['data']['results']
         
     | 
| 
      
 31 
     | 
    
         
            +
                    rescue NoMethodError
         
     | 
| 
      
 32 
     | 
    
         
            +
                      []
         
     | 
| 
      
 33 
     | 
    
         
            +
                    end
         
     | 
| 
      
 34 
     | 
    
         
            +
                  end
         
     | 
| 
      
 35 
     | 
    
         
            +
             
     | 
| 
      
 36 
     | 
    
         
            +
                  def method_missing method_name, *args
         
     | 
| 
      
 37 
     | 
    
         
            +
                    method_name = method_name.to_s
         
     | 
| 
      
 38 
     | 
    
         
            +
                    if param = method_name.match(/^by_(.*)/)[1]
         
     | 
| 
      
 39 
     | 
    
         
            +
                      @cnxn.add_params param => args.join(' ')
         
     | 
| 
      
 40 
     | 
    
         
            +
                      @cnxn.perform['data']['results'][0]
         
     | 
| 
      
 41 
     | 
    
         
            +
                    end
         
     | 
| 
      
 42 
     | 
    
         
            +
                  end
         
     | 
| 
      
 43 
     | 
    
         
            +
                end
         
     | 
| 
      
 44 
     | 
    
         
            +
              end
         
     | 
| 
      
 45 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,51 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Ultron
         
     | 
| 
      
 2 
     | 
    
         
            +
              module API
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Entity
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def initialize path
         
     | 
| 
      
 5 
     | 
    
         
            +
                    @cnxn = Ultron::Connection.new path
         
     | 
| 
      
 6 
     | 
    
         
            +
                  end
         
     | 
| 
      
 7 
     | 
    
         
            +
             
     | 
| 
      
 8 
     | 
    
         
            +
                  def [] key
         
     | 
| 
      
 9 
     | 
    
         
            +
                    results[key]
         
     | 
| 
      
 10 
     | 
    
         
            +
                  end
         
     | 
| 
      
 11 
     | 
    
         
            +
             
     | 
| 
      
 12 
     | 
    
         
            +
                  def method_missing method_name, *args
         
     | 
| 
      
 13 
     | 
    
         
            +
                    results.send(method_name)
         
     | 
| 
      
 14 
     | 
    
         
            +
                  end
         
     | 
| 
      
 15 
     | 
    
         
            +
             
     | 
| 
      
 16 
     | 
    
         
            +
                  def results
         
     | 
| 
      
 17 
     | 
    
         
            +
                    @results || begin
         
     | 
| 
      
 18 
     | 
    
         
            +
                      OpenStruct.new @cnxn.perform['data']['results'][0]
         
     | 
| 
      
 19 
     | 
    
         
            +
                    end
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
             
     | 
| 
      
 22 
     | 
    
         
            +
                  def comics
         
     | 
| 
      
 23 
     | 
    
         
            +
                    Comics.new '%s/comics' % @path
         
     | 
| 
      
 24 
     | 
    
         
            +
                  end
         
     | 
| 
      
 25 
     | 
    
         
            +
             
     | 
| 
      
 26 
     | 
    
         
            +
                  def characters
         
     | 
| 
      
 27 
     | 
    
         
            +
                    Characters.new '%s/characters' % @path
         
     | 
| 
      
 28 
     | 
    
         
            +
                  end
         
     | 
| 
      
 29 
     | 
    
         
            +
             
     | 
| 
      
 30 
     | 
    
         
            +
                  def creators
         
     | 
| 
      
 31 
     | 
    
         
            +
                    Creators.new '%s/creators' % @path
         
     | 
| 
      
 32 
     | 
    
         
            +
                  end
         
     | 
| 
      
 33 
     | 
    
         
            +
             
     | 
| 
      
 34 
     | 
    
         
            +
                  def events
         
     | 
| 
      
 35 
     | 
    
         
            +
                    Events.new '%s/events' % @path
         
     | 
| 
      
 36 
     | 
    
         
            +
                  end
         
     | 
| 
      
 37 
     | 
    
         
            +
             
     | 
| 
      
 38 
     | 
    
         
            +
                  def serieses
         
     | 
| 
      
 39 
     | 
    
         
            +
                    Serieses.new '%s/serieses' % @path
         
     | 
| 
      
 40 
     | 
    
         
            +
                  end
         
     | 
| 
      
 41 
     | 
    
         
            +
             
     | 
| 
      
 42 
     | 
    
         
            +
                  def stories
         
     | 
| 
      
 43 
     | 
    
         
            +
                    Stories.new '%s/stories' % @path
         
     | 
| 
      
 44 
     | 
    
         
            +
                  end
         
     | 
| 
      
 45 
     | 
    
         
            +
             
     | 
| 
      
 46 
     | 
    
         
            +
                  def has_events?
         
     | 
| 
      
 47 
     | 
    
         
            +
                    events.any?
         
     | 
| 
      
 48 
     | 
    
         
            +
                  end
         
     | 
| 
      
 49 
     | 
    
         
            +
                end
         
     | 
| 
      
 50 
     | 
    
         
            +
              end
         
     | 
| 
      
 51 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,23 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Ultron
         
     | 
| 
      
 2 
     | 
    
         
            +
              module API
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Series < Entity
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def initialize id
         
     | 
| 
      
 5 
     | 
    
         
            +
                    @id = id
         
     | 
| 
      
 6 
     | 
    
         
            +
                    @path = 'series/%s' % @id
         
     | 
| 
      
 7 
     | 
    
         
            +
                    super @path
         
     | 
| 
      
 8 
     | 
    
         
            +
                  end
         
     | 
| 
      
 9 
     | 
    
         
            +
             
     | 
| 
      
 10 
     | 
    
         
            +
                  def comics
         
     | 
| 
      
 11 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 12 
     | 
    
         
            +
                  end
         
     | 
| 
      
 13 
     | 
    
         
            +
             
     | 
| 
      
 14 
     | 
    
         
            +
                  def stories
         
     | 
| 
      
 15 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 16 
     | 
    
         
            +
                  end
         
     | 
| 
      
 17 
     | 
    
         
            +
             
     | 
| 
      
 18 
     | 
    
         
            +
                  def serieses
         
     | 
| 
      
 19 
     | 
    
         
            +
                    nil
         
     | 
| 
      
 20 
     | 
    
         
            +
                  end
         
     | 
| 
      
 21 
     | 
    
         
            +
                end
         
     | 
| 
      
 22 
     | 
    
         
            +
              end
         
     | 
| 
      
 23 
     | 
    
         
            +
            end
         
     | 
| 
         @@ -0,0 +1,16 @@ 
     | 
|
| 
      
 1 
     | 
    
         
            +
            module Ultron
         
     | 
| 
      
 2 
     | 
    
         
            +
              module API
         
     | 
| 
      
 3 
     | 
    
         
            +
                class Serieses < Entities
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def initialize path = nil
         
     | 
| 
      
 5 
     | 
    
         
            +
                    path = 'series' if path.nil?
         
     | 
| 
      
 6 
     | 
    
         
            +
                    super path
         
     | 
| 
      
 7 
     | 
    
         
            +
                  end
         
     | 
| 
      
 8 
     | 
    
         
            +
             
     | 
| 
      
 9 
     | 
    
         
            +
                  def [] key
         
     | 
| 
      
 10 
     | 
    
         
            +
                    Series.new results[key]['id']
         
     | 
| 
      
 11 
     | 
    
         
            +
                  end
         
     | 
| 
      
 12 
     | 
    
         
            +
             
     | 
| 
      
 13 
     | 
    
         
            +
                  # something something delete_method
         
     | 
| 
      
 14 
     | 
    
         
            +
                end
         
     | 
| 
      
 15 
     | 
    
         
            +
              end
         
     | 
| 
      
 16 
     | 
    
         
            +
            end
         
     |