alquran 0.0.4 → 1.0.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.
- checksums.yaml +4 -4
 - data/lib/alquran/ayah.rb +4 -4
 - data/lib/alquran/edition.rb +2 -2
 - data/lib/alquran/parah.rb +3 -3
 - data/lib/alquran/surah.rb +3 -3
 - data/lib/api/client.rb +2 -2
 - data/lib/api/url_parser.rb +7 -7
 - metadata +5 -6
 
    
        checksums.yaml
    CHANGED
    
    | 
         @@ -1,7 +1,7 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            ---
         
     | 
| 
       2 
2 
     | 
    
         
             
            SHA256:
         
     | 
| 
       3 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 21326630848efbfefbe686f0137cc16e0a4631e6a36e982724296d06b1f1a606
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: b48384e8f0c33630460db0f2a5e351caadcc6f7222f0ae9f754e2a6aff02c3e1
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: f4c8a3aabce4e7a031910b14e073f476fc46be1ae50eed29244ff8e4138442aab0cbd82b20877f81ca3fcea810763cf6faf2df1f37554726ef7e768b2823bb43
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: ec3487ffe6c77ae4eba56e4fdd0e53c39d7eb27a8796f7f9e38b4bbb2b0db79e5908632d53bc8b1a795ea6c3e47e1ab348e79069ea384c50085dd00107bf529d
         
     | 
    
        data/lib/alquran/ayah.rb
    CHANGED
    
    | 
         @@ -1,8 +1,8 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            module Alquran
         
     | 
| 
       2 
2 
     | 
    
         
             
              class Ayah < Base
         
     | 
| 
       3 
3 
     | 
    
         
             
                class << self
         
     | 
