com.github.theresasogunle.ExchangeRates.forex()   A
last analyzed

Complexity

Conditions 1

Size

Total Lines 14

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
c 1
b 0
f 0
dl 0
loc 14
rs 9.7
1
/*
2
 * To change this license header, choose License Headers in Project Properties.
3
 * To change this template file, choose Tools | Templates
4
 * and open the template in the editor.
5
 */
6
package com.github.theresasogunle;
7
8
import org.json.JSONObject;
9
10
/**
11
 *
12
 * @author Theresa
13
 */
14
public class ExchangeRates {
15
     ApiConnection apiConnection;
16
     Endpoints end= new Endpoints();
17
   
18
    private String amount;
19
    private String origin_currency;
20
    private String destination_currency;
21
    
22
     
23
      /**
24
     * @return JSONObject
25
     */
26
    public JSONObject forex(){
27
28
        
29
      this.apiConnection = new ApiConnection(end.getForexEndPoint());
30
      ApiQuery api= new ApiQuery();
31
     
32
      //API PARAMETERS
33
      api.putParams("SECKEY", RaveConstant.SECRET_KEY);
34
      api.putParams("origin_currency", this.getOrigin_currency());
35
      api.putParams("destination_currency", this.getDestination_currency());
36
      api.putParams("amount", this.getAmount());
37
    
38
      
39
      return this.apiConnection.connectAndQuery(api);
40
    
41
    }
42
43
    /**
44
     * @return the amount
45
     */
46
    public String getAmount() {
47
        return amount;
48
    }
49
50
    /**
51
     * @param amount the amount to set
52
     * @return ExchangeRates
53
     */
54
    public ExchangeRates setAmount(String amount) {
55
        this.amount = amount;
56
        return this;
57
    }
58
59
    /**
60
     * @return the origin_currency
61
     */
62
    public String getOrigin_currency() {
63
        return origin_currency;
64
    }
65
66
    /**
67
     * @param origin_currency the origin_currency to set
68
     * @return ExchangeRates
69
     */
70
    public ExchangeRates setOrigin_currency(String origin_currency) {
71
        this.origin_currency = origin_currency;
72
        return this;
73
    }
74
75
    /**
76
     * @return the destination_currency
77
     */
78
    public String getDestination_currency() {
79
        return destination_currency;
80
    }
81
82
    /**
83
     * @param destination_currency the destination_currency to set
84
     * @return ExchangeRates
85
     */
86
    public ExchangeRates setDestination_currency(String destination_currency) {
87
        this.destination_currency = destination_currency;
88
        return this;
89
    }
90
}
91