event_finda_ruby 0.0.1 → 0.1.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/lib/event_finda_ruby/artists.rb +25 -0
- data/lib/event_finda_ruby/base.rb +34 -0
- data/lib/event_finda_ruby/version.rb +1 -1
- data/lib/event_finda_ruby.rb +1 -0
- metadata +2 -1
    
        checksums.yaml
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            ---
         | 
| 2 2 | 
             
            SHA1:
         | 
| 3 | 
            -
              metadata.gz:  | 
| 4 | 
            -
              data.tar.gz:  | 
| 3 | 
            +
              metadata.gz: 4905f94265ace9a086bae9b502abcde556dc767c
         | 
| 4 | 
            +
              data.tar.gz: 51c129ecb751e93f93b429cadac0a345d78d9e95
         | 
| 5 5 | 
             
            SHA512:
         | 
| 6 | 
            -
              metadata.gz:  | 
| 7 | 
            -
              data.tar.gz:  | 
| 6 | 
            +
              metadata.gz: aea3853dbe80e6b9dbd73d6124e5414c78f382c344e4324b98e1615873eaaa9793b83ea34ffd1e08e2cdf81f08a95fbdadc702f5815b44b288ccd72e76bd82c9
         | 
| 7 | 
            +
              data.tar.gz: 2d1e945eace3f7cf607e895d5758c3489fe6e82cc0acd8152a3da43e0882d0cac0568cb48c0ca03e5ab820c40cc271b3bfe586b0958361e001eae0e19bdad32b
         | 
| @@ -0,0 +1,25 @@ | |
| 1 | 
            +
            module EventFindaRuby
         | 
| 2 | 
            +
              class Artists < Base
         | 
| 3 | 
            +
             | 
| 4 | 
            +
                BASE_URL = "http://api.eventfinda.co.nz/v2/artists".freeze
         | 
| 5 | 
            +
             | 
| 6 | 
            +
                def by_category(category)
         | 
| 7 | 
            +
                  apply_filter "category", category
         | 
| 8 | 
            +
             | 
| 9 | 
            +
                  self
         | 
| 10 | 
            +
                end
         | 
| 11 | 
            +
             | 
| 12 | 
            +
                def by_category_slug(slug)
         | 
| 13 | 
            +
                  apply_filter "category_slug", slug
         | 
| 14 | 
            +
             | 
| 15 | 
            +
                  self
         | 
| 16 | 
            +
                end
         | 
| 17 | 
            +
             | 
| 18 | 
            +
                def results
         | 
| 19 | 
            +
                  response = HTTParty.get("#{url}", basic_auth: auth)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                  @results = response["artists"]
         | 
| 22 | 
            +
                end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              end
         | 
| 25 | 
            +
            end
         | 
| @@ -15,6 +15,32 @@ class Base | |
| 15 15 | 
             
                @url           = base_path
         | 
| 16 16 | 
             
              end
         | 
| 17 17 |  | 
| 18 | 
            +
              def by_keywords_and(keywords)
         | 
| 19 | 
            +
                apply_filter "q", set_keywords_and(keywords)
         | 
| 20 | 
            +
             | 
| 21 | 
            +
                self
         | 
| 22 | 
            +
              end
         | 
| 23 | 
            +
             | 
| 24 | 
            +
              def by_keywords_or(keywords)
         | 
| 25 | 
            +
                apply_filter "q", set_keywords_or(keywords)
         | 
| 26 | 
            +
             | 
| 27 | 
            +
                self
         | 
| 28 | 
            +
              end
         | 
| 29 | 
            +
             | 
| 30 | 
            +
              # allowing AND/OR behavior customized by developer
         | 
| 31 | 
            +
              # /events.xml?q=(cycling+AND+running+AND+swimming)+OR+triathlon
         | 
| 32 | 
            +
              def by_query(query)
         | 
| 33 | 
            +
                apply_filter "q", query
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                self
         | 
| 36 | 
            +
              end
         | 
| 37 | 
            +
             | 
| 38 | 
            +
              def by_rows(rows)
         | 
| 39 | 
            +
                apply_filter "rows", rows
         | 
| 40 | 
            +
             | 
| 41 | 
            +
                self
         | 
| 42 | 
            +
              end
         | 
| 43 | 
            +
             | 
| 18 44 | 
             
              def with_extension(extension)
         | 
| 19 45 | 
             
                if ["json", "xml"].include? extension
         | 
| 20 46 | 
             
                  @api_extension = extension
         | 
| @@ -31,4 +57,12 @@ class Base | |
| 31 57 | 
             
              def apply_filter(filter_name, value)
         | 
| 32 58 | 
             
                @url = "#{url}&#{filter_name}=#{value}"
         | 
| 33 59 | 
             
              end
         | 
| 60 | 
            +
             | 
| 61 | 
            +
              def set_keywords_or(keywords)
         | 
| 62 | 
            +
                keywords.join("+OR+")
         | 
| 63 | 
            +
              end
         | 
| 64 | 
            +
             | 
| 65 | 
            +
              def set_keywords_and(keywords)
         | 
| 66 | 
            +
                keywords.join("+AND+")
         | 
| 67 | 
            +
              end
         | 
| 34 68 | 
             
            end
         | 
    
        data/lib/event_finda_ruby.rb
    CHANGED
    
    
    
        metadata
    CHANGED
    
    | @@ -1,7 +1,7 @@ | |
| 1 1 | 
             
            --- !ruby/object:Gem::Specification
         | 
| 2 2 | 
             
            name: event_finda_ruby
         | 
| 3 3 | 
             
            version: !ruby/object:Gem::Version
         | 
| 4 | 
            -
              version: 0. | 
| 4 | 
            +
              version: 0.1.2
         | 
| 5 5 | 
             
            platform: ruby
         | 
| 6 6 | 
             
            authors:
         | 
| 7 7 | 
             
            - Juan Roldan
         | 
| @@ -31,6 +31,7 @@ extensions: [] | |
| 31 31 | 
             
            extra_rdoc_files: []
         | 
| 32 32 | 
             
            files:
         | 
| 33 33 | 
             
            - lib/event_finda_ruby.rb
         | 
| 34 | 
            +
            - lib/event_finda_ruby/artists.rb
         | 
| 34 35 | 
             
            - lib/event_finda_ruby/base.rb
         | 
| 35 36 | 
             
            - lib/event_finda_ruby/events.rb
         | 
| 36 37 | 
             
            - lib/event_finda_ruby/version.rb
         |