Class: Pattana::Api::V1::DocsController

Inherits:
Pattana::ApplicationController show all
Defined in:
app/controllers/pattana/api/v1/docs_controller.rb

Instance Method Summary collapse

Instance Method Details

#cities_in_a_countryObject



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# File 'app/controllers/pattana/api/v1/docs_controller.rb', line 62

def cities_in_a_country
  set_title("Cities API (in a country)")
  @request_type = "GET"
  @end_point = "/api/v1/countries/:country_id/cities"
  @description = ""
  @description = <<-eos
  This API will return all the cities in a particular country. <br>
  The Country ID has to be passed. <br>
  This API can also be used to search cities in a country by passing a query parameter 'q'.
  eos

  @info = "It will return only those cities who has show_in_api set true"

  @input_headers = {
    "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " }
  }

  @input_params = {
    country_id: { mandatory: true, description: "The Country ID. You will get it from the Countries API", example: "for e.g: Country Id for U.A.E is 235 and that of India is 100", default: "" }
  }

  @example_path = "pattana/api/v1/docs/"
  @examples = ["pos_case_1", "pos_case_2", "pos_case_3", "pos_case_4", "neg_case_1"]

  set_nav("docs/pattana/cities_in_a_country")

  render 'kuppayam/api/docs/show'
end

#cities_in_a_regionObject



91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
# File 'app/controllers/pattana/api/v1/docs_controller.rb', line 91

def cities_in_a_region
  set_title("Cities API (in a region)")
  @request_type = "GET"
  @end_point = "/api/v1/regions/:region_id/cities"
  @description = <<-eos
  This API will return all the cities in a particular region. <br>
  The Region ID has to be passed. <br>
  This API can also be used to search cities in a region by passing a query parameter 'q'.
  eos

  @info = "It will return only those cities who has show_in_api set true"
  
  @input_headers = {
    "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " }
  }

  @input_params = {
    country_id: { mandatory: true, description: "The Country ID. You will get it from the Countries API", example: "for e.g: Country Id for U.A.E is 235 and that of India is 100", default: "" },
    region_id: { mandatory: true, description: "The Region ID. You will get it from the Regions API", example: "for e.g: Country Id for India is 100 and Region ID for Kerala is 1314", default: "" }
  }

  @example_path = "pattana/api/v1/docs/"
  @examples = ["pos_case_1", "pos_case_2", "pos_case_3", "pos_case_4", "neg_case_1"]

  set_nav("docs/pattana/cities_in_a_region")

  render 'kuppayam/api/docs/show'
end

#countriesObject



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'app/controllers/pattana/api/v1/docs_controller.rb', line 11

def countries
  set_title("Countries API")
  @request_type = "GET"
  @end_point = "/api/v1/countries"
  @description = <<-eos
  This API will return all the countries with other details like dialing prefix and ISO codes. <br>
  This API can also be used to search countries by passing a query parameter 'q'.<br>
  eos

  @info = "It will return only those countries who has show_in_api set true"

  @input_headers = {
    "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " }
  }

  @example_path = "pattana/api/v1/docs/"
  @examples = ["pos_case_1", "pos_case_2", "pos_case_3", "pos_case_4"]

  set_nav("docs/pattana/countries")

  render 'kuppayam/api/docs/show'
end

#regionsObject



34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'app/controllers/pattana/api/v1/docs_controller.rb', line 34

def regions
  set_title("Regions API")
  @request_type = "GET"
  @end_point = "/api/v1/:country_id/regions"
  @description = <<-eos
  This API will return all the regions in a particular country. <br>
  The Country ID has to be passed. <br>
  This API can also be used to search regions by passing a query parameter 'q'.
  eos

  @info = "It will return only those regions who has show_in_api set true"

  @input_headers = {
    "Content-Type" => { value: "application/json", description: "The MIME media type for JSON text is application/json. This is to make sure that a valid json is returned. The default encoding is UTF-8. " }
  }

  @input_params = {
    country_id: { mandatory: true, description: "The Country ID. You will get it from the Countries API", example: "for e.g: Country Id for U.A.E is 235 and that of India is 100", default: "" }
  }

  @example_path = "pattana/api/v1/docs/"
  @examples = ["pos_case_1", "pos_case_2", "pos_case_3", "pos_case_4", "neg_case_1"]

  set_nav("docs/pattana/regions")

  render 'kuppayam/api/docs/show'
end