| 
       4 
     | 
    
         
            -
                  def fetch( 
     | 
| 
       5 
     | 
    
         
            -
                    Api::Client.fetch(filter_options(options))
         
     | 
| 
      
 4 
     | 
    
         
            +
                  def fetch(options)
         
     | 
| 
      
 5 
     | 
    
         
            +
                    Api::Client.fetch(filter_options(**options))
         
     | 
| 
       6 
6 
     | 
    
         
             
                  end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -11,8 +11,8 @@ module Alquran 
     | 
|
| 
       11 
11 
     | 
    
         
             
                      options.slice(:number).merge(self.entity_option).merge(action: :show).merge(extras: edition_option)
         
     | 
| 
       12 
12 
     | 
    
         
             
                    end
         
     | 
| 
       13 
13 
     | 
    
         | 
| 
       14 
     | 
    
         
            -
                    def filter_options( 
     | 
| 
       15 
     | 
    
         
            -
                      return show_options(options) unless options.has_key?(:sajdah)
         
     | 
| 
      
 14 
     | 
    
         
            +
                    def filter_options(options)
         
     | 
| 
      
 15 
     | 
    
         
            +
                      return show_options(**options) unless options.has_key?(:sajdah)
         
     | 
| 
       16 
16 
     | 
    
         | 
| 
       17 
17 
     | 
    
         
             
                      action_option = { action: :sajdah }
         
     | 
| 
       18 
18 
     | 
    
         | 
    
        data/lib/alquran/edition.rb
    CHANGED
    
    | 
         @@ -2,11 +2,11 @@ module Alquran 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class Edition < Base
         
     | 
| 
       3 
3 
     | 
    
         
             
                class << self
         
     | 
| 
       4 
4 
     | 
    
         
             
                  def fetch(**options)
         
     | 
| 
       5 
     | 
    
         
            -
                    Api::Client.fetch(filter_options(options))
         
     | 
| 
      
 5 
     | 
    
         
            +
                    Api::Client.fetch(filter_options(**options))
         
     | 
| 
       6 
6 
     | 
    
         
             
                  end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  private
         
     | 
| 
       9 
     | 
    
         
            -
                    def filter_options(** 
     | 
| 
      
 9 
     | 
    
         
            +
                    def filter_options(**_options)
         
     | 
| 
       10 
10 
     | 
    
         
             
                      self.entity_option.merge(action: :index)
         
     | 
| 
       11 
11 
     | 
    
         
             
                    end
         
     | 
| 
       12 
12 
     | 
    
         
             
                end
         
     | 
    
        data/lib/alquran/parah.rb
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ module Alquran 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class Parah < Base
         
     | 
| 
       3 
3 
     | 
    
         
             
                class << self
         
     | 
| 
       4 
4 
     | 
    
         
             
                  def fetch(**options)
         
     | 
| 
       5 
     | 
    
         
            -
                    Api::Client.fetch(filter_options(options))
         
     | 
| 
      
 5 
     | 
    
         
            +
                    Api::Client.fetch(filter_options(**options))
         
     | 
| 
       6 
6 
     | 
    
         
             
                  end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -19,9 +19,9 @@ module Alquran 
     | 
|
| 
       19 
19 
     | 
    
         
             
                      return show_options(options[:number]) unless options.has_key?(:collection)
         
     | 
| 
       20 
20 
     | 
    
         | 
| 
       21 
21 
     | 
    
         
             
                      action_option = case options
         
     | 
| 
       22 
     | 
    
         
            -
                        when -> (opts) { opts[:collection]  
     | 
| 
      
 22 
     | 
    
         
            +
                        when -> (opts) { opts[:collection] == :surahs }
         
     | 
| 
       23 
23 
     | 
    
         
             
                          { action: :surahs }
         
     | 
| 
       24 
     | 
    
         
            -
                        when -> (opts) { opts[:collection]  
     | 
| 
      
 24 
     | 
    
         
            +
                        when -> (opts) { opts[:collection] == :ayahs }
         
     | 
| 
       25 
25 
     | 
    
         
             
                          { action: :ayahs }
         
     | 
| 
       26 
26 
     | 
    
         
             
                        else
         
     | 
| 
       27 
27 
     | 
    
         
             
                          raise RuntimeApiError.new
         
     | 
    
        data/lib/alquran/surah.rb
    CHANGED
    
    | 
         @@ -2,7 +2,7 @@ module Alquran 
     | 
|
| 
       2 
2 
     | 
    
         
             
              class Surah < Base
         
     | 
| 
       3 
3 
     | 
    
         
             
                class << self
         
     | 
| 
       4 
4 
     | 
    
         
             
                  def fetch(**options)
         
     | 
| 
       5 
     | 
    
         
            -
                    Api::Client.fetch(filter_options(options))
         
     | 
| 
      
 5 
     | 
    
         
            +
                    Api::Client.fetch(filter_options(**options))
         
     | 
| 
       6 
6 
     | 
    
         
             
                  end
         
     | 
| 
       7 
7 
     | 
    
         | 
| 
       8 
8 
     | 
    
         
             
                  private
         
     | 
| 
         @@ -10,14 +10,14 @@ module Alquran 
     | 
|
| 
       10 
10 
     | 
    
         
             
                      self.entity_option.merge(action: :index)
         
     | 
| 
       11 
11 
     | 
    
         
             
                    end
         
     | 
| 
       12 
12 
     | 
    
         | 
| 
       13 
     | 
    
         
            -
                    def show_options(options)
         
     | 
| 
      
 13 
     | 
    
         
            +
                    def show_options(**options)
         
     | 
| 
       14 
14 
     | 
    
         
             
                      edition_option = { edition: options[:edition] }.compact
         
     | 
| 
       15 
15 
     | 
    
         
             
                      options.slice(:number).merge(self.entity_option).merge(action: :show).merge(extras: edition_option)
         
     | 
| 
       16 
16 
     | 
    
         
             
                    end
         
     | 
| 
       17 
17 
     | 
    
         | 
| 
       18 
18 
     | 
    
         
             
                    def filter_options(**options)
         
     | 
| 
       19 
19 
     | 
    
         
             
                      return index_options unless options.has_key?(:number)
         
     | 
| 
       20 
     | 
    
         
            -
                      return show_options(options) unless has_extra_option?(options)
         
     | 
| 
      
 20 
     | 
    
         
            +
                      return show_options(**options) unless has_extra_option?(**options)
         
     | 
| 
       21 
21 
     | 
    
         | 
| 
       22 
22 
     | 
    
         
             
                      action_option = { action: :ayahs }
         
     | 
| 
       23 
23 
     | 
    
         | 
    
        data/lib/api/client.rb
    CHANGED
    
    
    
        data/lib/api/url_parser.rb
    CHANGED
    
    | 
         @@ -7,12 +7,12 @@ module Api 
     | 
|
| 
       7 
7 
     | 
    
         
             
                RELATIVE_AYAH_PATH = 'ayahs'
         
     | 
| 
       8 
8 
     | 
    
         
             
                RELATIVE_EDITION_PATH = 'editions'
         
     | 
| 
       9 
9 
     | 
    
         | 
| 
       10 
     | 
    
         
            -
                def parse_url( 
     | 
| 
       11 
     | 
    
         
            -
                  method_name = "handle_#{params[:entity] 
     | 
| 
       12 
     | 
    
         
            -
                  self.send(method_name, params)
         
     | 
| 
      
 10 
     | 
    
         
            +
                def parse_url(params)
         
     | 
| 
      
 11 
     | 
    
         
            +
                  method_name = "handle_#{params[:entity]}_urls"
         
     | 
| 
      
 12 
     | 
    
         
            +
                  self.send(method_name, **params)
         
     | 
| 
       13 
13 
     | 
    
         
             
                end
         
     | 
| 
       14 
14 
     | 
    
         | 
| 
       15 
     | 
    
         
            -
                def handle_parah_urls( 
     | 
| 
      
 15 
     | 
    
         
            +
                def handle_parah_urls(params)
         
     | 
| 
       16 
16 
     | 
    
         
             
                  case params[:action]
         
     | 
| 
       17 
17 
     | 
    
         
             
                    when :index then [BASE_URL, RELATIVE_PARAH_PATH].join('/')
         
     | 
| 
       18 
18 
     | 
    
         
             
                    when :show then [BASE_URL, RELATIVE_PARAH_PATH, params[:number]].join('/')
         
     | 
| 
         @@ -23,7 +23,7 @@ module Api 
     | 
|
| 
       23 
23 
     | 
    
         
             
                  end
         
     | 
| 
       24 
24 
     | 
    
         
             
                end
         
     | 
| 
       25 
25 
     | 
    
         | 
| 
       26 
     | 
    
         
            -
                def handle_surah_urls( 
     | 
| 
      
 26 
     | 
    
         
            +
                def handle_surah_urls(params)
         
     | 
| 
       27 
27 
     | 
    
         
             
                  case params[:action]
         
     | 
| 
       28 
28 
     | 
    
         
             
                    when :index then [BASE_URL, RELATIVE_SURAH_PATH].join('/')
         
     | 
| 
       29 
29 
     | 
    
         
             
                    when :show
         
     | 
| 
         @@ -35,7 +35,7 @@ module Api 
     | 
|
| 
       35 
35 
     | 
    
         
             
                  end
         
     | 
| 
       36 
36 
     | 
    
         
             
                end
         
     | 
| 
       37 
37 
     | 
    
         | 
| 
       38 
     | 
    
         
            -
                def handle_ayah_urls( 
     | 
| 
      
 38 
     | 
    
         
            +
                def handle_ayah_urls(params)
         
     | 
| 
       39 
39 
     | 
    
         
             
                  case params[:action]
         
     | 
| 
       40 
40 
     | 
    
         
             
                    when :show
         
     | 
| 
       41 
41 
     | 
    
         
             
                      relative_url = [BASE_URL, RELATIVE_AYAH_PATH, params[:number]].join('/')
         
     | 
| 
         @@ -44,7 +44,7 @@ module Api 
     | 
|
| 
       44 
44 
     | 
    
         
             
                  end
         
     | 
| 
       45 
45 
     | 
    
         
             
                end
         
     | 
| 
       46 
46 
     | 
    
         | 
| 
       47 
     | 
    
         
            -
                def handle_edition_urls( 
     | 
| 
      
 47 
     | 
    
         
            +
                def handle_edition_urls(params)
         
     | 
| 
       48 
48 
     | 
    
         
             
                  [BASE_URL, RELATIVE_EDITION_PATH, params[:number]].join('/')
         
     | 
| 
       49 
49 
     | 
    
         
             
                end
         
     | 
| 
       50 
50 
     | 
    
         | 
    
        metadata
    CHANGED
    
    | 
         @@ -1,11 +1,11 @@ 
     | 
|
| 
       1 
1 
     | 
    
         
             
            --- !ruby/object:Gem::Specification
         
     | 
| 
       2 
2 
     | 
    
         
             
            name: alquran
         
     | 
| 
       3 
3 
     | 
    
         
             
            version: !ruby/object:Gem::Version
         
     | 
| 
       4 
     | 
    
         
            -
              version: 0.0 
     | 
| 
      
 4 
     | 
    
         
            +
              version: 1.0.0
         
     | 
| 
       5 
5 
     | 
    
         
             
            platform: ruby
         
     | 
| 
       6 
6 
     | 
    
         
             
            authors:
         
     | 
| 
       7 
7 
     | 
    
         
             
            - Ahsan Ellahi
         
     | 
| 
       8 
     | 
    
         
            -
            autorequire: 
     | 
| 
      
 8 
     | 
    
         
            +
            autorequire:
         
     | 
| 
       9 
9 
     | 
    
         
             
            bindir: bin
         
     | 
| 
       10 
10 
     | 
    
         
             
            cert_chain: []
         
     | 
| 
       11 
11 
     | 
    
         
             
            date: 2019-10-03 00:00:00.000000000 Z
         
     | 
| 
         @@ -58,7 +58,7 @@ homepage: https://github.com/ahsanellahi/alquran 
     | 
|
| 
       58 
58 
     | 
    
         
             
            licenses:
         
     | 
| 
       59 
59 
     | 
    
         
             
            - MIT
         
     | 
| 
       60 
60 
     | 
    
         
             
            metadata: {}
         
     | 
| 
       61 
     | 
    
         
            -
            post_install_message: 
     | 
| 
      
 61 
     | 
    
         
            +
            post_install_message:
         
     | 
| 
       62 
62 
     | 
    
         
             
            rdoc_options: []
         
     | 
| 
       63 
63 
     | 
    
         
             
            require_paths:
         
     | 
| 
       64 
64 
     | 
    
         
             
            - lib
         
     | 
| 
         @@ -73,9 +73,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement 
     | 
|
| 
       73 
73 
     | 
    
         
             
                - !ruby/object:Gem::Version
         
     | 
| 
       74 
74 
     | 
    
         
             
                  version: '0'
         
     | 
| 
       75 
75 
     | 
    
         
             
            requirements: []
         
     | 
| 
       76 
     | 
    
         
            -
             
     | 
| 
       77 
     | 
    
         
            -
             
     | 
| 
       78 
     | 
    
         
            -
            signing_key: 
         
     | 
| 
      
 76 
     | 
    
         
            +
            rubygems_version: 3.1.2
         
     | 
| 
      
 77 
     | 
    
         
            +
            signing_key:
         
     | 
| 
       79 
78 
     | 
    
         
             
            specification_version: 4
         
     | 
| 
       80 
79 
     | 
    
         
             
            summary: Provides all the information regarding the Holy Quran (Book)
         
     | 
| 
       81 
80 
     | 
    
         
             
            test_files: []
         
     |