Class: GdsApi::Publisher
  
  
  
  
  
    - Inherits:
 
    - 
      Base
      
        
          - Object
 
          
            - Base
 
          
            - GdsApi::Publisher
 
          
        
        show all
      
     
  
  
  
  
  
  
  
  
  
  
    - Defined in:
 
    - lib/gds_api/publisher.rb
 
  
  
 
  Instance Attribute Summary
  
  Attributes inherited from Base
  #options
  
    
      Instance Method Summary
      collapse
    
    
  
  
  
  
  
  
  
  
  
  Methods inherited from Base
  #client, #create_client, #get_list!, #initialize, #url_for_slug
  
  Constructor Details
  
    This class inherits a constructor from GdsApi::Base
  
 
  
    Instance Method Details
    
      
  
  
    #council_for_name(name)  ⇒ Object 
  
  
  
  
    
      
33
34
35
36
37
38
39 
     | 
    
      # File 'lib/gds_api/publisher.rb', line 33
def council_for_name(name)
  name = URI.escape(name)
  json = get_json(
    "#{@endpoint}/local_transactions/find_by_council_name?name=#{name}"
  )
  json.to_hash if json
end
     | 
  
 
    
      
  
  
    #council_for_slug(slug, snac_codes)  ⇒ Object 
  
  
  
  
    
      
20
21
22
23
24
25
26 
     | 
    
      # File 'lib/gds_api/publisher.rb', line 20
def council_for_slug(slug, snac_codes)
  json = post_json(
    "#{@endpoint}/local_transactions/#{slug}/verify_snac.json",
    {'snac_codes' => snac_codes}
  )
  json['snac'] if json
end
     | 
  
 
    
      
  
  
    #council_for_snac_code(snac)  ⇒ Object 
  
  
  
  
    
      
28
29
30
31 
     | 
    
      # File 'lib/gds_api/publisher.rb', line 28
def council_for_snac_code(snac)
  json = get_json("#{@endpoint}/local_transactions/find_by_snac?snac=#{snac}")
  json.to_hash if json
end
     | 
  
 
    
      
  
  
    #publication_for_slug(slug, options = {})  ⇒ Object 
  
  
  
  
    
      
6
7
8
9
10
11
12
13
14
15
16
17
18 
     | 
    
      # File 'lib/gds_api/publisher.rb', line 6
def publication_for_slug(slug, options = {})
  return nil if slug.nil? or slug == ''
  response = get_json(url_for_slug(slug, options))
  if response
    container = response.to_ostruct
    container.extend(GdsApi::PartMethods) if container.parts
    convert_updated_date(container)
    container
  else
    nil
  end
end
     |