Class: KudagoClient::Client
- Inherits:
-
Object
- Object
- KudagoClient::Client
- Defined in:
- lib/kudago_client/client.rb
Class Attribute Summary collapse
-
.default_lang ⇒ Object
Returns the value of attribute default_lang.
Instance Attribute Summary collapse
-
#lang ⇒ Object
Returns the value of attribute lang.
Class Method Summary collapse
Instance Method Summary collapse
-
#agent(agent_id, params = {}) ⇒ Object
ENTITY METHODS.
-
#agents(params = {}) ⇒ Object
LIST METHODS.
- #event(event_id, params = {}) ⇒ Object
- #event_categories(params = {}) ⇒ Object
- #event_category(event_category_id, params = {}) ⇒ Object
- #event_comment(event_id, comment_id, params = {}) ⇒ Object
- #event_comments(event_id, params = {}) ⇒ Object
- #events(params = {}) ⇒ Object
- #events_of_the_day(params = {}) ⇒ Object
-
#initialize(lang: nil) ⇒ Client
constructor
A new instance of Client.
- #list(list_id, params = {}) ⇒ Object
- #list_comment(list_id, comment_id, params = {}) ⇒ Object
- #list_comments(list_id, params = {}) ⇒ Object
- #lists(params = {}) ⇒ Object
- #location(slug, params = {}) ⇒ Object
- #locations(params = {}) ⇒ Object
- #movie(movie_id, params = {}) ⇒ Object
- #movie_comments(movie_id, params = {}) ⇒ Object
- #movie_showings(movie_id, params = {}) ⇒ Object
- #movies(params = {}) ⇒ Object
- #news(params = {}) ⇒ Object
- #news_comment(news_id, comment_id, params = {}) ⇒ Object
- #news_comments(news_id, params = {}) ⇒ Object
-
#next_page(list, params = {}) ⇒ Object
PAGE METHODS.
- #piece_news(news_id, params = {}) ⇒ Object
- #place(place_id, params = {}) ⇒ Object
- #place_categories(params = {}) ⇒ Object
- #place_category(place_category_id, params = {}) ⇒ Object
- #place_comments(place_id, params = {}) ⇒ Object
- #places(params = {}) ⇒ Object
- #previous_page(list, params = {}) ⇒ Object
- #role(role_id, params = {}) ⇒ Object
- #roles(params = {}) ⇒ Object
- #search(query, params = {}) ⇒ Object
- #showing(showing_id, params = {}) ⇒ Object
- #showings(params = {}) ⇒ Object
Constructor Details
#initialize(lang: nil) ⇒ Client
Returns a new instance of Client.
57 58 59 |
# File 'lib/kudago_client/client.rb', line 57 def initialize(lang: nil) @lang = lang || self.class.default_lang end |
Class Attribute Details
.default_lang ⇒ Object
Returns the value of attribute default_lang.
50 51 52 |
# File 'lib/kudago_client/client.rb', line 50 def default_lang @default_lang end |
Instance Attribute Details
#lang ⇒ Object
Returns the value of attribute lang.
47 48 49 |
# File 'lib/kudago_client/client.rb', line 47 def lang @lang end |
Class Method Details
.config(&blk) ⇒ Object
52 53 54 |
# File 'lib/kudago_client/client.rb', line 52 def config &blk blk.call(self) if block_given? end |
Instance Method Details
#agent(agent_id, params = {}) ⇒ Object
ENTITY METHODS
79 80 81 82 |
# File 'lib/kudago_client/client.rb', line 79 def agent(agent_id, params = {}) res = Requests::AgentRequest.find(agent_id, params) KudagoClient::Entities::Agent.new(**res.data, lang: entity_lang(params)) end |
#agents(params = {}) ⇒ Object
LIST METHODS
151 152 153 154 |
# File 'lib/kudago_client/client.rb', line 151 def agents(params = {}) res = Requests::AgentRequest.list(params) KudagoClient::EntitiesList::AgentList.new(**res.data, lang: entity_lang(params)) end |
#event(event_id, params = {}) ⇒ Object
129 130 131 132 |
# File 'lib/kudago_client/client.rb', line 129 def event(event_id, params = {}) res = Requests::EventRequest.find(event_id, params) KudagoClient::Entities::Event.new(**res.data, lang: entity_lang(params)) end |
#event_categories(params = {}) ⇒ Object
166 167 168 169 |
# File 'lib/kudago_client/client.rb', line 166 def event_categories(params = {}) res = Requests::EventCategoryRequest.list(params) KudagoClient::EntitiesList::EventCategoriesList.new(**res.data, lang: entity_lang(params)) end |
#event_category(event_category_id, params = {}) ⇒ Object
94 95 96 97 |
# File 'lib/kudago_client/client.rb', line 94 def event_category(event_category_id, params = {}) res = Requests::EventCategoryRequest.find(event_category_id, params) KudagoClient::Entities::EventCategory.new(**res.data, lang: entity_lang(params)) end |
#event_comment(event_id, comment_id, params = {}) ⇒ Object
134 135 136 137 |
# File 'lib/kudago_client/client.rb', line 134 def event_comment(event_id, comment_id, params = {}) res = Requests::EventRequest.comment(event_id, comment_id, params) KudagoClient::Entities::Comment.new(**res.data, lang: entity_lang(params)) end |
#event_comments(event_id, params = {}) ⇒ Object
221 222 223 224 |
# File 'lib/kudago_client/client.rb', line 221 def event_comments(event_id, params = {}) res = Requests::EventRequest.comments(event_id, params) KudagoClient::EntitiesList::CommentList.new(**res.data, lang: entity_lang(params)) end |
#events(params = {}) ⇒ Object
216 217 218 219 |
# File 'lib/kudago_client/client.rb', line 216 def events(params = {}) res = Requests::EventRequest.list(params) KudagoClient::EntitiesList::EventList.new(**res.data, lang: entity_lang(params)) end |
#events_of_the_day(params = {}) ⇒ Object
226 227 228 229 |
# File 'lib/kudago_client/client.rb', line 226 def events_of_the_day(params = {}) res = Requests::EventOfTheDayRequest.list(params) KudagoClient::EntitiesList::EventList.new(**res.data, lang: entity_lang(params)) end |
#list(list_id, params = {}) ⇒ Object
139 140 141 142 |
# File 'lib/kudago_client/client.rb', line 139 def list(list_id, params = {}) res = Requests::ListRequest.find(list_id, params) KudagoClient::Entities::List.new(**res.data, lang: entity_lang(params)) end |
#list_comment(list_id, comment_id, params = {}) ⇒ Object
144 145 146 147 |
# File 'lib/kudago_client/client.rb', line 144 def list_comment(list_id, comment_id, params = {}) res = Requests::ListRequest.comment(list_id, comment_id, params) KudagoClient::Entities::Comment.new(**res.data, lang: entity_lang(params)) end |
#list_comments(list_id, params = {}) ⇒ Object
236 237 238 239 |
# File 'lib/kudago_client/client.rb', line 236 def list_comments(list_id, params = {}) res = Requests::ListRequest.comments(list_id, params) KudagoClient::EntitiesList::CommentList.new(**res.data, lang: entity_lang(params)) end |
#lists(params = {}) ⇒ Object
231 232 233 234 |
# File 'lib/kudago_client/client.rb', line 231 def lists(params = {}) res = Requests::ListRequest.list(params) KudagoClient::EntitiesList::ListList.new(**res.data, lang: entity_lang(params)) end |
#location(slug, params = {}) ⇒ Object
84 85 86 87 |
# File 'lib/kudago_client/client.rb', line 84 def location(slug, params = {}) res = Requests::LocationRequest.find(slug, params) KudagoClient::Entities::Location.new(**res.data, lang: entity_lang(params)) end |
#locations(params = {}) ⇒ Object
156 157 158 159 |
# File 'lib/kudago_client/client.rb', line 156 def locations(params = {}) res = Requests::LocationRequest.list(params) KudagoClient::EntitiesList::LocationList.new(**res.data, lang: entity_lang(params)) end |
#movie(movie_id, params = {}) ⇒ Object
104 105 106 107 |
# File 'lib/kudago_client/client.rb', line 104 def movie(movie_id, params = {}) res = Requests::MovieRequest.find(movie_id, params) KudagoClient::Entities::Movie.new(**res.data, lang: entity_lang(params)) end |
#movie_comments(movie_id, params = {}) ⇒ Object
181 182 183 184 |
# File 'lib/kudago_client/client.rb', line 181 def movie_comments(movie_id, params = {}) res = Requests::MovieRequest.comments(movie_id, params) KudagoClient::EntitiesList::CommentList.new(**res.data, lang: entity_lang(params)) end |
#movie_showings(movie_id, params = {}) ⇒ Object
191 192 193 194 |
# File 'lib/kudago_client/client.rb', line 191 def movie_showings(movie_id, params = {}) res = Requests::MovieRequest.showings(movie_id, params) KudagoClient::EntitiesList::MovieShowingList.new(**res.data, item_params: {movie: {id: movie_id}}, lang: entity_lang(params)) end |
#movies(params = {}) ⇒ Object
176 177 178 179 |
# File 'lib/kudago_client/client.rb', line 176 def movies(params = {}) res = Requests::MovieRequest.list(params) KudagoClient::EntitiesList::MovieList.new(**res.data, lang: entity_lang(params)) end |
#news(params = {}) ⇒ Object
206 207 208 209 |
# File 'lib/kudago_client/client.rb', line 206 def news(params = {}) res = Requests::NewsRequest.list(params) KudagoClient::EntitiesList::NewsList.new(**res.data, lang: entity_lang(params)) end |
#news_comment(news_id, comment_id, params = {}) ⇒ Object
124 125 126 127 |
# File 'lib/kudago_client/client.rb', line 124 def news_comment(news_id, comment_id, params = {}) res = Requests::NewsRequest.comment(news_id, comment_id, params) KudagoClient::Entities::Comment.new(**res.data, lang: entity_lang(params)) end |
#news_comments(news_id, params = {}) ⇒ Object
211 212 213 214 |
# File 'lib/kudago_client/client.rb', line 211 def news_comments(news_id, params = {}) res = Requests::NewsRequest.comments(news_id, params) KudagoClient::EntitiesList::CommentList.new(**res.data, lang: entity_lang(params)) end |
#next_page(list, params = {}) ⇒ Object
PAGE METHODS
63 64 65 66 67 68 |
# File 'lib/kudago_client/client.rb', line 63 def next_page(list, params = {}) return nil if list.next_url.nil? res = Requests::BaseRequest.get(list.next_url, params) list.class.new(**res.data, lang: entity_lang(params)) end |
#piece_news(news_id, params = {}) ⇒ Object
119 120 121 122 |
# File 'lib/kudago_client/client.rb', line 119 def piece_news(news_id, params = {}) res = Requests::NewsRequest.find(news_id, params) KudagoClient::Entities::News.new(**res.data, lang: entity_lang(params)) end |
#place(place_id, params = {}) ⇒ Object
114 115 116 117 |
# File 'lib/kudago_client/client.rb', line 114 def place(place_id, params = {}) res = Requests::PlaceRequest.find(place_id, params) KudagoClient::Entities::Place.new(**res.data, lang: entity_lang(params)) end |
#place_categories(params = {}) ⇒ Object
171 172 173 174 |
# File 'lib/kudago_client/client.rb', line 171 def place_categories(params = {}) res = Requests::PlaceCategoryRequest.list(params) KudagoClient::EntitiesList::PlaceCategoriesList.new(**res.data, lang: entity_lang(params)) end |
#place_category(place_category_id, params = {}) ⇒ Object
99 100 101 102 |
# File 'lib/kudago_client/client.rb', line 99 def place_category(place_category_id, params = {}) res = Requests::PlaceCategoryRequest.find(place_category_id, params) KudagoClient::Entities::PlaceCategory.new(**res.data, lang: entity_lang(params)) end |
#place_comments(place_id, params = {}) ⇒ Object
201 202 203 204 |
# File 'lib/kudago_client/client.rb', line 201 def place_comments(place_id, params = {}) res = Requests::PlaceRequest.comments(place_id, params) KudagoClient::EntitiesList::CommentList.new(**res.data, lang: entity_lang(params)) end |
#places(params = {}) ⇒ Object
196 197 198 199 |
# File 'lib/kudago_client/client.rb', line 196 def places(params = {}) res = Requests::PlaceRequest.list(params) KudagoClient::EntitiesList::PlaceList.new(**res.data, lang: entity_lang(params)) end |
#previous_page(list, params = {}) ⇒ Object
70 71 72 73 74 75 |
# File 'lib/kudago_client/client.rb', line 70 def previous_page(list, params = {}) return nil if list.previous_url.nil? res = Requests::BaseRequest.get(list.previous_url, params) list.class.new(**res.data, lang: entity_lang(params)) end |
#role(role_id, params = {}) ⇒ Object
89 90 91 92 |
# File 'lib/kudago_client/client.rb', line 89 def role(role_id, params = {}) res = Requests::RoleRequest.find(role_id, params) KudagoClient::Entities::Role.new(**res.data, lang: entity_lang(params)) end |
#roles(params = {}) ⇒ Object
161 162 163 164 |
# File 'lib/kudago_client/client.rb', line 161 def roles(params = {}) res = Requests::RoleRequest.list(params) KudagoClient::EntitiesList::RoleList.new(**res.data, lang: entity_lang(params)) end |
#search(query, params = {}) ⇒ Object
241 242 243 244 |
# File 'lib/kudago_client/client.rb', line 241 def search(query, params = {}) res = Requests::SearchRequest.search(query, params) KudagoClient::EntitiesList::MultipleList.new(**res.data, lang: entity_lang(params)) end |
#showing(showing_id, params = {}) ⇒ Object
109 110 111 112 |
# File 'lib/kudago_client/client.rb', line 109 def showing(showing_id, params = {}) res = Requests::MovieShowingRequest.find(showing_id, params) KudagoClient::Entities::MovieShowing.new(**res.data, lang: entity_lang(params)) end |
#showings(params = {}) ⇒ Object
186 187 188 189 |
# File 'lib/kudago_client/client.rb', line 186 def showings(params = {}) res = Requests::MovieShowingRequest.list(params) KudagoClient::EntitiesList::MovieShowingList.new(**res.data, lang: entity_lang(params)) end |