initial commit
13
.gitignore
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
*.iml
|
||||
.gradle
|
||||
/local.properties
|
||||
/.idea/caches
|
||||
/.idea/libraries
|
||||
/.idea/modules.xml
|
||||
/.idea/workspace.xml
|
||||
/.idea/navEditor.xml
|
||||
/.idea/assetWizardSettings.xml
|
||||
.DS_Store
|
||||
/build
|
||||
/captures
|
||||
.externalNativeBuild
|
||||
35
.idea/codeStyles/Project.xml
generated
Normal file
@ -0,0 +1,35 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</JetCodeStyleSettings>
|
||||
<Objective-C-extensions>
|
||||
<file>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Import" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Macro" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Typedef" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Enum" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Constant" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Global" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Struct" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="FunctionPredecl" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Function" />
|
||||
</file>
|
||||
<class>
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Property" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="Synthesize" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InitMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="StaticMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="InstanceMethod" />
|
||||
<option name="com.jetbrains.cidr.lang.util.OCDeclarationKind" value="DeallocMethod" />
|
||||
</class>
|
||||
<extensions>
|
||||
<pair source="cpp" header="h" fileNamingConvention="NONE" />
|
||||
<pair source="c" header="h" fileNamingConvention="NONE" />
|
||||
</extensions>
|
||||
</Objective-C-extensions>
|
||||
<codeStyleSettings language="kotlin">
|
||||
<option name="CODE_STYLE_DEFAULTS" value="KOTLIN_OFFICIAL" />
|
||||
</codeStyleSettings>
|
||||
</code_scheme>
|
||||
</component>
|
||||
5
.idea/codeStyles/codeStyleConfig.xml
generated
Normal file
@ -0,0 +1,5 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<state>
|
||||
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
|
||||
</state>
|
||||
</component>
|
||||
19
.idea/gradle.xml
generated
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
<option value="$PROJECT_DIR$/app" />
|
||||
<option value="$PROJECT_DIR$/woodroid" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
</GradleProjectSettings>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
9
.idea/misc.xml
generated
Normal file
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
<option name="id" value="Android" />
|
||||
</component>
|
||||
</project>
|
||||
12
.idea/runConfigurations.xml
generated
Normal file
@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="RunConfigurationProducerService">
|
||||
<option name="ignoredProducers">
|
||||
<set>
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.AllInPackageGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestClassGradleConfigurationProducer" />
|
||||
<option value="org.jetbrains.plugins.gradle.execution.test.runner.TestMethodGradleConfigurationProducer" />
|
||||
</set>
|
||||
</option>
|
||||
</component>
|
||||
</project>
|
||||
6
.idea/vcs.xml
generated
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="$PROJECT_DIR$" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
1
app/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
34
app/build.gradle
Normal file
@ -0,0 +1,34 @@
|
||||
apply plugin: 'com.android.application'
|
||||
|
||||
apply plugin: 'kotlin-android'
|
||||
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
defaultConfig {
|
||||
applicationId "me.gilo.wc_app"
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
compile project(path: ':woodroid')
|
||||
}
|
||||
21
app/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,24 @@
|
||||
package me.gilo.wc_app
|
||||
|
||||
import android.support.test.InstrumentationRegistry
|
||||
import android.support.test.runner.AndroidJUnit4
|
||||
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
@RunWith(AndroidJUnit4::class)
|
||||
class ExampleInstrumentedTest {
|
||||
@Test
|
||||
fun useAppContext() {
|
||||
// Context of the app under test.
|
||||
val appContext = InstrumentationRegistry.getTargetContext()
|
||||
assertEquals("me.gilo.wc_app", appContext.packageName)
|
||||
}
|
||||
}
|
||||
21
app/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="me.gilo.wc_app">
|
||||
|
||||
<application
|
||||
android:allowBackup="true"
|
||||
android:icon="@mipmap/ic_launcher"
|
||||
android:label="@string/app_name"
|
||||
android:roundIcon="@mipmap/ic_launcher_round"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme">
|
||||
<activity android:name=".MainActivity">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
28
app/src/main/java/me/gilo/wc_app/MainActivity.kt
Normal file
@ -0,0 +1,28 @@
|
||||
package me.gilo.wc_app
|
||||
|
||||
import android.arch.lifecycle.Observer
|
||||
import android.support.v7.app.AppCompatActivity
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
import me.gilo.woodroid.Woocommerce
|
||||
import me.gilo.woodroid.Woocommerce.Builder
|
||||
import me.gilo.woodroid.callback.Status
|
||||
|
||||
class MainActivity : AppCompatActivity() {
|
||||
|
||||
val TAG = "MainActivity";
|
||||
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
setContentView(R.layout.activity_main)
|
||||
|
||||
val woocommerce = Builder()
|
||||
.setSiteUrl("")
|
||||
.setApiVersion("")
|
||||
.setConsumerKey("")
|
||||
.setConsumerSecret("")
|
||||
.build()
|
||||
|
||||
woocommerce.products.
|
||||
}
|
||||
}
|
||||
34
app/src/main/res/drawable-v24/ic_launcher_foreground.xml
Normal file
@ -0,0 +1,34 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:aapt="http://schemas.android.com/aapt"
|
||||
android:width="108dp"
|
||||
android:height="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path
|
||||
android:fillType="evenOdd"
|
||||
android:pathData="M32,64C32,64 38.39,52.99 44.13,50.95C51.37,48.37 70.14,49.57 70.14,49.57L108.26,87.69L108,109.01L75.97,107.97L32,64Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1">
|
||||
<aapt:attr name="android:fillColor">
|
||||
<gradient
|
||||
android:endX="78.5885"
|
||||
android:endY="90.9159"
|
||||
android:startX="48.7653"
|
||||
android:startY="61.0927"
|
||||
android:type="linear">
|
||||
<item
|
||||
android:color="#44000000"
|
||||
android:offset="0.0"/>
|
||||
<item
|
||||
android:color="#00000000"
|
||||
android:offset="1.0"/>
|
||||
</gradient>
|
||||
</aapt:attr>
|
||||
</path>
|
||||
<path
|
||||
android:fillColor="#FFFFFF"
|
||||
android:fillType="nonZero"
|
||||
android:pathData="M66.94,46.02L66.94,46.02C72.44,50.07 76,56.61 76,64L32,64C32,56.61 35.56,50.11 40.98,46.06L36.18,41.19C35.45,40.45 35.45,39.3 36.18,38.56C36.91,37.81 38.05,37.81 38.78,38.56L44.25,44.05C47.18,42.57 50.48,41.71 54,41.71C57.48,41.71 60.78,42.57 63.68,44.05L69.11,38.56C69.84,37.81 70.98,37.81 71.71,38.56C72.44,39.3 72.44,40.45 71.71,41.19L66.94,46.02ZM62.94,56.92C64.08,56.92 65,56.01 65,54.88C65,53.76 64.08,52.85 62.94,52.85C61.8,52.85 60.88,53.76 60.88,54.88C60.88,56.01 61.8,56.92 62.94,56.92ZM45.06,56.92C46.2,56.92 47.13,56.01 47.13,54.88C47.13,53.76 46.2,52.85 45.06,52.85C43.92,52.85 43,53.76 43,54.88C43,56.01 43.92,56.92 45.06,56.92Z"
|
||||
android:strokeColor="#00000000"
|
||||
android:strokeWidth="1"/>
|
||||
</vector>
|
||||
74
app/src/main/res/drawable/ic_launcher_background.xml
Normal file
@ -0,0 +1,74 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<vector
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:height="108dp"
|
||||
android:width="108dp"
|
||||
android:viewportHeight="108"
|
||||
android:viewportWidth="108">
|
||||
<path android:fillColor="#008577"
|
||||
android:pathData="M0,0h108v108h-108z"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M9,0L9,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,0L19,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,0L29,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,0L39,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,0L49,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,0L59,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,0L69,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,0L79,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M89,0L89,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M99,0L99,108"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,9L108,9"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,19L108,19"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,29L108,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,39L108,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,49L108,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,59L108,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,69L108,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,79L108,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,89L108,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M0,99L108,99"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,29L89,29"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,39L89,39"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,49L89,49"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,59L89,59"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,69L89,69"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M19,79L89,79"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M29,19L29,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M39,19L39,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M49,19L49,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M59,19L59,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M69,19L69,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
<path android:fillColor="#00000000" android:pathData="M79,19L79,89"
|
||||
android:strokeColor="#33FFFFFF" android:strokeWidth="0.8"/>
|
||||
</vector>
|
||||
19
app/src/main/res/layout/activity_main.xml
Normal file
@ -0,0 +1,19 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.constraint.ConstraintLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context=".MainActivity">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Hello World!"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
</android.support.constraint.ConstraintLayout>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
5
app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml
Normal file
@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<background android:drawable="@drawable/ic_launcher_background"/>
|
||||
<foreground android:drawable="@drawable/ic_launcher_foreground"/>
|
||||
</adaptive-icon>
|
||||
BIN
app/src/main/res/mipmap-hdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
BIN
app/src/main/res/mipmap-hdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 4.8 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
BIN
app/src/main/res/mipmap-mdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 4.4 KiB |
BIN
app/src/main/res/mipmap-xhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 6.7 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 6.2 KiB |
BIN
app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 10 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher.png
Normal file
|
After Width: | Height: | Size: 8.9 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png
Normal file
|
After Width: | Height: | Size: 15 KiB |
6
app/src/main/res/values/colors.xml
Normal file
@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="colorPrimary">#008577</color>
|
||||
<color name="colorPrimaryDark">#00574B</color>
|
||||
<color name="colorAccent">#D81B60</color>
|
||||
</resources>
|
||||
3
app/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">wc-app</string>
|
||||
</resources>
|
||||
11
app/src/main/res/values/styles.xml
Normal file
@ -0,0 +1,11 @@
|
||||
<resources>
|
||||
|
||||
<!-- Base application theme. -->
|
||||
<style name="AppTheme" parent="Theme.AppCompat.Light.DarkActionBar">
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="colorPrimary">@color/colorPrimary</item>
|
||||
<item name="colorPrimaryDark">@color/colorPrimaryDark</item>
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
17
app/src/test/java/me/gilo/wc_app/ExampleUnitTest.kt
Normal file
@ -0,0 +1,17 @@
|
||||
package me.gilo.wc_app
|
||||
|
||||
import org.junit.Test
|
||||
|
||||
import org.junit.Assert.*
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* See [testing documentation](http://d.android.com/tools/testing).
|
||||
*/
|
||||
class ExampleUnitTest {
|
||||
@Test
|
||||
fun addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2)
|
||||
}
|
||||
}
|
||||
28
build.gradle
Normal file
@ -0,0 +1,28 @@
|
||||
// Top-level build file where you can add configuration options common to all sub-projects/modules.
|
||||
|
||||
buildscript {
|
||||
ext.kotlin_version = '1.3.11'
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
dependencies {
|
||||
classpath 'com.android.tools.build:gradle:3.4.0-alpha01'
|
||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||
// NOTE: Do not place your application dependencies here; they belong
|
||||
// in the individual module build.gradle files
|
||||
}
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
google()
|
||||
jcenter()
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
task clean(type: Delete) {
|
||||
delete rootProject.buildDir
|
||||
}
|
||||
15
gradle.properties
Normal file
@ -0,0 +1,15 @@
|
||||
# Project-wide Gradle settings.
|
||||
# IDE (e.g. Android Studio) users:
|
||||
# Gradle settings configured through the IDE *will override*
|
||||
# any settings specified in this file.
|
||||
# For more details on how to configure your build environment visit
|
||||
# http://www.gradle.org/docs/current/userguide/build_environment.html
|
||||
# Specifies the JVM arguments used for the daemon process.
|
||||
# The setting is particularly useful for tweaking memory settings.
|
||||
org.gradle.jvmargs=-Xmx1536m
|
||||
# When configured, Gradle will run in incubating parallel mode.
|
||||
# This option should only be used with decoupled projects. More details, visit
|
||||
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
|
||||
# org.gradle.parallel=true
|
||||
# Kotlin code style for this project: "official" or "obsolete":
|
||||
kotlin.code.style=official
|
||||
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Normal file
6
gradle/wrapper/gradle-wrapper.properties
vendored
Normal file
@ -0,0 +1,6 @@
|
||||
#Wed Jan 16 04:39:39 EAT 2019
|
||||
distributionBase=GRADLE_USER_HOME
|
||||
distributionPath=wrapper/dists
|
||||
zipStoreBase=GRADLE_USER_HOME
|
||||
zipStorePath=wrapper/dists
|
||||
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.1-all.zip
|
||||
172
gradlew
vendored
Executable file
@ -0,0 +1,172 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
##############################################################################
|
||||
##
|
||||
## Gradle start up script for UN*X
|
||||
##
|
||||
##############################################################################
|
||||
|
||||
# Attempt to set APP_HOME
|
||||
# Resolve links: $0 may be a link
|
||||
PRG="$0"
|
||||
# Need this for relative symlinks.
|
||||
while [ -h "$PRG" ] ; do
|
||||
ls=`ls -ld "$PRG"`
|
||||
link=`expr "$ls" : '.*-> \(.*\)$'`
|
||||
if expr "$link" : '/.*' > /dev/null; then
|
||||
PRG="$link"
|
||||
else
|
||||
PRG=`dirname "$PRG"`"/$link"
|
||||
fi
|
||||
done
|
||||
SAVED="`pwd`"
|
||||
cd "`dirname \"$PRG\"`/" >/dev/null
|
||||
APP_HOME="`pwd -P`"
|
||||
cd "$SAVED" >/dev/null
|
||||
|
||||
APP_NAME="Gradle"
|
||||
APP_BASE_NAME=`basename "$0"`
|
||||
|
||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
DEFAULT_JVM_OPTS=""
|
||||
|
||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||
MAX_FD="maximum"
|
||||
|
||||
warn () {
|
||||
echo "$*"
|
||||
}
|
||||
|
||||
die () {
|
||||
echo
|
||||
echo "$*"
|
||||
echo
|
||||
exit 1
|
||||
}
|
||||
|
||||
# OS specific support (must be 'true' or 'false').
|
||||
cygwin=false
|
||||
msys=false
|
||||
darwin=false
|
||||
nonstop=false
|
||||
case "`uname`" in
|
||||
CYGWIN* )
|
||||
cygwin=true
|
||||
;;
|
||||
Darwin* )
|
||||
darwin=true
|
||||
;;
|
||||
MINGW* )
|
||||
msys=true
|
||||
;;
|
||||
NONSTOP* )
|
||||
nonstop=true
|
||||
;;
|
||||
esac
|
||||
|
||||
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
|
||||
|
||||
# Determine the Java command to use to start the JVM.
|
||||
if [ -n "$JAVA_HOME" ] ; then
|
||||
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
|
||||
# IBM's JDK on AIX uses strange locations for the executables
|
||||
JAVACMD="$JAVA_HOME/jre/sh/java"
|
||||
else
|
||||
JAVACMD="$JAVA_HOME/bin/java"
|
||||
fi
|
||||
if [ ! -x "$JAVACMD" ] ; then
|
||||
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
else
|
||||
JAVACMD="java"
|
||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
|
||||
Please set the JAVA_HOME variable in your environment to match the
|
||||
location of your Java installation."
|
||||
fi
|
||||
|
||||
# Increase the maximum file descriptors if we can.
|
||||
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
|
||||
MAX_FD_LIMIT=`ulimit -H -n`
|
||||
if [ $? -eq 0 ] ; then
|
||||
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
|
||||
MAX_FD="$MAX_FD_LIMIT"
|
||||
fi
|
||||
ulimit -n $MAX_FD
|
||||
if [ $? -ne 0 ] ; then
|
||||
warn "Could not set maximum file descriptor limit: $MAX_FD"
|
||||
fi
|
||||
else
|
||||
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
|
||||
fi
|
||||
fi
|
||||
|
||||
# For Darwin, add options to specify how the application appears in the dock
|
||||
if $darwin; then
|
||||
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
|
||||
fi
|
||||
|
||||
# For Cygwin, switch paths to Windows format before running java
|
||||
if $cygwin ; then
|
||||
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
|
||||
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
|
||||
JAVACMD=`cygpath --unix "$JAVACMD"`
|
||||
|
||||
# We build the pattern for arguments to be converted via cygpath
|
||||
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
|
||||
SEP=""
|
||||
for dir in $ROOTDIRSRAW ; do
|
||||
ROOTDIRS="$ROOTDIRS$SEP$dir"
|
||||
SEP="|"
|
||||
done
|
||||
OURCYGPATTERN="(^($ROOTDIRS))"
|
||||
# Add a user-defined pattern to the cygpath arguments
|
||||
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
|
||||
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
|
||||
fi
|
||||
# Now convert the arguments - kludge to limit ourselves to /bin/sh
|
||||
i=0
|
||||
for arg in "$@" ; do
|
||||
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
|
||||
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
|
||||
|
||||
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
|
||||
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
|
||||
else
|
||||
eval `echo args$i`="\"$arg\""
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
case $i in
|
||||
(0) set -- ;;
|
||||
(1) set -- "$args0" ;;
|
||||
(2) set -- "$args0" "$args1" ;;
|
||||
(3) set -- "$args0" "$args1" "$args2" ;;
|
||||
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
|
||||
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
|
||||
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
|
||||
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
|
||||
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
|
||||
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
|
||||
esac
|
||||
fi
|
||||
|
||||
# Escape application args
|
||||
save () {
|
||||
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
|
||||
echo " "
|
||||
}
|
||||
APP_ARGS=$(save "$@")
|
||||
|
||||
# Collect all arguments for the java command, following the shell quoting and substitution rules
|
||||
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
|
||||
|
||||
# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
|
||||
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
|
||||
cd "$(dirname "$0")"
|
||||
fi
|
||||
|
||||
exec "$JAVACMD" "$@"
|
||||
84
gradlew.bat
vendored
Normal file
@ -0,0 +1,84 @@
|
||||
@if "%DEBUG%" == "" @echo off
|
||||
@rem ##########################################################################
|
||||
@rem
|
||||
@rem Gradle startup script for Windows
|
||||
@rem
|
||||
@rem ##########################################################################
|
||||
|
||||
@rem Set local scope for the variables with windows NT shell
|
||||
if "%OS%"=="Windows_NT" setlocal
|
||||
|
||||
set DIRNAME=%~dp0
|
||||
if "%DIRNAME%" == "" set DIRNAME=.
|
||||
set APP_BASE_NAME=%~n0
|
||||
set APP_HOME=%DIRNAME%
|
||||
|
||||
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||
set DEFAULT_JVM_OPTS=
|
||||
|
||||
@rem Find java.exe
|
||||
if defined JAVA_HOME goto findJavaFromJavaHome
|
||||
|
||||
set JAVA_EXE=java.exe
|
||||
%JAVA_EXE% -version >NUL 2>&1
|
||||
if "%ERRORLEVEL%" == "0" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:findJavaFromJavaHome
|
||||
set JAVA_HOME=%JAVA_HOME:"=%
|
||||
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
|
||||
|
||||
if exist "%JAVA_EXE%" goto init
|
||||
|
||||
echo.
|
||||
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
|
||||
echo.
|
||||
echo Please set the JAVA_HOME variable in your environment to match the
|
||||
echo location of your Java installation.
|
||||
|
||||
goto fail
|
||||
|
||||
:init
|
||||
@rem Get command-line arguments, handling Windows variants
|
||||
|
||||
if not "%OS%" == "Windows_NT" goto win9xME_args
|
||||
|
||||
:win9xME_args
|
||||
@rem Slurp the command line arguments.
|
||||
set CMD_LINE_ARGS=
|
||||
set _SKIP=2
|
||||
|
||||
:win9xME_args_slurp
|
||||
if "x%~1" == "x" goto execute
|
||||
|
||||
set CMD_LINE_ARGS=%*
|
||||
|
||||
:execute
|
||||
@rem Setup the command line
|
||||
|
||||
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||
|
||||
@rem Execute Gradle
|
||||
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
|
||||
|
||||
:end
|
||||
@rem End local scope for the variables with windows NT shell
|
||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
||||
|
||||
:fail
|
||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||
rem the _cmd.exe /c_ return code!
|
||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
||||
exit /b 1
|
||||
|
||||
:mainEnd
|
||||
if "%OS%"=="Windows_NT" endlocal
|
||||
|
||||
:omega
|
||||
1
settings.gradle
Normal file
@ -0,0 +1 @@
|
||||
include ':app', ':woodroid'
|
||||
1
woodroid/.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
/build
|
||||
50
woodroid/build.gradle
Normal file
@ -0,0 +1,50 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion 28
|
||||
|
||||
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion 15
|
||||
targetSdkVersion 28
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
|
||||
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility = '1.8'
|
||||
targetCompatibility = '1.8'
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation 'com.android.support:appcompat-v7:28.0.0'
|
||||
testImplementation 'junit:junit:4.12'
|
||||
androidTestImplementation 'com.android.support.test:runner:1.0.2'
|
||||
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
|
||||
|
||||
implementation 'com.squareup.retrofit2:retrofit:2.3.0'
|
||||
implementation 'com.squareup.retrofit2:converter-gson:2.3.0'
|
||||
|
||||
implementation 'org.apache.httpcomponents:httpclient:4.4-alpha1'
|
||||
implementation 'com.jakewharton.retrofit:retrofit1-okhttp3-client:1.1.0'
|
||||
|
||||
implementation 'io.reactivex:rxandroid:1.2.1'
|
||||
implementation 'io.reactivex:rxjava:1.3.0'
|
||||
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.10.0'
|
||||
}
|
||||
21
woodroid/proguard-rules.pro
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@ -0,0 +1,26 @@
|
||||
package me.gilo.woodroid;
|
||||
|
||||
import android.content.Context;
|
||||
import android.support.test.InstrumentationRegistry;
|
||||
import android.support.test.runner.AndroidJUnit4;
|
||||
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Instrumented test, which will execute on an Android device.
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
@RunWith(AndroidJUnit4.class)
|
||||
public class ExampleInstrumentedTest {
|
||||
@Test
|
||||
public void useAppContext() {
|
||||
// Context of the app under test.
|
||||
Context appContext = InstrumentationRegistry.getTargetContext();
|
||||
|
||||
assertEquals("me.gilo.woodroid.test", appContext.getPackageName());
|
||||
}
|
||||
}
|
||||
2
woodroid/src/main/AndroidManifest.xml
Normal file
@ -0,0 +1,2 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="me.gilo.woodroid"/>
|
||||
102
woodroid/src/main/java/me/gilo/woodroid/Woocommerce.java
Normal file
@ -0,0 +1,102 @@
|
||||
package me.gilo.woodroid;
|
||||
|
||||
import me.gilo.woodroid.models.Product;
|
||||
import me.gilo.woodroid.repo.ProductRepository;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
public class Woocommerce {
|
||||
|
||||
private String baseUrl;
|
||||
private String siteUrl;
|
||||
private String apiVerion;
|
||||
private String consumerKey;
|
||||
private String consumerSecret;
|
||||
|
||||
final ProductRepository productRepository;
|
||||
|
||||
public static void main(String args[]){
|
||||
System.out.println("Hello");
|
||||
|
||||
Woocommerce woocommerce = new Woocommerce.Builder()
|
||||
.setSiteUrl("http://iappsdevelopers.com/codecan/woodroid")
|
||||
.setApiVersion("2")
|
||||
.setConsumerKey("ck_62b755890341ad3d2bd334433d30b5070eea349f")
|
||||
.setConsumerSecret("cs_8f678fedc94cbf520e0240d6eacab4dab2954aaa")
|
||||
.build();
|
||||
|
||||
|
||||
woocommerce.getProducts().enqueue(new Callback<ArrayList<Product>>() {
|
||||
@Override
|
||||
public void onResponse(Call<ArrayList<Product>> call, Response<ArrayList<Product>> response) {
|
||||
ArrayList<Product> products = response.body();
|
||||
for (Product product : products){
|
||||
System.out.println(product.getTitle());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<ArrayList<Product>> call, Throwable t) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public Woocommerce(String siteUrl, String apiVerion, String consumerKey, String consumerSecret) {
|
||||
this.siteUrl = siteUrl;
|
||||
this.apiVerion = apiVerion;
|
||||
this.consumerKey = consumerKey;
|
||||
this.consumerSecret = consumerSecret;
|
||||
|
||||
this.baseUrl = siteUrl + "/wp-json/wc/v" + apiVerion + "/";
|
||||
|
||||
productRepository = new ProductRepository(baseUrl, consumerKey, consumerSecret);
|
||||
}
|
||||
|
||||
|
||||
public static class Builder {
|
||||
private String siteUrl;
|
||||
private String apiVerion;
|
||||
private String consumerKey;
|
||||
private String consumerSecret;
|
||||
|
||||
|
||||
public Builder() {
|
||||
}
|
||||
|
||||
public Builder setSiteUrl(String siteUrl) {
|
||||
this.siteUrl = siteUrl;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setApiVersion(String apiVerion) {
|
||||
this.apiVerion = apiVerion;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setConsumerKey(String consumerKey) {
|
||||
this.consumerKey = consumerKey;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Builder setConsumerSecret(String consumerSecret) {
|
||||
this.consumerSecret = consumerSecret;
|
||||
return this;
|
||||
}
|
||||
|
||||
|
||||
public Woocommerce build() {
|
||||
return new Woocommerce(siteUrl, apiVerion, consumerKey, consumerSecret);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Call<ArrayList<Product>> getProducts() {
|
||||
return productRepository.products();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package me.gilo.woodroid.callback;
|
||||
|
||||
import android.arch.lifecycle.LiveData;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.Callback;
|
||||
import retrofit2.Response;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
public class CallBackLiveData<T> extends LiveData<Resource<T>> implements Callback<T> {
|
||||
|
||||
public CallBackLiveData() {
|
||||
setValue(new Resource<>(Status.LOADING));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResponse(Call<T> call, Response<T> response) {
|
||||
if (response.isSuccessful()){
|
||||
setValue(new Resource<>(response.body()));
|
||||
}else{
|
||||
String error = null;
|
||||
try {
|
||||
error = response.errorBody().string();
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
if (error == null){
|
||||
error = "Something went wrong";
|
||||
}
|
||||
setValue(new Resource<>(new NetworkException(error)));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure(Call<T> call, Throwable t) {
|
||||
setValue(new Resource<>( new NetworkException(t)));
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package me.gilo.woodroid.callback;
|
||||
|
||||
public class NetworkException extends Exception{
|
||||
|
||||
public NetworkException() {
|
||||
super();
|
||||
}
|
||||
|
||||
public NetworkException(String message) {
|
||||
super(message);
|
||||
}
|
||||
|
||||
public NetworkException(String message, Throwable cause) {
|
||||
super(message, cause);
|
||||
}
|
||||
|
||||
public NetworkException(Throwable cause) {
|
||||
super(cause);
|
||||
}
|
||||
}
|
||||
79
woodroid/src/main/java/me/gilo/woodroid/callback/Resource.java
Executable file
@ -0,0 +1,79 @@
|
||||
package me.gilo.woodroid.callback;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.Log;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@SuppressWarnings({"WeakerAccess", "ConstantConditions"})
|
||||
public final class Resource<T> {
|
||||
@Nullable
|
||||
private final T data;
|
||||
@Nullable
|
||||
private final Exception error;
|
||||
Status status = Status.LOADING;
|
||||
|
||||
public Resource(@NonNull T data) {
|
||||
this(data, null);
|
||||
}
|
||||
|
||||
public Resource(@NonNull Status status) {
|
||||
this(null, null);
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public Resource(@NonNull Exception exception) {
|
||||
this(null, exception);
|
||||
this.status = Status.ERROR;
|
||||
}
|
||||
|
||||
private Resource(@Nullable T value, @Nullable Exception error) {
|
||||
this.data = value;
|
||||
this.error = error;
|
||||
|
||||
if (error != null){
|
||||
status = Status.ERROR;
|
||||
}else if (data != null){
|
||||
if (data instanceof List){
|
||||
if (((List) data).size() == 0){
|
||||
status = Status.EMPTY;
|
||||
}else {
|
||||
status = status.SUCCESS;
|
||||
}
|
||||
}else {
|
||||
status = Status.SUCCESS;
|
||||
}
|
||||
}else {
|
||||
status = Status.LOADING;
|
||||
}
|
||||
}
|
||||
|
||||
public boolean isSuccessful() {
|
||||
return data != null && error == null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public T data() {
|
||||
if (error != null) {
|
||||
throw new IllegalStateException("error is not null. Call isSuccessful() first.");
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Exception error() {
|
||||
if (data != null) {
|
||||
throw new IllegalStateException("data is not null. Call isSuccessful() first.");
|
||||
}
|
||||
return error;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
public Status status() {
|
||||
return status;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
12
woodroid/src/main/java/me/gilo/woodroid/callback/Status.java
Normal file
@ -0,0 +1,12 @@
|
||||
package me.gilo.woodroid.callback;
|
||||
|
||||
public enum Status {
|
||||
EMPTY,
|
||||
SUCCESS,
|
||||
ERROR,
|
||||
LOADING;
|
||||
|
||||
public Status isLoading(){
|
||||
return LOADING;
|
||||
}
|
||||
}
|
||||
168
woodroid/src/main/java/me/gilo/woodroid/data/API.java
Normal file
@ -0,0 +1,168 @@
|
||||
package me.gilo.woodroid.data;
|
||||
|
||||
|
||||
import me.gilo.woodroid.data.callbacks.*;
|
||||
import me.gilo.woodroid.data.callbacks.Data;
|
||||
import me.gilo.woodroid.models.*;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.*;
|
||||
import rx.Observable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
public interface API {
|
||||
|
||||
@GET
|
||||
Observable<StoreCallback> store(@Url String url);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//products
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@GET("products/categories")
|
||||
Call<ArrayList<Category>> getCategories();
|
||||
|
||||
@GET
|
||||
Call<CategoriesCallback> getCategories2(@Url String url);
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> getProducts();
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> getProducts(@Query("filter[category]") String category);
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> search(@Query("search") String search);
|
||||
|
||||
@GET
|
||||
Call<ReviewsCallback> getProductReviews(@Url String url);
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> filter(@QueryMap Map<String, String> filter);
|
||||
|
||||
@GET("products/{id}")
|
||||
Call<ProductCallback> getRelatedProducts(@Path("id") int id);
|
||||
|
||||
@GET("products/{id}")
|
||||
Call<Product> getProduct(@Path("id") int id);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//orders
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@GET("orders")
|
||||
Observable<OrderCallback> getOrders();
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("orders")
|
||||
Call<OrderData> createOrder(@Body OrderData order);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//customer
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
@GET
|
||||
Observable<OrderCallback> viewMyOrders(@Url String url);
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("customers")
|
||||
Call<CustomerData> registerUser(@Body CustomerData body);
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("customers")
|
||||
Call<Data> registerUser2(@Body Data body);
|
||||
|
||||
@GET
|
||||
Call<Customer> loginUser(@Url String url);
|
||||
|
||||
@GET("customers/email/{email}")
|
||||
Call<Data> loginUser2(@Path("email") String email);
|
||||
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
//Coupons
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
@Headers("Content-Type: application/json")
|
||||
@POST("coupons")
|
||||
Call<Coupon> createCoupon(@Body Coupon body);
|
||||
|
||||
@GET("coupons/{id}")
|
||||
Call<Coupon> viewCoupon(@Path("id") int id);
|
||||
|
||||
@GET("coupons/count")
|
||||
Call<Integer> viewCouponCount();
|
||||
|
||||
@GET("coupons")
|
||||
Observable<Coupon> viewCouponList(@Path("id") int id);
|
||||
|
||||
@PUT("coupons/{id}")
|
||||
Call<Coupon> updateCoupon(@Path("id") int id);
|
||||
|
||||
@DELETE("coupons/{id}")
|
||||
Call<String> deleteCoupon(@Path("id") int id);
|
||||
|
||||
///////////////////////////////////////////////////////////////////////
|
||||
//Cart
|
||||
////////////////////////////////////////////////////////////////////////
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
||||
/coupons
|
||||
/coupons/count
|
||||
/coupons/<id>
|
||||
/coupons/code/<code>
|
||||
/coupons/bulk
|
||||
/customers
|
||||
/customers/count
|
||||
/customers/<id>
|
||||
/customers/email/<email>
|
||||
/customers/<id>/orders
|
||||
/customers/<id>/downloads
|
||||
/customers/bulk
|
||||
/orders
|
||||
/orders/count
|
||||
/orders/statuses
|
||||
/orders/<id>
|
||||
/orders/<order_id>/notes
|
||||
/orders/<order_id>/notes/<id>
|
||||
/orders/<order_id>/refunds
|
||||
/orders/<order_id>/refunds/<id>
|
||||
/orders/bulk
|
||||
/products
|
||||
/products/count
|
||||
/products/<id>
|
||||
/products/<id>/reviews
|
||||
/products/<id>/orders
|
||||
/products/categories
|
||||
/products/categories/<id>
|
||||
/products/tags
|
||||
/products/tags/<id>
|
||||
/products/shipping_classes
|
||||
/products/shipping_classes/<id>
|
||||
/products/attributes
|
||||
/products/attributes/<id>
|
||||
/products/attributes/<attribute_id>/terms
|
||||
/products/attributes/<attribute_id>/terms/<id>
|
||||
/products/bulk
|
||||
/reports
|
||||
/reports/sales
|
||||
/reports/sales/top_sellers
|
||||
/taxes
|
||||
/taxes/count
|
||||
/taxes/<id>
|
||||
/taxes/classes
|
||||
/taxes/classes/count
|
||||
/taxes/classes/<slug>
|
||||
/taxes/bulk
|
||||
/webhooks
|
||||
/webhooks/count
|
||||
/webhooks/<id>
|
||||
/webhooks/<webhook_id>/deliveries
|
||||
/webhooks/<webhook_id>/deliveries/<id>
|
||||
|
||||
*/
|
||||
|
||||
}
|
||||
70
woodroid/src/main/java/me/gilo/woodroid/data/ProductAPI.java
Normal file
@ -0,0 +1,70 @@
|
||||
package me.gilo.woodroid.data;
|
||||
|
||||
|
||||
import me.gilo.woodroid.data.callbacks.*;
|
||||
import me.gilo.woodroid.data.callbacks.Data;
|
||||
import me.gilo.woodroid.models.*;
|
||||
import retrofit2.Call;
|
||||
import retrofit2.http.*;
|
||||
import rx.Observable;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Map;
|
||||
|
||||
public interface ProductAPI {
|
||||
|
||||
|
||||
@GET("products/categories")
|
||||
Call<ArrayList<Category>> getCategories();
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> getProducts();
|
||||
|
||||
@GET("products/{id}")
|
||||
Call<Product> getProduct(@Path("id") int id);
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> getProducts(@Query("filter[category]") String category);
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> search(@Query("search") String search);
|
||||
|
||||
@GET("products")
|
||||
Call<ArrayList<Product>> filter(@QueryMap Map<String, String> filter);
|
||||
|
||||
@GET("products/{id}")
|
||||
Call<ProductCallback> getRelatedProducts(@Path("id") int id);
|
||||
|
||||
|
||||
@GET("products/count")
|
||||
Call<ArrayList<Product>> getProductsCount();
|
||||
|
||||
@GET("products/{id}/reviews")
|
||||
Call<ReviewsCallback> getProductReviews(@Path("id") int id);
|
||||
|
||||
@GET("products/{id}/orders")
|
||||
Call<ReviewsCallback> getProductOrders(@Path("id") int id);
|
||||
|
||||
|
||||
|
||||
|
||||
/*
|
||||
/products
|
||||
/products/count
|
||||
/products/<id>
|
||||
/products/<id>/reviews
|
||||
/products/<id>/orders
|
||||
/products/categories
|
||||
/products/categories/<id>
|
||||
/products/tags
|
||||
/products/tags/<id>
|
||||
/products/shipping_classes
|
||||
/products/shipping_classes/<id>
|
||||
/products/attributes
|
||||
/products/attributes/<id>
|
||||
/products/attributes/<attribute_id>/terms
|
||||
/products/attributes/<attribute_id>/terms/<id>
|
||||
/products/bulk
|
||||
*/
|
||||
|
||||
}
|
||||
227
woodroid/src/main/java/me/gilo/woodroid/data/RestAdapter.java
Normal file
@ -0,0 +1,227 @@
|
||||
package me.gilo.woodroid.data;
|
||||
|
||||
import android.util.Base64;
|
||||
import android.util.Log;
|
||||
|
||||
import okhttp3.HttpUrl;
|
||||
import okhttp3.Interceptor;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
|
||||
import org.apache.http.NameValuePair;
|
||||
import org.apache.http.client.utils.URLEncodedUtils;
|
||||
import org.apache.http.message.BasicNameValuePair;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.MalformedURLException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.net.URLEncoder;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import javax.crypto.Mac;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
|
||||
import okhttp3.logging.HttpLoggingInterceptor;
|
||||
import retrofit2.Retrofit;
|
||||
import retrofit2.converter.gson.GsonConverterFactory;
|
||||
|
||||
public class RestAdapter {
|
||||
|
||||
static String oauth_nonce = "";
|
||||
static String oauth_timestamp = "";
|
||||
static String oauth_signature_method = "HMAC-SHA1";
|
||||
|
||||
static ArrayList<NameValuePair> params;
|
||||
|
||||
private String baseUrl;
|
||||
private String consumerKey;
|
||||
private String consumerSecret;
|
||||
|
||||
public RestAdapter(String baseUrl, String consumerKey, String consumerSecret) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.consumerKey = consumerKey;
|
||||
this.consumerSecret = consumerSecret;
|
||||
}
|
||||
|
||||
public API createAPI(final String endpoint) {
|
||||
return createAPI(endpoint, null);
|
||||
}
|
||||
|
||||
public API createAPI(final String endpoint, Map<String, String> query) {
|
||||
|
||||
if (query != null) {
|
||||
setParams(endpoint, query);
|
||||
}else{
|
||||
setParams(endpoint);
|
||||
}
|
||||
|
||||
// Define the interceptor, add authentication headers
|
||||
Interceptor interceptor = chain -> {
|
||||
|
||||
HttpUrl.Builder builder = chain.request().url().newBuilder();
|
||||
for (NameValuePair entry : params) {
|
||||
builder.addQueryParameter(entry.getName(), entry.getValue());
|
||||
}
|
||||
|
||||
Request newRequest = chain.request()
|
||||
.newBuilder()
|
||||
.url(builder.build())
|
||||
.header("Accept", "application/json")
|
||||
.build();
|
||||
|
||||
return chain.proceed(newRequest);
|
||||
};
|
||||
|
||||
HttpLoggingInterceptor loggingInterceptor = new HttpLoggingInterceptor();
|
||||
loggingInterceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||
|
||||
OkHttpClient client = new OkHttpClient.Builder()
|
||||
.addInterceptor(interceptor)
|
||||
.addInterceptor(loggingInterceptor)
|
||||
.readTimeout(30, TimeUnit.SECONDS)
|
||||
.writeTimeout(30, TimeUnit.SECONDS)
|
||||
.connectTimeout(15, TimeUnit.SECONDS)
|
||||
.build();
|
||||
|
||||
Retrofit retrofit = new Retrofit.Builder()
|
||||
.baseUrl(baseUrl)
|
||||
//.addCallAdapterFactory(RxJavaCallAdapterFactory.create())
|
||||
.addConverterFactory(GsonConverterFactory.create())
|
||||
.client(client)
|
||||
.build();
|
||||
|
||||
return retrofit.create(API.class);
|
||||
}
|
||||
|
||||
public ArrayList<NameValuePair> setParams(String endpoint) {
|
||||
final String uri = baseUrl + endpoint;
|
||||
|
||||
URI uri1 = URI.create(baseUrl + endpoint);
|
||||
String urlString = "";
|
||||
try {
|
||||
URL url = uri1.toURL();
|
||||
urlString = url.toString();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
oauth_nonce = getOauth_nonce();
|
||||
oauth_timestamp = getOauth_timestamp();
|
||||
|
||||
params = new ArrayList<>();
|
||||
params.add(new BasicNameValuePair("oauth_consumer_key", consumerKey));
|
||||
params.add(new BasicNameValuePair("oauth_nonce", oauth_nonce));
|
||||
params.add(new BasicNameValuePair("oauth_timestamp", oauth_timestamp));
|
||||
params.add(new BasicNameValuePair("oauth_signature_method", oauth_signature_method));
|
||||
|
||||
Collections.sort(params, new SortParams());
|
||||
|
||||
String encodedParams = URLEncodedUtils.format(params, "utf-8");
|
||||
|
||||
String string_to_sign = "";
|
||||
try {
|
||||
string_to_sign = (new StringBuilder("GET&")).append(URLEncoder.encode(uri, "utf-8")).append("&").append(URLEncoder.encode(encodedParams, "utf-8")).toString();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Mac mac = Mac.getInstance("HMAC-SHA1");
|
||||
String secret = consumerSecret + "&";
|
||||
|
||||
mac.init(new SecretKeySpec(secret.getBytes("utf-8"), "HMAC-SHA1"));
|
||||
String signature = Base64.encodeToString(mac.doFinal(string_to_sign.getBytes("utf-8")), 0).trim();
|
||||
params.add(new BasicNameValuePair("oauth_signature", signature));
|
||||
} catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
public ArrayList<NameValuePair> setParams(String endpoint, Map<String, String> query) {
|
||||
final String uri = baseUrl + endpoint;
|
||||
|
||||
URI uri1 = URI.create(baseUrl + endpoint);
|
||||
String urlString = "";
|
||||
try {
|
||||
URL url = uri1.toURL();
|
||||
urlString = url.toString();
|
||||
} catch (MalformedURLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
oauth_nonce = getOauth_nonce();
|
||||
oauth_timestamp = getOauth_timestamp();
|
||||
|
||||
params = new ArrayList<>();
|
||||
|
||||
Iterator it = query.entrySet().iterator();
|
||||
while (it.hasNext()) {
|
||||
Map.Entry pair = (Map.Entry)it.next();
|
||||
params.add(new BasicNameValuePair((String) pair.getKey(), (String) pair.getValue()));
|
||||
|
||||
it.remove();
|
||||
}
|
||||
|
||||
params.add(new BasicNameValuePair("oauth_consumer_key", consumerKey));
|
||||
params.add(new BasicNameValuePair("oauth_nonce", oauth_nonce));
|
||||
params.add(new BasicNameValuePair("oauth_timestamp", oauth_timestamp));
|
||||
params.add(new BasicNameValuePair("oauth_signature_method", oauth_signature_method));
|
||||
|
||||
Collections.sort(params, new SortParams());
|
||||
|
||||
String encodedParams = URLEncodedUtils.format(params, "utf-8");
|
||||
|
||||
String string_to_sign = "";
|
||||
try {
|
||||
string_to_sign = (new StringBuilder("GET&")).append(URLEncoder.encode(uri, "utf-8")).append("&").append(URLEncoder.encode(encodedParams, "utf-8")).toString();
|
||||
} catch (UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
try {
|
||||
Mac mac = Mac.getInstance("HMAC-SHA1");
|
||||
String secret = consumerSecret;
|
||||
//if (API.WP_API_VERSION.equals("3")) {
|
||||
secret = consumerSecret + "&";
|
||||
//}
|
||||
mac.init(new SecretKeySpec(secret.getBytes("utf-8"), "HMAC-SHA1"));
|
||||
String signature = Base64.encodeToString(mac.doFinal(string_to_sign.getBytes("utf-8")), 0).trim();
|
||||
params.add(new BasicNameValuePair("oauth_signature", signature));
|
||||
} catch (NoSuchAlgorithmException | InvalidKeyException | UnsupportedEncodingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return params;
|
||||
}
|
||||
|
||||
public static String getOauth_nonce() {
|
||||
return (new StringBuilder(String.valueOf(Math.random() * 100000000D))).toString();
|
||||
}
|
||||
|
||||
public static String getOauth_timestamp() {
|
||||
long stamp = (long) (System.currentTimeMillis() / 1000D);
|
||||
return (new StringBuilder(String.valueOf(stamp))).toString();
|
||||
}
|
||||
|
||||
static class SortParams implements Comparator<NameValuePair> {
|
||||
|
||||
@Override
|
||||
public int compare(NameValuePair nameValuePair1, NameValuePair nameValuePair2) {
|
||||
return nameValuePair1.getName().compareTo(nameValuePair2.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,25 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import me.gilo.woodroid.models.Category;
|
||||
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/8/2015.
|
||||
*/
|
||||
public class CategoriesCallback {
|
||||
@SerializedName("product_categories")
|
||||
ArrayList<Category> categories;
|
||||
|
||||
public ArrayList<Category> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
public void setCategories(ArrayList<Category> categories) {
|
||||
this.categories = categories;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
|
||||
import me.gilo.woodroid.models.Customer;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/13/2015.
|
||||
*/
|
||||
public class CustomerData {
|
||||
Customer customer;
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
import me.gilo.woodroid.models.Order;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/12/2015.
|
||||
*/
|
||||
public class Data {
|
||||
Order order;
|
||||
|
||||
public Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Order order) {
|
||||
this.order = order;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
|
||||
import me.gilo.woodroid.models.Order;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
public class OrderCallback {
|
||||
ArrayList<Order> orders = new ArrayList<>();
|
||||
|
||||
public ArrayList<Order> getOrders() {
|
||||
return orders;
|
||||
}
|
||||
|
||||
public void setOrders(ArrayList<Order> orders) {
|
||||
this.orders = orders;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,31 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
|
||||
import me.gilo.woodroid.models.Product;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Aron on 11/10/2015.
|
||||
*/
|
||||
public class ProductCallback {
|
||||
ArrayList<Product> products = new ArrayList<>();
|
||||
Product product;
|
||||
|
||||
public ArrayList<Product> getProducts() {
|
||||
return products;
|
||||
}
|
||||
|
||||
public void setProducts(ArrayList<Product> products) {
|
||||
this.products = products;
|
||||
}
|
||||
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(Product product) {
|
||||
this.product = product;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,19 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
|
||||
import me.gilo.woodroid.models.Product;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/14/2015.
|
||||
*/
|
||||
public class ProductData {
|
||||
private Product product;
|
||||
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(Product product) {
|
||||
this.product = product;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import me.gilo.woodroid.models.ProductReview;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/8/2015.
|
||||
*/
|
||||
public class ReviewsCallback {
|
||||
@SerializedName("product_reviews")
|
||||
ArrayList<ProductReview> productReviews;
|
||||
|
||||
public ArrayList<ProductReview> getProductReviews() {
|
||||
return productReviews;
|
||||
}
|
||||
|
||||
public void setProductReviews(ArrayList<ProductReview> productReviews) {
|
||||
this.productReviews = productReviews;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
|
||||
import me.gilo.woodroid.models.ProductReview;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/14/2015.
|
||||
*/
|
||||
public class ReviewsData {
|
||||
ArrayList<ProductReview> productReviews;
|
||||
|
||||
public ArrayList<ProductReview> getProductReviews() {
|
||||
return productReviews;
|
||||
}
|
||||
|
||||
public void setProductReviews(ArrayList<ProductReview> productReviews) {
|
||||
this.productReviews = productReviews;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package me.gilo.woodroid.data.callbacks;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
import me.gilo.woodroid.models.Store;
|
||||
|
||||
/**
|
||||
* Created by Aron on 2/20/2016.
|
||||
*/
|
||||
public class StoreCallback {
|
||||
|
||||
@SerializedName("store")
|
||||
Store store;
|
||||
|
||||
public Store getStore() {
|
||||
return store;
|
||||
}
|
||||
|
||||
public void setStore(Store store) {
|
||||
this.store = store;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,75 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Aron on 11/26/2015.
|
||||
*/
|
||||
public class Attribute implements Serializable {
|
||||
private String name;
|
||||
private String slug;
|
||||
private int position;
|
||||
private boolean visible;
|
||||
private boolean variation;
|
||||
private String[] options;
|
||||
|
||||
protected Attribute(Parcel in) {
|
||||
name = in.readString();
|
||||
slug = in.readString();
|
||||
position = in.readInt();
|
||||
visible = in.readByte() != 0;
|
||||
variation = in.readByte() != 0;
|
||||
options = in.createStringArray();
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSlug() {
|
||||
return slug;
|
||||
}
|
||||
|
||||
public void setSlug(String slug) {
|
||||
this.slug = slug;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return visible;
|
||||
}
|
||||
|
||||
public void setVisible(boolean visible) {
|
||||
this.visible = visible;
|
||||
}
|
||||
|
||||
public boolean isVariation() {
|
||||
return variation;
|
||||
}
|
||||
|
||||
public void setVariation(boolean variation) {
|
||||
this.variation = variation;
|
||||
}
|
||||
|
||||
public String[] getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(String[] options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,123 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
public class BillingAddress implements Serializable{
|
||||
public int id;
|
||||
@SerializedName("first_name")
|
||||
public String firstName;
|
||||
@SerializedName("last_name")
|
||||
public String lastName;
|
||||
public String company;
|
||||
@SerializedName("address_1")
|
||||
public String address1;
|
||||
@SerializedName("address_2")
|
||||
public String address2;
|
||||
public String city;
|
||||
public String state;
|
||||
public String postcode;
|
||||
public String country;
|
||||
public String email;
|
||||
public String phone;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
this.company = company;
|
||||
}
|
||||
|
||||
public String getAddress1() {
|
||||
return address1;
|
||||
}
|
||||
|
||||
public void setAddress1(String address1) {
|
||||
this.address1 = address1;
|
||||
}
|
||||
|
||||
public String getAddress2() {
|
||||
return address2;
|
||||
}
|
||||
|
||||
public void setAddress2(String address2) {
|
||||
this.address2 = address2;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getPostcode() {
|
||||
return postcode;
|
||||
}
|
||||
|
||||
public void setPostcode(String postcode) {
|
||||
this.postcode = postcode;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getPhone() {
|
||||
return phone;
|
||||
}
|
||||
|
||||
public void setPhone(String phone) {
|
||||
this.phone = phone;
|
||||
}
|
||||
}
|
||||
36
woodroid/src/main/java/me/gilo/woodroid/models/CartItem.java
Normal file
@ -0,0 +1,36 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by gilo on 2/18/16.
|
||||
*/
|
||||
public class CartItem {
|
||||
Product product;
|
||||
ArrayList<Option> options;
|
||||
int qty;
|
||||
|
||||
public Product getProduct() {
|
||||
return product;
|
||||
}
|
||||
|
||||
public void setProduct(Product product) {
|
||||
this.product = product;
|
||||
}
|
||||
|
||||
public ArrayList<Option> getOptions() {
|
||||
return options;
|
||||
}
|
||||
|
||||
public void setOptions(ArrayList<Option> options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
public int getQty() {
|
||||
return qty;
|
||||
}
|
||||
|
||||
public void setQty(int qty) {
|
||||
this.qty = qty;
|
||||
}
|
||||
}
|
||||
90
woodroid/src/main/java/me/gilo/woodroid/models/Category.java
Normal file
@ -0,0 +1,90 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/8/2015.
|
||||
*/
|
||||
public class Category implements Serializable{
|
||||
private int id;
|
||||
private String name;
|
||||
private String slug;
|
||||
int parent;
|
||||
String description;
|
||||
String display;
|
||||
Image image;
|
||||
int menu_order;
|
||||
int count;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSlug() {
|
||||
return slug;
|
||||
}
|
||||
|
||||
public void setSlug(String slug) {
|
||||
this.slug = slug;
|
||||
}
|
||||
|
||||
public int getParent() {
|
||||
return parent;
|
||||
}
|
||||
|
||||
public void setParent(int parent) {
|
||||
this.parent = parent;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getDisplay() {
|
||||
return display;
|
||||
}
|
||||
|
||||
public void setDisplay(String display) {
|
||||
this.display = display;
|
||||
}
|
||||
|
||||
public Image getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public void setImage(Image image) {
|
||||
this.image = image;
|
||||
}
|
||||
|
||||
public int getMenu_order() {
|
||||
return menu_order;
|
||||
}
|
||||
|
||||
public void setMenu_order(int menu_order) {
|
||||
this.menu_order = menu_order;
|
||||
}
|
||||
|
||||
public int getCount() {
|
||||
return count;
|
||||
}
|
||||
|
||||
public void setCount(int count) {
|
||||
this.count = count;
|
||||
}
|
||||
}
|
||||
171
woodroid/src/main/java/me/gilo/woodroid/models/Coupon.java
Normal file
@ -0,0 +1,171 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Aron on 1/24/2016.
|
||||
*/
|
||||
public class Coupon implements Serializable{
|
||||
private String[] customer_emails;
|
||||
|
||||
private double maximum_amount;
|
||||
private int usage_limit_per_user;
|
||||
private String exclude_sale_items;
|
||||
private String code;
|
||||
private boolean individual_use;
|
||||
private String type;
|
||||
private int[] product_ids;
|
||||
private int amount;
|
||||
private int limit_usage_to_x_items;
|
||||
private int[] product_category_ids;
|
||||
private String description;
|
||||
private double minimum_amount;
|
||||
private String expiry_date;
|
||||
private int[] exclude_product_ids;
|
||||
private boolean enable_free_shipping;
|
||||
private int[] exclude_product_category_ids;
|
||||
private int usage_limit;
|
||||
public String[] getCustomer_emails() {
|
||||
return customer_emails;
|
||||
}
|
||||
|
||||
public void setCustomer_emails(String[] customer_emails) {
|
||||
this.customer_emails = customer_emails;
|
||||
}
|
||||
|
||||
public double getMaximum_amount() {
|
||||
return maximum_amount;
|
||||
}
|
||||
|
||||
public void setMaximum_amount(double maximum_amount) {
|
||||
this.maximum_amount = maximum_amount;
|
||||
}
|
||||
|
||||
public int getUsage_limit_per_user() {
|
||||
return usage_limit_per_user;
|
||||
}
|
||||
|
||||
public void setUsage_limit_per_user(int usage_limit_per_user) {
|
||||
this.usage_limit_per_user = usage_limit_per_user;
|
||||
}
|
||||
|
||||
public String getExclude_sale_items() {
|
||||
return exclude_sale_items;
|
||||
}
|
||||
|
||||
public void setExclude_sale_items(String exclude_sale_items) {
|
||||
this.exclude_sale_items = exclude_sale_items;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public boolean isIndividual_use() {
|
||||
return individual_use;
|
||||
}
|
||||
|
||||
public void setIndividual_use(boolean individual_use) {
|
||||
this.individual_use = individual_use;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public int[] getProduct_ids() {
|
||||
return product_ids;
|
||||
}
|
||||
|
||||
public void setProduct_ids(int[] product_ids) {
|
||||
this.product_ids = product_ids;
|
||||
}
|
||||
|
||||
public int getAmount() {
|
||||
return amount;
|
||||
}
|
||||
|
||||
public void setAmount(int amount) {
|
||||
this.amount = amount;
|
||||
}
|
||||
|
||||
public int getLimit_usage_to_x_items() {
|
||||
return limit_usage_to_x_items;
|
||||
}
|
||||
|
||||
public void setLimit_usage_to_x_items(int limit_usage_to_x_items) {
|
||||
this.limit_usage_to_x_items = limit_usage_to_x_items;
|
||||
}
|
||||
|
||||
public int[] getProduct_category_ids() {
|
||||
return product_category_ids;
|
||||
}
|
||||
|
||||
public void setProduct_category_ids(int[] product_category_ids) {
|
||||
this.product_category_ids = product_category_ids;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public double getMinimum_amount() {
|
||||
return minimum_amount;
|
||||
}
|
||||
|
||||
public void setMinimum_amount(double minimum_amount) {
|
||||
this.minimum_amount = minimum_amount;
|
||||
}
|
||||
|
||||
public String getExpiry_date() {
|
||||
return expiry_date;
|
||||
}
|
||||
|
||||
public void setExpiry_date(String expiry_date) {
|
||||
this.expiry_date = expiry_date;
|
||||
}
|
||||
|
||||
public int[] getExclude_product_ids() {
|
||||
return exclude_product_ids;
|
||||
}
|
||||
|
||||
public void setExclude_product_ids(int[] exclude_product_ids) {
|
||||
this.exclude_product_ids = exclude_product_ids;
|
||||
}
|
||||
|
||||
public boolean isEnable_free_shipping() {
|
||||
return enable_free_shipping;
|
||||
}
|
||||
|
||||
public void setEnable_free_shipping(boolean enable_free_shipping) {
|
||||
this.enable_free_shipping = enable_free_shipping;
|
||||
}
|
||||
|
||||
public int[] getExclude_product_category_ids() {
|
||||
return exclude_product_category_ids;
|
||||
}
|
||||
|
||||
public void setExclude_product_category_ids(int[] exclude_product_category_ids) {
|
||||
this.exclude_product_category_ids = exclude_product_category_ids;
|
||||
}
|
||||
|
||||
public int getUsage_limit() {
|
||||
return usage_limit;
|
||||
}
|
||||
|
||||
public void setUsage_limit(int usage_limit) {
|
||||
this.usage_limit = usage_limit;
|
||||
}
|
||||
}
|
||||
157
woodroid/src/main/java/me/gilo/woodroid/models/Customer.java
Normal file
@ -0,0 +1,157 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
|
||||
public class Customer implements Serializable{
|
||||
public int id;
|
||||
@SerializedName("created_at")
|
||||
public String createdAt;
|
||||
public String email;
|
||||
@SerializedName("first_name")
|
||||
public String firstName;
|
||||
@SerializedName("last_name")
|
||||
public String lastName;
|
||||
public String username;
|
||||
public String password;
|
||||
public String role;
|
||||
@SerializedName("last_order_id")
|
||||
public String lastOrderId;
|
||||
@SerializedName("last_order_date")
|
||||
public String lastOrderDate;
|
||||
@SerializedName("orders_count")
|
||||
public int ordersCount;
|
||||
@SerializedName("total_spent")
|
||||
public String totalSpent;
|
||||
@SerializedName("avatar_url")
|
||||
public String avatarUrl;
|
||||
@SerializedName("billing_address")
|
||||
public BillingAddress billingAddress;
|
||||
@SerializedName("shipping_address")
|
||||
public ShippingAddress shippingAddress;
|
||||
|
||||
public String getPassword() {
|
||||
return password;
|
||||
}
|
||||
|
||||
public void setPassword(String password) {
|
||||
this.password = password;
|
||||
}
|
||||
|
||||
public ShippingAddress getShippingAddress() {
|
||||
return shippingAddress;
|
||||
}
|
||||
|
||||
public void setShippingAddress(ShippingAddress shippingAddress) {
|
||||
this.shippingAddress = shippingAddress;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(String createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getUsername() {
|
||||
return username;
|
||||
}
|
||||
|
||||
public void setUsername(String username) {
|
||||
this.username = username;
|
||||
}
|
||||
|
||||
public String getRole() {
|
||||
return role;
|
||||
}
|
||||
|
||||
public void setRole(String role) {
|
||||
this.role = role;
|
||||
}
|
||||
|
||||
public String getLastOrderId() {
|
||||
return lastOrderId;
|
||||
}
|
||||
|
||||
public void setLastOrderId(String lastOrderId) {
|
||||
this.lastOrderId = lastOrderId;
|
||||
}
|
||||
|
||||
public String getLastOrderDate() {
|
||||
return lastOrderDate;
|
||||
}
|
||||
|
||||
public void setLastOrderDate(String lastOrderDate) {
|
||||
this.lastOrderDate = lastOrderDate;
|
||||
}
|
||||
|
||||
public int getOrdersCount() {
|
||||
return ordersCount;
|
||||
}
|
||||
|
||||
public void setOrdersCount(int ordersCount) {
|
||||
this.ordersCount = ordersCount;
|
||||
}
|
||||
|
||||
public String getTotalSpent() {
|
||||
return totalSpent;
|
||||
}
|
||||
|
||||
public void setTotalSpent(String totalSpent) {
|
||||
this.totalSpent = totalSpent;
|
||||
}
|
||||
|
||||
public String getAvatarUrl() {
|
||||
return avatarUrl;
|
||||
}
|
||||
|
||||
public void setAvatarUrl(String avatarUrl) {
|
||||
this.avatarUrl = avatarUrl;
|
||||
}
|
||||
|
||||
public BillingAddress getBillingAddress() {
|
||||
return billingAddress;
|
||||
}
|
||||
|
||||
public void setBillingAddress(BillingAddress billingAddress) {
|
||||
this.billingAddress = billingAddress;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/11/2015.
|
||||
*/
|
||||
public class CustomerPost implements Serializable{
|
||||
@SerializedName("data")
|
||||
ArrayList<Data> datas;
|
||||
|
||||
public ArrayList<Data> getDatas() {
|
||||
return datas;
|
||||
}
|
||||
|
||||
public void setDatas(ArrayList<Data> datas) {
|
||||
this.datas = datas;
|
||||
}
|
||||
}
|
||||
16
woodroid/src/main/java/me/gilo/woodroid/models/Data.java
Normal file
@ -0,0 +1,16 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/11/2015.
|
||||
*/
|
||||
public class Data {
|
||||
Customer customer;
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Aron on 11/26/2015.
|
||||
*/
|
||||
public class DefaultAttribute implements Serializable {
|
||||
int id;
|
||||
String name;
|
||||
String option;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getOption() {
|
||||
return option;
|
||||
}
|
||||
|
||||
public void setOption(String option) {
|
||||
this.option = option;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,56 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* Created by Aron on 11/10/2015.
|
||||
*/
|
||||
public class Dimension implements Serializable {
|
||||
|
||||
private String length;
|
||||
private String width;
|
||||
private String height;
|
||||
private String unit;
|
||||
|
||||
protected Dimension(Parcel in) {
|
||||
length = in.readString();
|
||||
width = in.readString();
|
||||
height = in.readString();
|
||||
unit = in.readString();
|
||||
}
|
||||
|
||||
public String getLength() {
|
||||
return length;
|
||||
}
|
||||
|
||||
public void setLength(String length) {
|
||||
this.length = length;
|
||||
}
|
||||
|
||||
public String getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public void setWidth(String width) {
|
||||
this.width = width;
|
||||
}
|
||||
|
||||
public String getHeight() {
|
||||
return height;
|
||||
}
|
||||
|
||||
public void setHeight(String height) {
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public String getUnit() {
|
||||
return unit;
|
||||
}
|
||||
|
||||
public void setUnit(String unit) {
|
||||
this.unit = unit;
|
||||
}
|
||||
|
||||
}
|
||||
33
woodroid/src/main/java/me/gilo/woodroid/models/Download.java
Normal file
@ -0,0 +1,33 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Download implements Serializable {
|
||||
String id;
|
||||
String name;
|
||||
String file;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getFile() {
|
||||
return file;
|
||||
}
|
||||
|
||||
public void setFile(String file) {
|
||||
this.file = file;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,7 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/8/2015.
|
||||
*/
|
||||
public class FeeLine {
|
||||
}
|
||||
93
woodroid/src/main/java/me/gilo/woodroid/models/Image.java
Normal file
@ -0,0 +1,93 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import android.os.Parcel;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by Aron on 11/23/2015.
|
||||
*/
|
||||
public class Image implements Serializable{
|
||||
private int id;
|
||||
private String date_created;
|
||||
private String date_created_gmt;
|
||||
private String date_modified;
|
||||
private String date_modified_gmt;
|
||||
private String src;
|
||||
private String name;
|
||||
private String alt;
|
||||
private int position;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getDate_created() {
|
||||
return date_created;
|
||||
}
|
||||
|
||||
public void setDate_created(String date_created) {
|
||||
this.date_created = date_created;
|
||||
}
|
||||
|
||||
public String getDate_created_gmt() {
|
||||
return date_created_gmt;
|
||||
}
|
||||
|
||||
public void setDate_created_gmt(String date_created_gmt) {
|
||||
this.date_created_gmt = date_created_gmt;
|
||||
}
|
||||
|
||||
public String getDate_modified() {
|
||||
return date_modified;
|
||||
}
|
||||
|
||||
public void setDate_modified(String date_modified) {
|
||||
this.date_modified = date_modified;
|
||||
}
|
||||
|
||||
public String getDate_modified_gmt() {
|
||||
return date_modified_gmt;
|
||||
}
|
||||
|
||||
public void setDate_modified_gmt(String date_modified_gmt) {
|
||||
this.date_modified_gmt = date_modified_gmt;
|
||||
}
|
||||
|
||||
public String getSrc() {
|
||||
return src;
|
||||
}
|
||||
|
||||
public void setSrc(String src) {
|
||||
this.src = src;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getAlt() {
|
||||
return alt;
|
||||
}
|
||||
|
||||
public void setAlt(String alt) {
|
||||
this.alt = alt;
|
||||
}
|
||||
|
||||
public int getPosition() {
|
||||
return position;
|
||||
}
|
||||
|
||||
public void setPosition(int position) {
|
||||
this.position = position;
|
||||
}
|
||||
}
|
||||
131
woodroid/src/main/java/me/gilo/woodroid/models/LineItem.java
Normal file
@ -0,0 +1,131 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
public class LineItem {
|
||||
@SerializedName("product_id")
|
||||
public int id;
|
||||
public String subtotal;
|
||||
@SerializedName("subtotal_tax")
|
||||
public String subtotalTax;
|
||||
public String total;
|
||||
public String totalTax;
|
||||
public String price;
|
||||
public int quantity;
|
||||
public Object taxClass;
|
||||
public String name;
|
||||
public int productId;
|
||||
public String sku;
|
||||
public String variations;
|
||||
public List<Metum> meta = new ArrayList<Metum>();
|
||||
|
||||
public String getVariations() {
|
||||
return variations;
|
||||
}
|
||||
|
||||
public void setVariations(String variations) {
|
||||
this.variations = variations;
|
||||
}
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getSubtotal() {
|
||||
return subtotal;
|
||||
}
|
||||
|
||||
public void setSubtotal(String subtotal) {
|
||||
this.subtotal = subtotal;
|
||||
}
|
||||
|
||||
public String getSubtotalTax() {
|
||||
return subtotalTax;
|
||||
}
|
||||
|
||||
public void setSubtotalTax(String subtotalTax) {
|
||||
this.subtotalTax = subtotalTax;
|
||||
}
|
||||
|
||||
public String getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(String total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getTotalTax() {
|
||||
return totalTax;
|
||||
}
|
||||
|
||||
public void setTotalTax(String totalTax) {
|
||||
this.totalTax = totalTax;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public Object getTaxClass() {
|
||||
return taxClass;
|
||||
}
|
||||
|
||||
public void setTaxClass(Object taxClass) {
|
||||
this.taxClass = taxClass;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public int getProductId() {
|
||||
return productId;
|
||||
}
|
||||
|
||||
public void setProductId(int productId) {
|
||||
this.productId = productId;
|
||||
}
|
||||
|
||||
public String getSku() {
|
||||
return sku;
|
||||
}
|
||||
|
||||
public void setSku(String sku) {
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public List<Metum> getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setMeta(List<Metum> meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,45 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/8/2015.
|
||||
*/
|
||||
public class Line_item {
|
||||
private int product_id;
|
||||
private int quantity;
|
||||
private String variations;
|
||||
|
||||
public Line_item(int product_id, int quantity, String variations) {
|
||||
this.product_id = product_id;
|
||||
this.quantity = quantity;
|
||||
this.variations = variations;
|
||||
}
|
||||
|
||||
public Line_item(int product_id, int quantity) {
|
||||
this.product_id = product_id;
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public int getProduct_id() {
|
||||
return product_id;
|
||||
}
|
||||
|
||||
public void setProduct_id(int product_id) {
|
||||
this.product_id = product_id;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
|
||||
public String getVariations() {
|
||||
return variations;
|
||||
}
|
||||
|
||||
public void setVariations(String variations) {
|
||||
this.variations = variations;
|
||||
}
|
||||
}
|
||||
130
woodroid/src/main/java/me/gilo/woodroid/models/Meta.java
Normal file
@ -0,0 +1,130 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by gilo on 1/19/16.
|
||||
*/
|
||||
public class Meta {
|
||||
|
||||
private String thousand_separator;
|
||||
private String decimal_separator;
|
||||
private String currency_position;
|
||||
private String weight_unit;
|
||||
private String currency;
|
||||
private String timezone;
|
||||
private boolean generate_password;
|
||||
private int price_num_decimals;
|
||||
private boolean tax_included;
|
||||
private boolean ssl_enabled;
|
||||
private boolean permalinks_enabled;
|
||||
private String dimension_unit;
|
||||
private String currency_format;
|
||||
|
||||
public String getThousand_separator() {
|
||||
return thousand_separator;
|
||||
}
|
||||
|
||||
public void setThousand_separator(String thousand_separator) {
|
||||
this.thousand_separator = thousand_separator;
|
||||
}
|
||||
|
||||
public String getDecimal_separator() {
|
||||
return decimal_separator;
|
||||
}
|
||||
|
||||
public void setDecimal_separator(String decimal_separator) {
|
||||
this.decimal_separator = decimal_separator;
|
||||
}
|
||||
|
||||
public String getCurrency_position() {
|
||||
return currency_position;
|
||||
}
|
||||
|
||||
public void setCurrency_position(String currency_position) {
|
||||
this.currency_position = currency_position;
|
||||
}
|
||||
|
||||
public String getWeight_unit() {
|
||||
return weight_unit;
|
||||
}
|
||||
|
||||
public void setWeight_unit(String weight_unit) {
|
||||
this.weight_unit = weight_unit;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public void setCurrency(String currency) {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public String getTimezone() {
|
||||
return timezone;
|
||||
}
|
||||
|
||||
public void setTimezone(String timezone) {
|
||||
this.timezone = timezone;
|
||||
}
|
||||
|
||||
public boolean isGenerate_password() {
|
||||
return generate_password;
|
||||
}
|
||||
|
||||
public void setGenerate_password(boolean generate_password) {
|
||||
this.generate_password = generate_password;
|
||||
}
|
||||
|
||||
public int getPrice_num_decimals() {
|
||||
return price_num_decimals;
|
||||
}
|
||||
|
||||
public void setPrice_num_decimals(int price_num_decimals) {
|
||||
this.price_num_decimals = price_num_decimals;
|
||||
}
|
||||
|
||||
public boolean isTax_included() {
|
||||
return tax_included;
|
||||
}
|
||||
|
||||
public void setTax_included(boolean tax_included) {
|
||||
this.tax_included = tax_included;
|
||||
}
|
||||
|
||||
public boolean isSsl_enabled() {
|
||||
return ssl_enabled;
|
||||
}
|
||||
|
||||
public void setSsl_enabled(boolean ssl_enabled) {
|
||||
this.ssl_enabled = ssl_enabled;
|
||||
}
|
||||
|
||||
public boolean isPermalinks_enabled() {
|
||||
return permalinks_enabled;
|
||||
}
|
||||
|
||||
public void setPermalinks_enabled(boolean permalinks_enabled) {
|
||||
this.permalinks_enabled = permalinks_enabled;
|
||||
}
|
||||
|
||||
public String getDimension_unit() {
|
||||
return dimension_unit;
|
||||
}
|
||||
|
||||
public void setDimension_unit(String dimension_unit) {
|
||||
this.dimension_unit = dimension_unit;
|
||||
}
|
||||
|
||||
public String getCurrency_format() {
|
||||
return currency_format;
|
||||
}
|
||||
|
||||
public void setCurrency_format(String currency_format) {
|
||||
this.currency_format = currency_format;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClassPojo [thousand_separator = " + thousand_separator + ", decimal_separator = " + decimal_separator + ", currency_position = " + currency_position + ", weight_unit = " + weight_unit + ", currency = " + currency + ", timezone = " + timezone + ", generate_password = " + generate_password + ", price_num_decimals = " + price_num_decimals + ", tax_included = " + tax_included + ", ssl_enabled = " + ssl_enabled + ", permalinks_enabled = " + permalinks_enabled + ", dimension_unit = " + dimension_unit + ", currency_format = " + currency_format + "]";
|
||||
}
|
||||
}
|
||||
26
woodroid/src/main/java/me/gilo/woodroid/models/Metadata.java
Normal file
@ -0,0 +1,26 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Metadata implements Serializable {
|
||||
int id;
|
||||
String key;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getKey() {
|
||||
return key;
|
||||
}
|
||||
|
||||
public void setKey(String key) {
|
||||
this.key = key;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
10
woodroid/src/main/java/me/gilo/woodroid/models/Metum.java
Normal file
@ -0,0 +1,10 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
public class Metum {
|
||||
public String key;
|
||||
public String label;
|
||||
public String value;
|
||||
}
|
||||
16
woodroid/src/main/java/me/gilo/woodroid/models/Option.java
Normal file
@ -0,0 +1,16 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 11/26/2015.
|
||||
*/
|
||||
public class Option {
|
||||
private String[] size;
|
||||
|
||||
public String[] getSize() {
|
||||
return size;
|
||||
}
|
||||
|
||||
public void setSize(String[] size) {
|
||||
this.size = size;
|
||||
}
|
||||
}
|
||||
305
woodroid/src/main/java/me/gilo/woodroid/models/Order.java
Normal file
@ -0,0 +1,305 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
public class Order {
|
||||
public int id;
|
||||
@SerializedName("order_number")
|
||||
public String orderNumber;
|
||||
@SerializedName("created_at")
|
||||
public String createdAt;
|
||||
@SerializedName("updated_at")
|
||||
public String updatedAt;
|
||||
@SerializedName("completed_at")
|
||||
public String completedAt;
|
||||
public String status;
|
||||
public String currency;
|
||||
public String total;
|
||||
public String subtotal;
|
||||
@SerializedName("total_line_items_quantity")
|
||||
public int totalLineItemsQuantity;
|
||||
@SerializedName("total_tax")
|
||||
public String totalTax;
|
||||
@SerializedName("total_shipping")
|
||||
public String totalShipping;
|
||||
@SerializedName("cart_tax")
|
||||
public String cartTax;
|
||||
@SerializedName("shipping_tax")
|
||||
public String shippingTax;
|
||||
@SerializedName("total_discount")
|
||||
public String totalDiscount;
|
||||
@SerializedName("shipping_methods")
|
||||
public String shippingMethods;
|
||||
@SerializedName("payment_details")
|
||||
public PaymentDetails paymentDetails;
|
||||
@SerializedName("billing_address")
|
||||
public BillingAddress billingAddress;
|
||||
@SerializedName("shipping_address")
|
||||
public ShippingAddress shippingAddress;
|
||||
public String note;
|
||||
@SerializedName("customer_ip")
|
||||
public String customerIp;
|
||||
@SerializedName("customer_user_agent")
|
||||
public String customerUserAgent;
|
||||
@SerializedName("customer_id")
|
||||
public Integer customerId;
|
||||
@SerializedName("view_order_url")
|
||||
public String viewOrderUrl;
|
||||
@SerializedName("line_items")
|
||||
public List<LineItem> lineItems = new ArrayList<LineItem>();
|
||||
@SerializedName("shipping_lines")
|
||||
public List<ShippingLine> shippingLines = new ArrayList<>();
|
||||
@SerializedName("tax_lines")
|
||||
public List<TaxLine> taxLines = new ArrayList<>();
|
||||
@SerializedName("fee_lines")
|
||||
public List<FeeLine> feeLines = new ArrayList<>();
|
||||
@SerializedName("coupon_lines")
|
||||
public List<Object> couponLines = new ArrayList<Object>();
|
||||
public Customer customer;
|
||||
|
||||
public Integer getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(Integer id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getOrderNumber() {
|
||||
return orderNumber;
|
||||
}
|
||||
|
||||
public void setOrderNumber(String orderNumber) {
|
||||
this.orderNumber = orderNumber;
|
||||
}
|
||||
|
||||
public String getCreatedAt() {
|
||||
return createdAt;
|
||||
}
|
||||
|
||||
public void setCreatedAt(String createdAt) {
|
||||
this.createdAt = createdAt;
|
||||
}
|
||||
|
||||
public String getUpdatedAt() {
|
||||
return updatedAt;
|
||||
}
|
||||
|
||||
public void setUpdatedAt(String updatedAt) {
|
||||
this.updatedAt = updatedAt;
|
||||
}
|
||||
|
||||
public String getCompletedAt() {
|
||||
return completedAt;
|
||||
}
|
||||
|
||||
public void setCompletedAt(String completedAt) {
|
||||
this.completedAt = completedAt;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public String getCurrency() {
|
||||
return currency;
|
||||
}
|
||||
|
||||
public void setCurrency(String currency) {
|
||||
this.currency = currency;
|
||||
}
|
||||
|
||||
public String getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(String total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public String getSubtotal() {
|
||||
return subtotal;
|
||||
}
|
||||
|
||||
public void setSubtotal(String subtotal) {
|
||||
this.subtotal = subtotal;
|
||||
}
|
||||
|
||||
public Integer getTotalLineItemsQuantity() {
|
||||
return totalLineItemsQuantity;
|
||||
}
|
||||
|
||||
public void setTotalLineItemsQuantity(Integer totalLineItemsQuantity) {
|
||||
this.totalLineItemsQuantity = totalLineItemsQuantity;
|
||||
}
|
||||
|
||||
public String getTotalTax() {
|
||||
return totalTax;
|
||||
}
|
||||
|
||||
public void setTotalTax(String totalTax) {
|
||||
this.totalTax = totalTax;
|
||||
}
|
||||
|
||||
public String getTotalShipping() {
|
||||
return totalShipping;
|
||||
}
|
||||
|
||||
public void setTotalShipping(String totalShipping) {
|
||||
this.totalShipping = totalShipping;
|
||||
}
|
||||
|
||||
public String getCartTax() {
|
||||
return cartTax;
|
||||
}
|
||||
|
||||
public void setCartTax(String cartTax) {
|
||||
this.cartTax = cartTax;
|
||||
}
|
||||
|
||||
public String getShippingTax() {
|
||||
return shippingTax;
|
||||
}
|
||||
|
||||
public void setShippingTax(String shippingTax) {
|
||||
this.shippingTax = shippingTax;
|
||||
}
|
||||
|
||||
public String getTotalDiscount() {
|
||||
return totalDiscount;
|
||||
}
|
||||
|
||||
public void setTotalDiscount(String totalDiscount) {
|
||||
this.totalDiscount = totalDiscount;
|
||||
}
|
||||
|
||||
public String getShippingMethods() {
|
||||
return shippingMethods;
|
||||
}
|
||||
|
||||
public void setShippingMethods(String shippingMethods) {
|
||||
this.shippingMethods = shippingMethods;
|
||||
}
|
||||
|
||||
public PaymentDetails getPaymentDetails() {
|
||||
return paymentDetails;
|
||||
}
|
||||
|
||||
public void setPaymentDetails(PaymentDetails paymentDetails) {
|
||||
this.paymentDetails = paymentDetails;
|
||||
}
|
||||
|
||||
public BillingAddress getBillingAddress() {
|
||||
return billingAddress;
|
||||
}
|
||||
|
||||
public void setBillingAddress(BillingAddress billingAddress) {
|
||||
this.billingAddress = billingAddress;
|
||||
}
|
||||
|
||||
public ShippingAddress getShippingAddress() {
|
||||
return shippingAddress;
|
||||
}
|
||||
|
||||
public void setShippingAddress(ShippingAddress shippingAddress) {
|
||||
this.shippingAddress = shippingAddress;
|
||||
}
|
||||
|
||||
public String getNote() {
|
||||
return note;
|
||||
}
|
||||
|
||||
public void setNote(String note) {
|
||||
this.note = note;
|
||||
}
|
||||
|
||||
public String getCustomerIp() {
|
||||
return customerIp;
|
||||
}
|
||||
|
||||
public void setCustomerIp(String customerIp) {
|
||||
this.customerIp = customerIp;
|
||||
}
|
||||
|
||||
public String getCustomerUserAgent() {
|
||||
return customerUserAgent;
|
||||
}
|
||||
|
||||
public void setCustomerUserAgent(String customerUserAgent) {
|
||||
this.customerUserAgent = customerUserAgent;
|
||||
}
|
||||
|
||||
public Integer getCustomerId() {
|
||||
return customerId;
|
||||
}
|
||||
|
||||
public void setCustomerId(Integer customerId) {
|
||||
this.customerId = customerId;
|
||||
}
|
||||
|
||||
public String getViewOrderUrl() {
|
||||
return viewOrderUrl;
|
||||
}
|
||||
|
||||
public void setViewOrderUrl(String viewOrderUrl) {
|
||||
this.viewOrderUrl = viewOrderUrl;
|
||||
}
|
||||
|
||||
public List<LineItem> getLineItems() {
|
||||
return lineItems;
|
||||
}
|
||||
|
||||
public void setLineItems(List<LineItem> lineItems) {
|
||||
this.lineItems = lineItems;
|
||||
}
|
||||
|
||||
public List<ShippingLine> getShippingLines() {
|
||||
return shippingLines;
|
||||
}
|
||||
|
||||
public void setShippingLines(List<ShippingLine> shippingLines) {
|
||||
this.shippingLines = shippingLines;
|
||||
}
|
||||
|
||||
public List<TaxLine> getTaxLines() {
|
||||
return taxLines;
|
||||
}
|
||||
|
||||
public void setTaxLines(List<TaxLine> taxLines) {
|
||||
this.taxLines = taxLines;
|
||||
}
|
||||
|
||||
public List<FeeLine> getFeeLines() {
|
||||
return feeLines;
|
||||
}
|
||||
|
||||
public void setFeeLines(List<FeeLine> feeLines) {
|
||||
this.feeLines = feeLines;
|
||||
}
|
||||
|
||||
public List<Object> getCouponLines() {
|
||||
return couponLines;
|
||||
}
|
||||
|
||||
public void setCouponLines(List<Object> couponLines) {
|
||||
this.couponLines = couponLines;
|
||||
}
|
||||
|
||||
public Customer getCustomer() {
|
||||
return customer;
|
||||
}
|
||||
|
||||
public void setCustomer(Customer customer) {
|
||||
this.customer = customer;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,16 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/12/2015.
|
||||
*/
|
||||
public class OrderData {
|
||||
Order order;
|
||||
|
||||
public Order getOrder() {
|
||||
return order;
|
||||
}
|
||||
|
||||
public void setOrder(Order order) {
|
||||
this.order = order;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
public class PaymentDetails {
|
||||
@SerializedName("method_id")
|
||||
public String methodId;
|
||||
@SerializedName("method_title")
|
||||
public String methodTitle;
|
||||
public Boolean paid;
|
||||
|
||||
public String getMethodId() {
|
||||
return methodId;
|
||||
}
|
||||
|
||||
public void setMethodId(String methodId) {
|
||||
this.methodId = methodId;
|
||||
}
|
||||
|
||||
public String getMethodTitle() {
|
||||
return methodTitle;
|
||||
}
|
||||
|
||||
public void setMethodTitle(String methodTitle) {
|
||||
this.methodTitle = methodTitle;
|
||||
}
|
||||
|
||||
public Boolean getPaid() {
|
||||
return paid;
|
||||
}
|
||||
|
||||
public void setPaid(Boolean paid) {
|
||||
this.paid = paid;
|
||||
}
|
||||
}
|
||||
572
woodroid/src/main/java/me/gilo/woodroid/models/Product.java
Normal file
@ -0,0 +1,572 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
public class Product implements Serializable {
|
||||
|
||||
int id;
|
||||
String title;
|
||||
String name;
|
||||
String slug;
|
||||
String permalink;
|
||||
String type;
|
||||
String status;
|
||||
boolean featured;
|
||||
String catalog_visibility;
|
||||
String description;
|
||||
String short_description;
|
||||
String sku;
|
||||
String price;
|
||||
String regular_price;
|
||||
String sale_price;
|
||||
Date date_on_sale_from;
|
||||
Date date_on_sale_from_gmt;
|
||||
Date date_on_sale_to;
|
||||
Date date_on_sale_to_gmt;
|
||||
String price_html;
|
||||
boolean on_sale;
|
||||
boolean purchasable;
|
||||
int total_sales;
|
||||
boolean virtual;
|
||||
boolean downloadable;
|
||||
ArrayList<Download> downloads;
|
||||
int download_limit;
|
||||
int download_expiry;
|
||||
String external_url;
|
||||
String button_text;
|
||||
String tax_status;
|
||||
String tax_class;
|
||||
boolean manage_stock;
|
||||
int stock_quantity;
|
||||
boolean in_stock;
|
||||
String backorders;
|
||||
boolean backorders_allowed;
|
||||
boolean backordered;
|
||||
boolean sold_individually;
|
||||
String weight;
|
||||
Object dimensions;
|
||||
boolean shipping_required;
|
||||
boolean shipping_taxable;
|
||||
String shipping_class;
|
||||
int shipping_class_id;
|
||||
boolean reviews_allowed;
|
||||
String average_rating;
|
||||
int rating_count;
|
||||
ArrayList<Integer> related_ids;
|
||||
ArrayList<Integer> upsell_ids;
|
||||
ArrayList<Integer> cross_sell_ids;
|
||||
int parent_id;
|
||||
String purchase_note;
|
||||
ArrayList<Category> categories;
|
||||
ArrayList<Tag> tags;
|
||||
ArrayList<Attribute> attributes;
|
||||
ArrayList<DefaultAttribute> default_attributes;
|
||||
ArrayList<Integer> variations;
|
||||
ArrayList<Integer> grouped_products;
|
||||
int menu_order;
|
||||
ArrayList<Metadata> meta_data;
|
||||
ArrayList<Image> images;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSlug() {
|
||||
return slug;
|
||||
}
|
||||
|
||||
public void setSlug(String slug) {
|
||||
this.slug = slug;
|
||||
}
|
||||
|
||||
public String getPermalink() {
|
||||
return permalink;
|
||||
}
|
||||
|
||||
public void setPermalink(String permalink) {
|
||||
this.permalink = permalink;
|
||||
}
|
||||
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public void setType(String type) {
|
||||
this.type = type;
|
||||
}
|
||||
|
||||
public String getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(String status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
public boolean isFeatured() {
|
||||
return featured;
|
||||
}
|
||||
|
||||
public void setFeatured(boolean featured) {
|
||||
this.featured = featured;
|
||||
}
|
||||
|
||||
public String getCatalog_visibility() {
|
||||
return catalog_visibility;
|
||||
}
|
||||
|
||||
public void setCatalog_visibility(String catalog_visibility) {
|
||||
this.catalog_visibility = catalog_visibility;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getShort_description() {
|
||||
return short_description;
|
||||
}
|
||||
|
||||
public void setShort_description(String short_description) {
|
||||
this.short_description = short_description;
|
||||
}
|
||||
|
||||
public String getSku() {
|
||||
return sku;
|
||||
}
|
||||
|
||||
public void setSku(String sku) {
|
||||
this.sku = sku;
|
||||
}
|
||||
|
||||
public String getPrice() {
|
||||
return price;
|
||||
}
|
||||
|
||||
public void setPrice(String price) {
|
||||
this.price = price;
|
||||
}
|
||||
|
||||
public String getRegular_price() {
|
||||
return regular_price;
|
||||
}
|
||||
|
||||
public void setRegular_price(String regular_price) {
|
||||
this.regular_price = regular_price;
|
||||
}
|
||||
|
||||
public String getSale_price() {
|
||||
return sale_price;
|
||||
}
|
||||
|
||||
public void setSale_price(String sale_price) {
|
||||
this.sale_price = sale_price;
|
||||
}
|
||||
|
||||
public Date getDate_on_sale_from() {
|
||||
return date_on_sale_from;
|
||||
}
|
||||
|
||||
public void setDate_on_sale_from(Date date_on_sale_from) {
|
||||
this.date_on_sale_from = date_on_sale_from;
|
||||
}
|
||||
|
||||
public Date getDate_on_sale_from_gmt() {
|
||||
return date_on_sale_from_gmt;
|
||||
}
|
||||
|
||||
public void setDate_on_sale_from_gmt(Date date_on_sale_from_gmt) {
|
||||
this.date_on_sale_from_gmt = date_on_sale_from_gmt;
|
||||
}
|
||||
|
||||
public Date getDate_on_sale_to() {
|
||||
return date_on_sale_to;
|
||||
}
|
||||
|
||||
public void setDate_on_sale_to(Date date_on_sale_to) {
|
||||
this.date_on_sale_to = date_on_sale_to;
|
||||
}
|
||||
|
||||
public Date getDate_on_sale_to_gmt() {
|
||||
return date_on_sale_to_gmt;
|
||||
}
|
||||
|
||||
public void setDate_on_sale_to_gmt(Date date_on_sale_to_gmt) {
|
||||
this.date_on_sale_to_gmt = date_on_sale_to_gmt;
|
||||
}
|
||||
|
||||
public String getPrice_html() {
|
||||
return price_html;
|
||||
}
|
||||
|
||||
public void setPrice_html(String price_html) {
|
||||
this.price_html = price_html;
|
||||
}
|
||||
|
||||
public boolean isOn_sale() {
|
||||
return on_sale;
|
||||
}
|
||||
|
||||
public void setOn_sale(boolean on_sale) {
|
||||
this.on_sale = on_sale;
|
||||
}
|
||||
|
||||
public boolean isPurchasable() {
|
||||
return purchasable;
|
||||
}
|
||||
|
||||
public void setPurchasable(boolean purchasable) {
|
||||
this.purchasable = purchasable;
|
||||
}
|
||||
|
||||
public int getTotal_sales() {
|
||||
return total_sales;
|
||||
}
|
||||
|
||||
public void setTotal_sales(int total_sales) {
|
||||
this.total_sales = total_sales;
|
||||
}
|
||||
|
||||
public boolean isVirtual() {
|
||||
return virtual;
|
||||
}
|
||||
|
||||
public void setVirtual(boolean virtual) {
|
||||
this.virtual = virtual;
|
||||
}
|
||||
|
||||
public boolean isDownloadable() {
|
||||
return downloadable;
|
||||
}
|
||||
|
||||
public void setDownloadable(boolean downloadable) {
|
||||
this.downloadable = downloadable;
|
||||
}
|
||||
|
||||
public ArrayList<Download> getDownloads() {
|
||||
return downloads;
|
||||
}
|
||||
|
||||
public void setDownloads(ArrayList<Download> downloads) {
|
||||
this.downloads = downloads;
|
||||
}
|
||||
|
||||
public int getDownload_limit() {
|
||||
return download_limit;
|
||||
}
|
||||
|
||||
public void setDownload_limit(int download_limit) {
|
||||
this.download_limit = download_limit;
|
||||
}
|
||||
|
||||
public int getDownload_expiry() {
|
||||
return download_expiry;
|
||||
}
|
||||
|
||||
public void setDownload_expiry(int download_expiry) {
|
||||
this.download_expiry = download_expiry;
|
||||
}
|
||||
|
||||
public String getExternal_url() {
|
||||
return external_url;
|
||||
}
|
||||
|
||||
public void setExternal_url(String external_url) {
|
||||
this.external_url = external_url;
|
||||
}
|
||||
|
||||
public String getButton_text() {
|
||||
return button_text;
|
||||
}
|
||||
|
||||
public void setButton_text(String button_text) {
|
||||
this.button_text = button_text;
|
||||
}
|
||||
|
||||
public String getTax_status() {
|
||||
return tax_status;
|
||||
}
|
||||
|
||||
public void setTax_status(String tax_status) {
|
||||
this.tax_status = tax_status;
|
||||
}
|
||||
|
||||
public String getTax_class() {
|
||||
return tax_class;
|
||||
}
|
||||
|
||||
public void setTax_class(String tax_class) {
|
||||
this.tax_class = tax_class;
|
||||
}
|
||||
|
||||
public boolean isManage_stock() {
|
||||
return manage_stock;
|
||||
}
|
||||
|
||||
public void setManage_stock(boolean manage_stock) {
|
||||
this.manage_stock = manage_stock;
|
||||
}
|
||||
|
||||
public int getStock_quantity() {
|
||||
return stock_quantity;
|
||||
}
|
||||
|
||||
public void setStock_quantity(int stock_quantity) {
|
||||
this.stock_quantity = stock_quantity;
|
||||
}
|
||||
|
||||
public boolean isIn_stock() {
|
||||
return in_stock;
|
||||
}
|
||||
|
||||
public void setIn_stock(boolean in_stock) {
|
||||
this.in_stock = in_stock;
|
||||
}
|
||||
|
||||
public String getBackorders() {
|
||||
return backorders;
|
||||
}
|
||||
|
||||
public void setBackorders(String backorders) {
|
||||
this.backorders = backorders;
|
||||
}
|
||||
|
||||
public boolean isBackorders_allowed() {
|
||||
return backorders_allowed;
|
||||
}
|
||||
|
||||
public void setBackorders_allowed(boolean backorders_allowed) {
|
||||
this.backorders_allowed = backorders_allowed;
|
||||
}
|
||||
|
||||
public boolean isBackordered() {
|
||||
return backordered;
|
||||
}
|
||||
|
||||
public void setBackordered(boolean backordered) {
|
||||
this.backordered = backordered;
|
||||
}
|
||||
|
||||
public boolean isSold_individually() {
|
||||
return sold_individually;
|
||||
}
|
||||
|
||||
public void setSold_individually(boolean sold_individually) {
|
||||
this.sold_individually = sold_individually;
|
||||
}
|
||||
|
||||
public String getWeight() {
|
||||
return weight;
|
||||
}
|
||||
|
||||
public void setWeight(String weight) {
|
||||
this.weight = weight;
|
||||
}
|
||||
|
||||
public Object getDimensions() {
|
||||
return dimensions;
|
||||
}
|
||||
|
||||
public void setDimensions(Object dimensions) {
|
||||
this.dimensions = dimensions;
|
||||
}
|
||||
|
||||
public boolean isShipping_required() {
|
||||
return shipping_required;
|
||||
}
|
||||
|
||||
public void setShipping_required(boolean shipping_required) {
|
||||
this.shipping_required = shipping_required;
|
||||
}
|
||||
|
||||
public boolean isShipping_taxable() {
|
||||
return shipping_taxable;
|
||||
}
|
||||
|
||||
public void setShipping_taxable(boolean shipping_taxable) {
|
||||
this.shipping_taxable = shipping_taxable;
|
||||
}
|
||||
|
||||
public String getShipping_class() {
|
||||
return shipping_class;
|
||||
}
|
||||
|
||||
public void setShipping_class(String shipping_class) {
|
||||
this.shipping_class = shipping_class;
|
||||
}
|
||||
|
||||
public int getShipping_class_id() {
|
||||
return shipping_class_id;
|
||||
}
|
||||
|
||||
public void setShipping_class_id(int shipping_class_id) {
|
||||
this.shipping_class_id = shipping_class_id;
|
||||
}
|
||||
|
||||
public boolean isReviews_allowed() {
|
||||
return reviews_allowed;
|
||||
}
|
||||
|
||||
public void setReviews_allowed(boolean reviews_allowed) {
|
||||
this.reviews_allowed = reviews_allowed;
|
||||
}
|
||||
|
||||
public String getAverage_rating() {
|
||||
return average_rating;
|
||||
}
|
||||
|
||||
public void setAverage_rating(String average_rating) {
|
||||
this.average_rating = average_rating;
|
||||
}
|
||||
|
||||
public int getRating_count() {
|
||||
return rating_count;
|
||||
}
|
||||
|
||||
public void setRating_count(int rating_count) {
|
||||
this.rating_count = rating_count;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getRelated_ids() {
|
||||
return related_ids;
|
||||
}
|
||||
|
||||
public void setRelated_ids(ArrayList<Integer> related_ids) {
|
||||
this.related_ids = related_ids;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getUpsell_ids() {
|
||||
return upsell_ids;
|
||||
}
|
||||
|
||||
public void setUpsell_ids(ArrayList<Integer> upsell_ids) {
|
||||
this.upsell_ids = upsell_ids;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getCross_sell_ids() {
|
||||
return cross_sell_ids;
|
||||
}
|
||||
|
||||
public void setCross_sell_ids(ArrayList<Integer> cross_sell_ids) {
|
||||
this.cross_sell_ids = cross_sell_ids;
|
||||
}
|
||||
|
||||
public int getParent_id() {
|
||||
return parent_id;
|
||||
}
|
||||
|
||||
public void setParent_id(int parent_id) {
|
||||
this.parent_id = parent_id;
|
||||
}
|
||||
|
||||
public String getPurchase_note() {
|
||||
return purchase_note;
|
||||
}
|
||||
|
||||
public void setPurchase_note(String purchase_note) {
|
||||
this.purchase_note = purchase_note;
|
||||
}
|
||||
|
||||
public ArrayList<Category> getCategories() {
|
||||
return categories;
|
||||
}
|
||||
|
||||
public void setCategories(ArrayList<Category> categories) {
|
||||
this.categories = categories;
|
||||
}
|
||||
|
||||
public ArrayList<Tag> getTags() {
|
||||
return tags;
|
||||
}
|
||||
|
||||
public void setTags(ArrayList<Tag> tags) {
|
||||
this.tags = tags;
|
||||
}
|
||||
|
||||
public ArrayList<Attribute> getAttributes() {
|
||||
return attributes;
|
||||
}
|
||||
|
||||
public void setAttributes(ArrayList<Attribute> attributes) {
|
||||
this.attributes = attributes;
|
||||
}
|
||||
|
||||
public ArrayList<DefaultAttribute> getDefault_attributes() {
|
||||
return default_attributes;
|
||||
}
|
||||
|
||||
public void setDefault_attributes(ArrayList<DefaultAttribute> default_attributes) {
|
||||
this.default_attributes = default_attributes;
|
||||
}
|
||||
|
||||
|
||||
public ArrayList<Integer> getVariations() {
|
||||
return variations;
|
||||
}
|
||||
|
||||
public void setVariations(ArrayList<Integer> variations) {
|
||||
this.variations = variations;
|
||||
}
|
||||
|
||||
public ArrayList<Integer> getGrouped_products() {
|
||||
return grouped_products;
|
||||
}
|
||||
|
||||
public void setGrouped_products(ArrayList<Integer> grouped_products) {
|
||||
this.grouped_products = grouped_products;
|
||||
}
|
||||
|
||||
public int getMenu_order() {
|
||||
return menu_order;
|
||||
}
|
||||
|
||||
public void setMenu_order(int menu_order) {
|
||||
this.menu_order = menu_order;
|
||||
}
|
||||
|
||||
public ArrayList<Metadata> getMeta_data() {
|
||||
return meta_data;
|
||||
}
|
||||
|
||||
public void setMeta_data(ArrayList<Metadata> meta_data) {
|
||||
this.meta_data = meta_data;
|
||||
}
|
||||
|
||||
public ArrayList<Image> getImages() {
|
||||
return images;
|
||||
}
|
||||
|
||||
public void setImages(ArrayList<Image> images) {
|
||||
this.images = images;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,82 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/9/2015.
|
||||
*/
|
||||
public class ProductReview implements Serializable{
|
||||
private int id;
|
||||
private Date date_created;
|
||||
private Date date_created_gmt;
|
||||
private String review;
|
||||
private int rating;
|
||||
private String name;
|
||||
private String email;
|
||||
private boolean verified;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public Date getDate_created() {
|
||||
return date_created;
|
||||
}
|
||||
|
||||
public void setDate_created(Date date_created) {
|
||||
this.date_created = date_created;
|
||||
}
|
||||
|
||||
public Date getDate_created_gmt() {
|
||||
return date_created_gmt;
|
||||
}
|
||||
|
||||
public void setDate_created_gmt(Date date_created_gmt) {
|
||||
this.date_created_gmt = date_created_gmt;
|
||||
}
|
||||
|
||||
public String getReview() {
|
||||
return review;
|
||||
}
|
||||
|
||||
public void setReview(String review) {
|
||||
this.review = review;
|
||||
}
|
||||
|
||||
public int getRating() {
|
||||
return rating;
|
||||
}
|
||||
|
||||
public void setRating(int rating) {
|
||||
this.rating = rating;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getEmail() {
|
||||
return email;
|
||||
}
|
||||
|
||||
public void setEmail(String email) {
|
||||
this.email = email;
|
||||
}
|
||||
|
||||
public boolean isVerified() {
|
||||
return verified;
|
||||
}
|
||||
|
||||
public void setVerified(boolean verified) {
|
||||
this.verified = verified;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/7/2015.
|
||||
*/
|
||||
public class ShippingAddress {
|
||||
public int id;
|
||||
@SerializedName("first_name")
|
||||
public String firstName;
|
||||
@SerializedName("last_name")
|
||||
public String lastName;
|
||||
public String company;
|
||||
@SerializedName("address_1")
|
||||
public String address1;
|
||||
@SerializedName("address_2")
|
||||
public String address2;
|
||||
public String city;
|
||||
public String state;
|
||||
public String postcode;
|
||||
public String country;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getFirstName() {
|
||||
return firstName;
|
||||
}
|
||||
|
||||
public void setFirstName(String firstName) {
|
||||
this.firstName = firstName;
|
||||
}
|
||||
|
||||
public String getLastName() {
|
||||
return lastName;
|
||||
}
|
||||
|
||||
public void setLastName(String lastName) {
|
||||
this.lastName = lastName;
|
||||
}
|
||||
|
||||
public String getCompany() {
|
||||
return company;
|
||||
}
|
||||
|
||||
public void setCompany(String company) {
|
||||
this.company = company;
|
||||
}
|
||||
|
||||
public String getAddress1() {
|
||||
return address1;
|
||||
}
|
||||
|
||||
public void setAddress1(String address1) {
|
||||
this.address1 = address1;
|
||||
}
|
||||
|
||||
public String getAddress2() {
|
||||
return address2;
|
||||
}
|
||||
|
||||
public void setAddress2(String address2) {
|
||||
this.address2 = address2;
|
||||
}
|
||||
|
||||
public String getCity() {
|
||||
return city;
|
||||
}
|
||||
|
||||
public void setCity(String city) {
|
||||
this.city = city;
|
||||
}
|
||||
|
||||
public String getState() {
|
||||
return state;
|
||||
}
|
||||
|
||||
public void setState(String state) {
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
public String getPostcode() {
|
||||
return postcode;
|
||||
}
|
||||
|
||||
public void setPostcode(String postcode) {
|
||||
this.postcode = postcode;
|
||||
}
|
||||
|
||||
public String getCountry() {
|
||||
return country;
|
||||
}
|
||||
|
||||
public void setCountry(String country) {
|
||||
this.country = country;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,38 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/8/2015.
|
||||
*/
|
||||
public class ShippingLine {
|
||||
@SerializedName("method_id")
|
||||
private String id;
|
||||
@SerializedName("method_title")
|
||||
private String methodTitle;
|
||||
private int total;
|
||||
|
||||
public String getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(String id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getMethodTitle() {
|
||||
return methodTitle;
|
||||
}
|
||||
|
||||
public void setMethodTitle(String methodTitle) {
|
||||
this.methodTitle = methodTitle;
|
||||
}
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
}
|
||||
69
woodroid/src/main/java/me/gilo/woodroid/models/Store.java
Normal file
@ -0,0 +1,69 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by gilo on 1/19/16.
|
||||
*/
|
||||
public class Store {
|
||||
|
||||
private String wc_version;
|
||||
private String description;
|
||||
private String name;
|
||||
private String URL;
|
||||
private Meta meta;
|
||||
|
||||
private String version;
|
||||
|
||||
public String getWc_version() {
|
||||
return wc_version;
|
||||
}
|
||||
|
||||
public void setWc_version(String wc_version) {
|
||||
this.wc_version = wc_version;
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
return description;
|
||||
}
|
||||
|
||||
public void setDescription(String description) {
|
||||
this.description = description;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getURL() {
|
||||
return URL;
|
||||
}
|
||||
|
||||
public void setURL(String URL) {
|
||||
this.URL = URL;
|
||||
}
|
||||
|
||||
public Meta getMeta() {
|
||||
return meta;
|
||||
}
|
||||
|
||||
public void setMeta(Meta meta) {
|
||||
this.meta = meta;
|
||||
}
|
||||
|
||||
public String getVersion() {
|
||||
return version;
|
||||
}
|
||||
|
||||
public void setVersion(String version) {
|
||||
this.version = version;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "ClassPojo [wc_version = " + wc_version + ", description = " + description + ", name = " + name + ", URL = " + URL + ", meta = " + meta + ", version = " + version + "]";
|
||||
}
|
||||
|
||||
}
|
||||
33
woodroid/src/main/java/me/gilo/woodroid/models/Tag.java
Normal file
@ -0,0 +1,33 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
public class Tag implements Serializable {
|
||||
private int id;
|
||||
private String name;
|
||||
private String slug;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
public String getSlug() {
|
||||
return slug;
|
||||
}
|
||||
|
||||
public void setSlug(String slug) {
|
||||
this.slug = slug;
|
||||
}
|
||||
}
|
||||
61
woodroid/src/main/java/me/gilo/woodroid/models/TaxLine.java
Normal file
@ -0,0 +1,61 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 12/8/2015.
|
||||
*/
|
||||
public class TaxLine {
|
||||
private int id;
|
||||
private int rate_id;
|
||||
private String code;
|
||||
private String title;
|
||||
private double total;
|
||||
private boolean compound;
|
||||
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public void setId(int id) {
|
||||
this.id = id;
|
||||
}
|
||||
|
||||
public int getRate_id() {
|
||||
return rate_id;
|
||||
}
|
||||
|
||||
public void setRate_id(int rate_id) {
|
||||
this.rate_id = rate_id;
|
||||
}
|
||||
|
||||
public String getCode() {
|
||||
return code;
|
||||
}
|
||||
|
||||
public void setCode(String code) {
|
||||
this.code = code;
|
||||
}
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public double getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(double total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public boolean isCompound() {
|
||||
return compound;
|
||||
}
|
||||
|
||||
public void setCompound(boolean compound) {
|
||||
this.compound = compound;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,34 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 1/24/2016.
|
||||
*/
|
||||
public class TopSellers {
|
||||
private String title;
|
||||
private int product_id;
|
||||
private int quantity;
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public void setTitle(String title) {
|
||||
this.title = title;
|
||||
}
|
||||
|
||||
public int getProduct_id() {
|
||||
return product_id;
|
||||
}
|
||||
|
||||
public void setProduct_id(int product_id) {
|
||||
this.product_id = product_id;
|
||||
}
|
||||
|
||||
public int getQuantity() {
|
||||
return quantity;
|
||||
}
|
||||
|
||||
public void setQuantity(int quantity) {
|
||||
this.quantity = quantity;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,8 @@
|
||||
package me.gilo.woodroid.models;
|
||||
|
||||
/**
|
||||
* Created by Aron on 11/26/2015.
|
||||
*/
|
||||
public class Variation {
|
||||
|
||||
}
|
||||
@ -0,0 +1,72 @@
|
||||
package me.gilo.woodroid.repo;
|
||||
|
||||
import me.gilo.woodroid.data.API;
|
||||
import me.gilo.woodroid.data.RestAdapter;
|
||||
import me.gilo.woodroid.models.Category;
|
||||
import me.gilo.woodroid.models.Product;
|
||||
import retrofit2.Call;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
|
||||
public class ProductRepository {
|
||||
|
||||
private String baseUrl;
|
||||
private String consumerKey;
|
||||
private String consumerSecret;
|
||||
|
||||
RestAdapter restAdapter;
|
||||
|
||||
public ProductRepository(String baseUrl, String consumerKey, String consumerSecret) {
|
||||
this.baseUrl = baseUrl;
|
||||
this.consumerKey = consumerKey;
|
||||
this.consumerSecret = consumerSecret;
|
||||
|
||||
restAdapter = new RestAdapter(baseUrl, consumerKey, consumerSecret);
|
||||
}
|
||||
|
||||
public Call<ArrayList<Product>> products() {
|
||||
API apiService = restAdapter.createAPI("products");
|
||||
return apiService.getProducts();
|
||||
|
||||
}
|
||||
|
||||
//TODO
|
||||
public void create(Product product) {
|
||||
|
||||
}
|
||||
|
||||
//TODO
|
||||
public void update() {
|
||||
|
||||
}
|
||||
|
||||
//TODO
|
||||
public void delete() {
|
||||
|
||||
}
|
||||
|
||||
public Call<ArrayList<Product>> products(HashMap<String, String> filters) {
|
||||
API apiService = restAdapter.createAPI("products", filters);
|
||||
return apiService.filter(filters);
|
||||
}
|
||||
|
||||
public Call<ArrayList<Category>> categories() {
|
||||
API apiService = restAdapter.createAPI("products/categories");
|
||||
return apiService.getCategories();
|
||||
}
|
||||
|
||||
public Call<ArrayList<Category>> categories(HashMap<String, String> filters) {
|
||||
API apiService = restAdapter.createAPI("products/categories", filters);
|
||||
return apiService.getCategories();
|
||||
}
|
||||
|
||||
public Call<ArrayList<Category>> categories(int parent_category) {
|
||||
API apiService = restAdapter.createAPI("products/categories");
|
||||
return apiService.getCategories();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
3
woodroid/src/main/res/values/strings.xml
Normal file
@ -0,0 +1,3 @@
|
||||
<resources>
|
||||
<string name="app_name">wooDroid</string>
|
||||
</resources>
|
||||
17
woodroid/src/test/java/me/gilo/woodroid/ExampleUnitTest.java
Normal file
@ -0,0 +1,17 @@
|
||||
package me.gilo.woodroid;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
|
||||
/**
|
||||
* Example local unit test, which will execute on the development machine (host).
|
||||
*
|
||||
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
|
||||
*/
|
||||
public class ExampleUnitTest {
|
||||
@Test
|
||||
public void addition_isCorrect() {
|
||||
assertEquals(4, 2 + 2);
|
||||
}
|
||||
}
|
||||