-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
9fe18a8
commit a7b85e3
Showing
11 changed files
with
58 additions
and
82 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 3 additions & 15 deletions
18
app/src/main/java/com/example/examengapsi/model/Producto.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,7 +9,6 @@ | |
public class SearchHistory { | ||
|
||
@PrimaryKey | ||
@NonNull | ||
@ColumnInfo(name="text") | ||
private String text; | ||
|
||
|
12 changes: 12 additions & 0 deletions
12
app/src/main/java/com/example/examengapsi/service/ApiRoutes.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package com.example.examengapsi.service; | ||
|
||
public class ApiRoutes { | ||
|
||
public static final String URLSERVICE = "https://shoppapp.liverpool.com.mx"; | ||
|
||
public static final String SEARCH_PRODUCTS = "/appclienteservices/services/v3/plp"; | ||
public static final String FORCE_PLP = "force-plp"; | ||
public static final String QUERY_SEARCH = "search-string"; | ||
public static final String PAGE_NUMBER = "page-number"; | ||
public static final String NUM_FOR_ITEM = "number-of-items-per-page"; | ||
} |
27 changes: 3 additions & 24 deletions
27
app/src/main/java/com/example/examengapsi/service/ApiService.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,43 +1,22 @@ | ||
package com.example.examengapsi.service; | ||
|
||
import android.content.Context; | ||
|
||
import com.example.examengapsi.R; | ||
|
||
import java.util.HashMap; | ||
import java.util.Map; | ||
import static com.example.examengapsi.service.ApiRoutes.URLSERVICE; | ||
|
||
import retrofit2.Retrofit; | ||
import retrofit2.converter.scalars.ScalarsConverterFactory; | ||
|
||
public class ApiService { | ||
|
||
public ApiServiceInterface apiInterface; | ||
private String URL = "https://shoppapp.liverpool.com.mx"; | ||
|
||
public ApiService() { | ||
} | ||
|
||
public ApiService initApiService(Context context) { | ||
public ApiService initApiService() { | ||
|
||
Retrofit.Builder apiClientConfig = new Retrofit.Builder() | ||
.baseUrl(URL) | ||
.baseUrl(URLSERVICE) | ||
.addConverterFactory(ScalarsConverterFactory.create()); | ||
|
||
apiInterface = apiClientConfig.build().create(ApiServiceInterface.class); | ||
return this; | ||
} | ||
|
||
private static Map<String, String> mapHeaders = null; | ||
|
||
public static Map<String, String> getMapHeaders(Context context) { | ||
if (mapHeaders == null) { | ||
mapHeaders = new HashMap<>(); | ||
} else { | ||
mapHeaders.clear(); | ||
} | ||
mapHeaders.put("Content-Type", "application/x-www-form-urlencoded"); | ||
return mapHeaders; | ||
} | ||
|
||
} |
22 changes: 11 additions & 11 deletions
22
app/src/main/java/com/example/examengapsi/service/ApiServiceInterface.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,22 +1,22 @@ | ||
package com.example.examengapsi.service; | ||
|
||
import java.util.Map; | ||
import static com.example.examengapsi.service.ApiRoutes.FORCE_PLP; | ||
import static com.example.examengapsi.service.ApiRoutes.NUM_FOR_ITEM; | ||
import static com.example.examengapsi.service.ApiRoutes.PAGE_NUMBER; | ||
import static com.example.examengapsi.service.ApiRoutes.QUERY_SEARCH; | ||
import static com.example.examengapsi.service.ApiRoutes.SEARCH_PRODUCTS; | ||
|
||
|
||
import retrofit2.Call; | ||
import retrofit2.http.Field; | ||
import retrofit2.http.FormUrlEncoded; | ||
import retrofit2.http.GET; | ||
import retrofit2.http.HeaderMap; | ||
import retrofit2.http.POST; | ||
import retrofit2.http.Path; | ||
import retrofit2.http.Query; | ||
|
||
public interface ApiServiceInterface { | ||
|
||
@GET("/appclienteservices/services/v3/plp") | ||
@GET(SEARCH_PRODUCTS) | ||
Call<String> getProductos( | ||
@Query("force-plp") Boolean forcePlp, | ||
@Query("search-string") String text, | ||
@Query("page-number") Integer page, | ||
@Query("number-of-items-per-page") Integer items); | ||
@Query(FORCE_PLP) Boolean forcePlp, | ||
@Query(QUERY_SEARCH) String text, | ||
@Query(PAGE_NUMBER) Integer page, | ||
@Query(NUM_FOR_ITEM) Integer items); | ||
} |
This file was deleted.
Oops, something went wrong.