class AboutYou::SDK::Model::InitiateOrder

This class represents an initiate order model

Attributes

app_token[RW]

app token of the order

error_code[RW]

error code of the order

error_message[RW]

error message of the order

url[RW]

url of the order

user_token[RW]

user token for the order

Public Class Methods

create_from_json(json_object) click to toggle source

This method is used for creating an instance of this class by a json_object.

  • Args :

    • json_object -> the json_object received from the api

  • Returns :

    • Instance of AboutYou::SDK::Model::InitateOrder

# File lib/AboutYou/Model/initiate_order.rb, line 47
def self.create_from_json(json_object)
  order = new(
      json_object['url'],
      json_object['user_token'],
      json_object['app_token']
  )

  order.parse_error_result(json_object)

  order
end
new(url, user_token, app_token) click to toggle source

Constructor for the AboutYou::SDK::Model::InitiateOrder class

# File lib/AboutYou/Model/initiate_order.rb, line 30
def initialize(url, user_token, app_token)
  self.url        = url
  self.user_token = user_token
  self.app_token  = app_token

  self
end

Public Instance Methods

parse_error_result(json_object) click to toggle source

This method is used for parsing the error result

  • Args :

    • json_object -> the json_object received from the api

# File lib/AboutYou/Model/initiate_order.rb, line 65
def parse_error_result(json_object)
  self.error_code       = json_object.key?('error_code') ? json_object['error_code'] : 0
  self.error_message    = json_object.key?('error_message') ? json_object['error_message'] : nil
end